@amityco/ts-sdk 0.0.1-beta.39 → 0.0.1-beta.40
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/.eslintrc.json +2 -0
- package/dist/@types/core/events.d.ts +22 -22
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +3 -2
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +87 -34
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/channel.d.ts +1 -1
- package/dist/@types/domains/client.d.ts +1 -1
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/comment.d.ts +5 -0
- package/dist/@types/domains/comment.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +11 -0
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/content.d.ts +7 -1
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/@types/domains/group.d.ts +2 -2
- package/dist/@types/global.d.ts +8 -0
- package/dist/@types/global.d.ts.map +1 -1
- package/dist/cache/api/ingestInCache.d.ts +2 -1
- package/dist/cache/api/ingestInCache.d.ts.map +1 -1
- package/dist/channel/api/banChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/queryChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/unbanChannelMembers.d.ts.map +1 -1
- package/dist/channel/events/onChannelJoined.d.ts.map +1 -1
- package/dist/channel/events/onChannelLeft.d.ts.map +1 -1
- package/dist/channel/events/onChannelMemberAdded.d.ts.map +1 -1
- package/dist/channel/events/onChannelMemberBanned.d.ts.map +1 -1
- package/dist/channel/events/onChannelMemberRemoved.d.ts.map +1 -1
- package/dist/channel/events/onChannelMemberUnbanned.d.ts.map +1 -1
- package/dist/channel/utils/index.d.ts +2 -2
- package/dist/channel/utils/index.d.ts.map +1 -1
- package/dist/comment/api/createComment.d.ts +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/tests/updateComment.test.d.ts +2 -0
- package/dist/comment/api/tests/updateComment.test.d.ts.map +1 -0
- package/dist/community/api/addCommunityMembers.d.ts.map +1 -1
- package/dist/community/api/addCommunityMembersRoles.d.ts +1 -1
- package/dist/community/api/addCommunityMembersRoles.d.ts.map +1 -1
- package/dist/community/api/deleteCommunity.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/queryCommunityMembers.d.ts +1 -7
- 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 +1 -1
- package/dist/community/api/removeCommunityMembersRoles.d.ts.map +1 -1
- package/dist/community/events/index.d.ts +2 -0
- package/dist/community/events/index.d.ts.map +1 -1
- package/dist/community/events/onCommunityUserRoleAdded.d.ts +17 -0
- package/dist/community/events/onCommunityUserRoleAdded.d.ts.map +1 -0
- package/dist/community/events/onCommunityUserRoleRemoved.d.ts +17 -0
- package/dist/community/events/onCommunityUserRoleRemoved.d.ts.map +1 -0
- package/dist/community/events/test/onCommunityUserRoleAdded.test.d.ts +2 -0
- package/dist/community/events/test/onCommunityUserRoleAdded.test.d.ts.map +1 -0
- package/dist/community/events/test/onCommunityUserRoleRemoved.test.d.ts +2 -0
- package/dist/community/events/test/onCommunityUserRoleRemoved.test.d.ts.map +1 -0
- package/dist/community/events/utils.d.ts.map +1 -1
- package/dist/community/observers/index.d.ts +2 -0
- package/dist/community/observers/index.d.ts.map +1 -1
- package/dist/community/observers/liveCommunity.d.ts +21 -0
- package/dist/community/observers/liveCommunity.d.ts.map +1 -0
- package/dist/community/observers/liveCommunityMembers.d.ts +20 -0
- package/dist/community/observers/liveCommunityMembers.d.ts.map +1 -0
- package/dist/community/observers/tests/liveCommunity.test.d.ts +2 -0
- package/dist/community/observers/tests/liveCommunity.test.d.ts.map +1 -0
- package/dist/community/observers/tests/liveCommunityMembers.test.d.ts +2 -0
- package/dist/community/observers/tests/liveCommunityMembers.test.d.ts.map +1 -0
- package/dist/community/utils/payload.d.ts +3 -5
- package/dist/community/utils/payload.d.ts.map +1 -1
- package/dist/core/device.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts +2 -4
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/identifyModel.d.ts +2 -2
- package/dist/core/model/identifyModel.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/core/query/query.d.ts.map +1 -1
- package/dist/external/api/tests/createUserToken.test.d.ts +2 -0
- package/dist/external/api/tests/createUserToken.test.d.ts.map +1 -0
- package/dist/feed/api/queryGlobalFeed.d.ts.map +1 -1
- package/dist/group/utils/withUser.d.ts.map +1 -1
- package/dist/index.cjs.js +481 -200
- package/dist/index.esm.js +477 -200
- package/dist/index.umd.js +4 -4
- package/dist/message/api/createMessage.d.ts.map +1 -1
- package/dist/message/utils/index.d.ts +3 -3
- package/dist/message/utils/index.d.ts.map +1 -1
- package/dist/poll/api/tests/closePoll.test.d.ts +2 -0
- package/dist/poll/api/tests/closePoll.test.d.ts.map +1 -0
- package/dist/poll/api/tests/createPoll.test.d.ts +2 -0
- package/dist/poll/api/tests/createPoll.test.d.ts.map +1 -0
- package/dist/poll/api/tests/getPoll.test.d.ts +2 -0
- package/dist/poll/api/tests/getPoll.test.d.ts.map +1 -0
- package/dist/poll/api/tests/votePoll.test.d.ts +2 -0
- package/dist/poll/api/tests/votePoll.test.d.ts.map +1 -0
- 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/events/utils.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/reaction/events/onReactorAdded.d.ts.map +1 -1
- package/dist/reaction/events/onReactorRemoved.d.ts.map +1 -1
- package/dist/reaction/utils/dispatchReactable.d.ts +1 -1
- package/dist/reaction/utils/dispatchReactable.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/subChannel/utils/index.d.ts +1 -1
- package/dist/subChannel/utils/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/tests/dummy/channel.d.ts +31 -35
- package/dist/utils/tests/dummy/channel.d.ts.map +1 -1
- package/dist/utils/tests/dummy/community.d.ts +35 -84
- package/dist/utils/tests/dummy/community.d.ts.map +1 -1
- package/dist/utils/tests/dummy/feed.d.ts +2 -18
- package/dist/utils/tests/dummy/feed.d.ts.map +1 -1
- package/dist/utils/tests/dummy/member.d.ts +1 -1
- package/dist/utils/tests/dummy/post.d.ts +30 -29
- package/dist/utils/tests/dummy/post.d.ts.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/events.ts +22 -20
- package/src/@types/core/model.ts +3 -2
- package/src/@types/core/payload.ts +102 -38
- package/src/@types/domains/channel.ts +1 -1
- package/src/@types/domains/client.ts +1 -1
- package/src/@types/domains/comment.ts +7 -0
- package/src/@types/domains/community.ts +25 -0
- package/src/@types/domains/content.ts +9 -1
- package/src/@types/domains/group.ts +2 -2
- package/src/@types/global.ts +10 -0
- package/src/cache/api/ingestInCache.ts +3 -6
- package/src/cache/api/tests/ingestInCache.test.ts +12 -9
- package/src/channel/api/addChannelMembers.ts +5 -5
- package/src/channel/api/banChannelMembers.ts +1 -3
- package/src/channel/api/getChannel.ts +1 -1
- package/src/channel/api/queryChannelMembers.ts +1 -3
- package/src/channel/api/removeChannelMembers.ts +5 -5
- package/src/channel/api/tests/addChannelMembers.test.ts +4 -3
- package/src/channel/api/tests/createChannel.test.ts +5 -3
- package/src/channel/api/tests/getChannel.test.ts +2 -1
- package/src/channel/api/tests/joinChannel.test.ts +2 -2
- package/src/channel/api/tests/leaveChannel.test.ts +2 -2
- package/src/channel/api/tests/queryChannelMembers.test.ts +2 -5
- package/src/channel/api/tests/queryChannels.test.ts +4 -3
- package/src/channel/api/tests/removeChannelMembers.test.ts +16 -5
- package/src/channel/api/unbanChannelMembers.ts +1 -3
- package/src/channel/events/onChannelJoined.ts +1 -3
- package/src/channel/events/onChannelLeft.ts +1 -3
- package/src/channel/events/onChannelMemberAdded.ts +1 -3
- package/src/channel/events/onChannelMemberBanned.ts +1 -3
- package/src/channel/events/onChannelMemberRemoved.ts +1 -3
- package/src/channel/events/onChannelMemberUnbanned.ts +1 -3
- package/src/channel/observers/tests/liveChannelMembers.test.ts +5 -12
- package/src/channel/observers/tests/liveChannels.test.ts +3 -1
- package/src/channel/utils/index.ts +9 -6
- package/src/comment/api/createComment.ts +18 -2
- package/src/comment/api/deleteComment.ts +19 -2
- package/src/comment/api/tests/createComment.test.ts +169 -9
- package/src/comment/api/tests/updateComment.test.ts +189 -0
- package/src/comment/events/tests/onCommentCreated.test.ts +3 -3
- package/src/comment/events/tests/onCommentDeleted.test.ts +3 -3
- package/src/comment/observers/tests/liveComment.test.ts +18 -2
- package/src/community/api/addCommunityMembers.ts +6 -3
- package/src/community/api/addCommunityMembersRoles.ts +5 -2
- package/src/community/api/createCommunity.ts +5 -5
- package/src/community/api/deleteCommunity.ts +9 -1
- package/src/community/api/getCommunities.ts +2 -2
- package/src/community/api/getCommunity.ts +2 -2
- package/src/community/api/getRecommendedCommunities.ts +2 -2
- package/src/community/api/getTopTrendingCommunities.ts +2 -2
- package/src/community/api/joinCommunity.ts +6 -3
- package/src/community/api/leaveCommunity.ts +6 -3
- package/src/community/api/queryCommunities.ts +3 -3
- package/src/community/api/queryCommunityMembers.ts +3 -7
- package/src/community/api/removeCommunityMembers.ts +7 -3
- package/src/community/api/removeCommunityMembersRoles.ts +5 -2
- package/src/community/api/test/queryCommunityMembers.test.ts +2 -1
- package/src/community/api/test/removeCommunityMemberRole.test.ts +4 -1
- package/src/community/api/updateCommunity.ts +5 -5
- package/src/community/events/index.ts +2 -0
- package/src/community/events/onCommunityUserRoleAdded.ts +20 -0
- package/src/community/events/onCommunityUserRoleRemoved.ts +20 -0
- package/src/community/events/test/onCommunityDeleted.test.ts +8 -1
- package/src/community/events/test/onCommunityUserRoleAdded.test.ts +50 -0
- package/src/community/events/test/onCommunityUserRoleRemoved.test.ts +50 -0
- package/src/community/events/utils.ts +4 -8
- package/src/community/observers/index.ts +4 -0
- package/src/community/observers/liveCommunity.ts +45 -0
- package/src/community/observers/liveCommunityMembers.ts +187 -0
- package/src/community/observers/tests/liveCommunities.test.ts +38 -18
- package/src/community/observers/tests/liveCommunity.test.ts +147 -0
- package/src/community/observers/tests/liveCommunityMembers.test.ts +195 -0
- package/src/community/utils/payload.ts +28 -22
- package/src/core/device.ts +2 -4
- package/src/core/model/idResolvers.ts +4 -3
- package/src/core/model/identifyModel.ts +3 -3
- package/src/core/model/index.ts +1 -0
- package/src/core/query/query.ts +7 -0
- package/src/core/tests/query/query/runQuery.test.ts +8 -3
- package/src/core/tests/subscription.test.ts +80 -2
- package/src/external/api/tests/createUserToken.test.ts +29 -0
- package/src/feed/api/queryGlobalFeed.ts +8 -4
- package/src/group/utils/test/withUsers.test.ts +5 -5
- package/src/group/utils/withUser.ts +20 -14
- package/src/message/api/createMessage.ts +10 -9
- package/src/message/api/getMessage.ts +2 -2
- package/src/message/api/getMessages.ts +1 -1
- package/src/message/api/queryMessages.ts +2 -2
- package/src/message/api/tests/createMessage.test.ts +5 -1
- package/src/message/api/updateMessage.ts +1 -1
- package/src/message/events/onMessageCreated.ts +1 -1
- package/src/message/events/onMessageDeleted.ts +1 -1
- package/src/message/events/onMessageFetched.ts +1 -1
- package/src/message/events/onMessageFlagCleared.ts +1 -1
- package/src/message/events/onMessageFlagged.ts +1 -1
- package/src/message/events/onMessageReactionAdded.ts +1 -1
- package/src/message/events/onMessageReactionRemoved.ts +1 -1
- package/src/message/events/onMessageUnflagged.ts +1 -1
- package/src/message/events/onMessageUpdated.ts +1 -1
- package/src/message/tests/events.test.ts +10 -2
- package/src/message/tests/observers/liveMessage.test.ts +6 -1
- package/src/message/tests/observers/liveMessages.test.ts +16 -3
- package/src/message/utils/index.ts +5 -3
- package/src/poll/api/tests/closePoll.test.ts +50 -0
- package/src/poll/api/tests/createPoll.test.ts +70 -0
- package/src/poll/api/tests/getPoll.test.ts +31 -0
- package/src/poll/api/tests/votePoll.test.ts +41 -0
- package/src/poll/events/onPollDeleted.ts +1 -1
- package/src/poll/events/onPollUpdated.ts +1 -1
- package/src/post/api/approvePost.ts +10 -10
- package/src/post/api/createPost.ts +6 -3
- package/src/post/api/declinePost.ts +11 -11
- package/src/post/api/deletePost.ts +19 -2
- package/src/post/api/getPost.ts +5 -2
- package/src/post/api/getPosts.ts +4 -1
- package/src/post/api/queryPosts.ts +3 -1
- package/src/post/api/tests/queryPosts.test.ts +5 -4
- package/src/post/api/updatePost.ts +4 -1
- package/src/post/events/onPostReactionAdded.ts +1 -1
- package/src/post/events/onPostReactionRemoved.ts +1 -1
- package/src/post/events/utils.ts +12 -2
- package/src/post/observers/tests/livePost.test.ts +10 -3
- package/src/post/observers/tests/livePosts.test.ts +12 -4
- package/src/post/tests/api/getPost.test.ts +13 -3
- package/src/post/tests/api/queryPosts.test.ts +5 -4
- package/src/reaction/api/addReaction.ts +3 -3
- package/src/reaction/api/queryReactions.ts +2 -0
- package/src/reaction/api/removeReaction.ts +4 -3
- package/src/reaction/events/onReactionAdded.ts +3 -3
- package/src/reaction/events/onReactionRemoved.ts +3 -3
- package/src/reaction/events/onReactorAdded.ts +8 -2
- package/src/reaction/events/onReactorRemoved.ts +8 -2
- package/src/reaction/utils/dispatchReactable.ts +1 -1
- package/src/reaction/utils/fetchReference.ts +1 -1
- package/src/report/api/createReport.ts +14 -8
- package/src/report/api/deleteReport.ts +14 -8
- package/src/subChannel/api/createSubChannel.ts +1 -1
- package/src/subChannel/api/getSubChannel.ts +1 -1
- package/src/subChannel/api/getSubChannels.ts +1 -1
- package/src/subChannel/api/querySubChannels.ts +2 -2
- package/src/subChannel/api/updateSubChannel.ts +1 -1
- package/src/subChannel/events/onSubChannelCreated.ts +1 -1
- package/src/subChannel/events/onSubChannelDeleted.ts +1 -1
- package/src/subChannel/events/onSubChannelUpdated.ts +1 -1
- package/src/subChannel/utils/index.ts +2 -2
- package/src/user/observers/tests/liveUsers.test.ts +2 -0
- package/src/user/tests/api/getUser.test.ts +17 -3
- package/src/utils/index.ts +2 -2
- package/src/utils/liveObject.ts +1 -1
- package/src/utils/tests/dummy/channel.ts +18 -11
- package/src/utils/tests/dummy/community.ts +68 -6
- package/src/utils/tests/dummy/feed.ts +1 -1
- package/src/utils/tests/dummy/member.ts +1 -1
- package/src/utils/tests/dummy/post.ts +93 -9
- package/src/version.ts +9 -3
package/dist/index.cjs.js
CHANGED
|
@@ -93,16 +93,16 @@ const PostContentType = Object.freeze({
|
|
|
93
93
|
POLL: 'poll',
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const VERSION
|
|
96
|
+
function getVersion() {
|
|
97
|
+
try {
|
|
98
|
+
// the string ''v0.0.1-beta.40-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
99
|
+
return 'v0.0.1-beta.40-cjs';
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
return '__dev__';
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const VERSION = getVersion();
|
|
106
106
|
|
|
107
107
|
// cache constants
|
|
108
108
|
const CACHE_KEY_GET = 'get';
|
|
@@ -440,6 +440,8 @@ const queryOptions = (policy, lifeSpan = CACHE_LIFESPAN) => {
|
|
|
440
440
|
* @category Query
|
|
441
441
|
*/
|
|
442
442
|
const runQuery = ({ func, args }, callback, options = queryOptions('cache_then_server')) => {
|
|
443
|
+
console.warn('Deprecation Notice: After 1 April 2023, CreateQuery/RunQuery will no longer be supported. You will be able to use the API without either methods. Check https://docs.amity.co/ for details');
|
|
444
|
+
console.warn('Deprecation Notice: After 1 March 2023, individual module imoprts will no longer be supported. All public APIs will need to be imported from their respective repositories. Ex: CommunityRepository, UserRepository, etc. Check https://docs.amity.co/ for detailed info.');
|
|
443
445
|
let local;
|
|
444
446
|
const { lifeSpan } = queryOptions('cache_then_server', options.lifeSpan);
|
|
445
447
|
// offline first
|
|
@@ -559,7 +561,7 @@ const hasKeys = (object, needles) => {
|
|
|
559
561
|
/**
|
|
560
562
|
* Finds the name of the store for a given unknown model
|
|
561
563
|
*
|
|
562
|
-
* @param model one of the {@link Amity.
|
|
564
|
+
* @param model one of the {@link Amity.Models} to identify
|
|
563
565
|
* @returns the name of the corresponding store
|
|
564
566
|
*/
|
|
565
567
|
const identifyModel = (model) => {
|
|
@@ -1374,6 +1376,14 @@ function subscribeTopic(topic, callback) {
|
|
|
1374
1376
|
return mqtt.subscribe(topic, callback);
|
|
1375
1377
|
}
|
|
1376
1378
|
|
|
1379
|
+
var _a;
|
|
1380
|
+
/* eslint-disable no-undef */
|
|
1381
|
+
const theGlobal =
|
|
1382
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1383
|
+
typeof globalThis === 'object' ? globalThis : typeof global === 'object' ? global : window;
|
|
1384
|
+
const { process: safeProcess = {} } = theGlobal;
|
|
1385
|
+
const isProduction = ((_a = safeProcess.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'production';
|
|
1386
|
+
|
|
1377
1387
|
/**
|
|
1378
1388
|
* Creates a pre-configured logger instance
|
|
1379
1389
|
*
|
|
@@ -20368,8 +20378,6 @@ const ACCESS_TOKEN_WATCHER_INTERVAL = 10 * MINUTE;
|
|
|
20368
20378
|
|
|
20369
20379
|
// TODO: find a way to uniquely identify the device
|
|
20370
20380
|
/** @hidden */
|
|
20371
|
-
const VERSION = '11.0.0';
|
|
20372
|
-
/** @hidden */
|
|
20373
20381
|
const getDeviceId = () => {
|
|
20374
20382
|
// here maybe put some auto detection of the device id based on if it's react or not?
|
|
20375
20383
|
// anyhow we let consumer branch out if they want, but it doesn't mean we shouldn't try to be nice
|
|
@@ -20391,10 +20399,10 @@ const getDeviceModel = () => {
|
|
|
20391
20399
|
const getDeviceInfo = () => {
|
|
20392
20400
|
const model = getDeviceModel();
|
|
20393
20401
|
return {
|
|
20394
|
-
version: VERSION,
|
|
20395
20402
|
// TODO: replace with: kind: process.versions ? 'node' : 'web', when backend has fixed this
|
|
20396
20403
|
kind: 'web',
|
|
20397
20404
|
model,
|
|
20405
|
+
sdkVersion: VERSION,
|
|
20398
20406
|
};
|
|
20399
20407
|
};
|
|
20400
20408
|
|
|
@@ -20571,9 +20579,10 @@ const ingestInCache = (payload = {}, options) => {
|
|
|
20571
20579
|
if (!type)
|
|
20572
20580
|
return;
|
|
20573
20581
|
const resolver = getResolver(type);
|
|
20582
|
+
if (!resolver)
|
|
20583
|
+
return;
|
|
20574
20584
|
models.forEach(model => {
|
|
20575
|
-
upsertInCache([type, 'get', resolver(model)],
|
|
20576
|
-
model, options);
|
|
20585
|
+
upsertInCache([type, 'get', resolver(model)], model, options);
|
|
20577
20586
|
});
|
|
20578
20587
|
});
|
|
20579
20588
|
};
|
|
@@ -21008,7 +21017,7 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
21008
21017
|
const sessionState = "notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */;
|
|
21009
21018
|
const sessionHandler = undefined;
|
|
21010
21019
|
const client = {
|
|
21011
|
-
version: `${VERSION
|
|
21020
|
+
version: `${VERSION}`,
|
|
21012
21021
|
apiKey,
|
|
21013
21022
|
log,
|
|
21014
21023
|
http,
|
|
@@ -22384,15 +22393,14 @@ const createMessage = async (bundle) => {
|
|
|
22384
22393
|
client.log('message/createMessage', bundle);
|
|
22385
22394
|
const referenceId = uniqueId;
|
|
22386
22395
|
uniqueId = undefined;
|
|
22387
|
-
const { data } = await client.http
|
|
22388
|
-
|
|
22389
|
-
|
|
22396
|
+
const { data: payload } = await client.http.post('/api/v5/messages', Object.assign(Object.assign({}, convertParams(bundle)), { referenceId }));
|
|
22397
|
+
const data = prepareMessagePayload(payload);
|
|
22398
|
+
const { messages } = data;
|
|
22390
22399
|
const cachedAt = client.cache && Date.now();
|
|
22391
22400
|
if (client.cache) {
|
|
22392
22401
|
dropFromCache(['message', 'get', referenceId]);
|
|
22393
22402
|
ingestInCache(data, { cachedAt });
|
|
22394
22403
|
}
|
|
22395
|
-
const { messages } = data;
|
|
22396
22404
|
fireEvent('local.message.created', { messages });
|
|
22397
22405
|
return {
|
|
22398
22406
|
data: messages[0],
|
|
@@ -22573,6 +22581,66 @@ deleteMessage.optimistically = (messageId) => {
|
|
|
22573
22581
|
};
|
|
22574
22582
|
};
|
|
22575
22583
|
|
|
22584
|
+
/**
|
|
22585
|
+
* Attach user object to membership model
|
|
22586
|
+
* - If cache is not enabled, set user to undefined ({..., user: undefined})
|
|
22587
|
+
* - If user object is not found in cache, set user to undefined
|
|
22588
|
+
* ({..., user: undefined})
|
|
22589
|
+
* - If a user is found in the cache, it attaches the user from the cache
|
|
22590
|
+
* ({..., user: { userId, displayName,... }})
|
|
22591
|
+
*
|
|
22592
|
+
* @param member The membership model object
|
|
22593
|
+
* @param userIdProp The user ID prop name of membership object
|
|
22594
|
+
* @param userProp The user prop name of destination object
|
|
22595
|
+
* @returns The membership model object that is already mapped to user
|
|
22596
|
+
* @hidden
|
|
22597
|
+
*/
|
|
22598
|
+
const withUser = (member, userIdProp = 'userId', userProp = 'user') => {
|
|
22599
|
+
// If the user prop already exists, do not overwrite.
|
|
22600
|
+
if (member[userProp])
|
|
22601
|
+
return member;
|
|
22602
|
+
return Object.assign({ get [userProp]() {
|
|
22603
|
+
var _a;
|
|
22604
|
+
const client = getActiveClient();
|
|
22605
|
+
if (!client.cache)
|
|
22606
|
+
return undefined;
|
|
22607
|
+
const userCache = (_a = pullFromCache(['user', 'get', member[userIdProp]])) === null || _a === void 0 ? void 0 : _a.data;
|
|
22608
|
+
if (!userCache) {
|
|
22609
|
+
return undefined;
|
|
22610
|
+
}
|
|
22611
|
+
return userCache;
|
|
22612
|
+
} }, member);
|
|
22613
|
+
};
|
|
22614
|
+
/**
|
|
22615
|
+
* Mapping membership model with user object
|
|
22616
|
+
*
|
|
22617
|
+
* @param members The membership model objects
|
|
22618
|
+
* @param userIdProp The user ID prop name of membership object
|
|
22619
|
+
* @param userProp The user prop name of destination object
|
|
22620
|
+
* @returns The membership model objects that is already
|
|
22621
|
+
* mapped to users
|
|
22622
|
+
* @hidden
|
|
22623
|
+
*/
|
|
22624
|
+
const withUsers = (members, userIdProp = 'userId', userProp = 'user') => {
|
|
22625
|
+
var _a;
|
|
22626
|
+
return (_a = members === null || members === void 0 ? void 0 : members.map(member => withUser(member, userIdProp, userProp))) !== null && _a !== void 0 ? _a : members;
|
|
22627
|
+
};
|
|
22628
|
+
/**
|
|
22629
|
+
* Transform members prop in any payload with attached users members
|
|
22630
|
+
*
|
|
22631
|
+
* @param payload The payload contain members prop
|
|
22632
|
+
* @param memberProp A name of members prop
|
|
22633
|
+
* @param userIdProp The user ID prop name of membership object
|
|
22634
|
+
* @param userProp The user prop name of destination object
|
|
22635
|
+
* @returns The transforming payload
|
|
22636
|
+
* @hidden
|
|
22637
|
+
*/
|
|
22638
|
+
const prepareMembershipPayload = (payload, memberProp, userIdProp = 'userId', userProp = 'user') => {
|
|
22639
|
+
const _a = payload, _b = memberProp, memberPayload = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
22640
|
+
const members = withUsers(memberPayload, userIdProp, userProp);
|
|
22641
|
+
return Object.assign(Object.assign({}, rest), { [memberProp]: members });
|
|
22642
|
+
};
|
|
22643
|
+
|
|
22576
22644
|
/**
|
|
22577
22645
|
* ```js
|
|
22578
22646
|
* import { queryPosts } from '@amityco/ts-sdk'
|
|
@@ -22612,10 +22680,11 @@ const queryPosts = async (query) => {
|
|
|
22612
22680
|
// const { paging, posts } = unwrapPayload(data)
|
|
22613
22681
|
// unpacking
|
|
22614
22682
|
const { paging } = data, payload = __rest(data, ["paging"]);
|
|
22683
|
+
const paperedPayload = prepareMembershipPayload(payload, 'communityUsers');
|
|
22615
22684
|
const { posts } = payload;
|
|
22616
22685
|
const cachedAt = client.cache && Date.now();
|
|
22617
22686
|
if (client.cache) {
|
|
22618
|
-
ingestInCache(
|
|
22687
|
+
ingestInCache(paperedPayload, { cachedAt });
|
|
22619
22688
|
const cacheKey = ['post', 'query', Object.assign(Object.assign({}, params), { options: Object.assign({}, page) })];
|
|
22620
22689
|
pushToCache(cacheKey, { posts: posts.map(getResolver('post')), paging });
|
|
22621
22690
|
}
|
|
@@ -22677,9 +22746,10 @@ const getPosts = async (postIds) => {
|
|
|
22677
22746
|
client.log('post/getPosts', postIds);
|
|
22678
22747
|
const encodedPostIds = postIds.map(postId => encodeURIComponent(postId));
|
|
22679
22748
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
22680
|
-
const { data } = await client.http.get(`/api/v3/posts/list`, {
|
|
22749
|
+
const { data: payload } = await client.http.get(`/api/v3/posts/list`, {
|
|
22681
22750
|
params: { postIds: encodedPostIds },
|
|
22682
22751
|
});
|
|
22752
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
22683
22753
|
const cachedAt = client.cache && Date.now();
|
|
22684
22754
|
if (client.cache)
|
|
22685
22755
|
ingestInCache(data, { cachedAt });
|
|
@@ -22738,11 +22808,11 @@ const getPost = async (postId) => {
|
|
|
22738
22808
|
const client = getActiveClient();
|
|
22739
22809
|
client.log('post/getPost', postId);
|
|
22740
22810
|
isInTombstone('post', postId);
|
|
22741
|
-
let
|
|
22811
|
+
let payload;
|
|
22742
22812
|
try {
|
|
22743
22813
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
22744
22814
|
const response = await client.http.get(`/api/v3/posts/${encodeURIComponent(postId)}`);
|
|
22745
|
-
|
|
22815
|
+
payload = response.data;
|
|
22746
22816
|
}
|
|
22747
22817
|
catch (error) {
|
|
22748
22818
|
if (checkIfShouldGoesToTombstone(error === null || error === void 0 ? void 0 : error.code)) {
|
|
@@ -22750,6 +22820,7 @@ const getPost = async (postId) => {
|
|
|
22750
22820
|
}
|
|
22751
22821
|
throw error;
|
|
22752
22822
|
}
|
|
22823
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
22753
22824
|
const cachedAt = client.cache && Date.now();
|
|
22754
22825
|
if (client.cache)
|
|
22755
22826
|
ingestInCache(data, { cachedAt });
|
|
@@ -22812,11 +22883,12 @@ const createPost = async (bundle) => {
|
|
|
22812
22883
|
// eslint-disable-next-line no-param-reassign
|
|
22813
22884
|
delete bundle.dataType;
|
|
22814
22885
|
}
|
|
22815
|
-
const { data } = await client.http.post('/api/v4/posts', bundle);
|
|
22886
|
+
const { data: payload } = await client.http.post('/api/v4/posts', bundle);
|
|
22887
|
+
fireEvent('post.created', payload);
|
|
22888
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
22816
22889
|
const cachedAt = client.cache && Date.now();
|
|
22817
22890
|
if (client.cache)
|
|
22818
22891
|
ingestInCache(data, { cachedAt });
|
|
22819
|
-
fireEvent('post.created', data);
|
|
22820
22892
|
const { posts } = data;
|
|
22821
22893
|
return {
|
|
22822
22894
|
data: posts[0],
|
|
@@ -22844,7 +22916,8 @@ const createPost = async (bundle) => {
|
|
|
22844
22916
|
const updatePost = async (postId, patch) => {
|
|
22845
22917
|
const client = getActiveClient();
|
|
22846
22918
|
client.log('user/updatePost', patch);
|
|
22847
|
-
const { data } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, patch);
|
|
22919
|
+
const { data: payload } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, patch);
|
|
22920
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
22848
22921
|
const cachedAt = client.cache && Date.now();
|
|
22849
22922
|
if (client.cache)
|
|
22850
22923
|
ingestInCache(data, { cachedAt });
|
|
@@ -22862,25 +22935,22 @@ const getMatchPostSetting = (value) => {
|
|
|
22862
22935
|
CommunityPostSettingMaps[key].needApprovalOnPostCreation &&
|
|
22863
22936
|
value.onlyAdminCanPost === CommunityPostSettingMaps[key].onlyAdminCanPost)) !== null && _a !== void 0 ? _a : DefaultCommunityPostSetting;
|
|
22864
22937
|
};
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
|
|
22868
|
-
|
|
22869
|
-
|
|
22870
|
-
|
|
22871
|
-
|
|
22872
|
-
|
|
22873
|
-
|
|
22874
|
-
|
|
22875
|
-
|
|
22876
|
-
|
|
22938
|
+
const prepareCommunityPayload = (rawPayload) => {
|
|
22939
|
+
// Unpack community payload by mapping payload field to postSetting value.
|
|
22940
|
+
const communities = rawPayload.communities.map((_a) => {
|
|
22941
|
+
var { needApprovalOnPostCreation, onlyAdminCanPost } = _a, restCommunityPayload = __rest(_a, ["needApprovalOnPostCreation", "onlyAdminCanPost"]);
|
|
22942
|
+
return (Object.assign({ postSetting: getMatchPostSetting({
|
|
22943
|
+
needApprovalOnPostCreation,
|
|
22944
|
+
onlyAdminCanPost,
|
|
22945
|
+
}) }, restCommunityPayload));
|
|
22946
|
+
});
|
|
22947
|
+
const communityUsers = withUsers(rawPayload.communityUsers);
|
|
22948
|
+
return Object.assign(Object.assign({}, rawPayload), { communities,
|
|
22949
|
+
communityUsers });
|
|
22877
22950
|
};
|
|
22878
|
-
|
|
22879
|
-
|
|
22880
|
-
|
|
22881
|
-
const packCommunityPayload = (_a) => {
|
|
22882
|
-
var { postSetting = undefined } = _a, restParam = __rest(_a, ["postSetting"]);
|
|
22883
|
-
return (Object.assign(Object.assign({}, restParam), (postSetting ? CommunityPostSettingMaps[postSetting] : undefined)));
|
|
22951
|
+
const prepareCommunityRequest = (params) => {
|
|
22952
|
+
const { postSetting = undefined } = params, restParam = __rest(params, ["postSetting"]);
|
|
22953
|
+
return Object.assign(Object.assign({}, restParam), (postSetting ? CommunityPostSettingMaps[postSetting] : undefined));
|
|
22884
22954
|
};
|
|
22885
22955
|
|
|
22886
22956
|
/**
|
|
@@ -22913,7 +22983,7 @@ const queryCommunities = async (query) => {
|
|
|
22913
22983
|
} }),
|
|
22914
22984
|
});
|
|
22915
22985
|
const { paging } = data, payload = __rest(data, ["paging"]);
|
|
22916
|
-
const unpackedPayload =
|
|
22986
|
+
const unpackedPayload = prepareCommunityPayload(payload);
|
|
22917
22987
|
const { communities } = unpackedPayload;
|
|
22918
22988
|
const cachedAt = client.cache && Date.now();
|
|
22919
22989
|
if (client.cache) {
|
|
@@ -22969,7 +23039,7 @@ const getCommunities = async (communityIds) => {
|
|
|
22969
23039
|
const { data: payload } = await client.http.get(`/api/v3/communities/list`, {
|
|
22970
23040
|
params: { communityIds },
|
|
22971
23041
|
});
|
|
22972
|
-
const data =
|
|
23042
|
+
const data = prepareCommunityPayload(payload);
|
|
22973
23043
|
const cachedAt = client.cache && Date.now();
|
|
22974
23044
|
if (client.cache)
|
|
22975
23045
|
ingestInCache(data, { cachedAt });
|
|
@@ -23029,7 +23099,7 @@ const getCommunity = async (communityId) => {
|
|
|
23029
23099
|
client.log('community/getCommunity', communityId);
|
|
23030
23100
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
23031
23101
|
const { data: payload } = await client.http.get(`/api/v3/communities/${communityId}`);
|
|
23032
|
-
const data =
|
|
23102
|
+
const data = prepareCommunityPayload(payload);
|
|
23033
23103
|
const cachedAt = client.cache && Date.now();
|
|
23034
23104
|
if (client.cache)
|
|
23035
23105
|
ingestInCache(data, { cachedAt });
|
|
@@ -23083,12 +23153,12 @@ getCommunity.locally = (communityId) => {
|
|
|
23083
23153
|
const createCommunity = async (bundle) => {
|
|
23084
23154
|
const client = getActiveClient();
|
|
23085
23155
|
client.log('user/createCommunity', bundle);
|
|
23086
|
-
const { data: payload } = await client.http.post('/api/v3/communities/',
|
|
23087
|
-
|
|
23156
|
+
const { data: payload } = await client.http.post('/api/v3/communities/', prepareCommunityRequest(bundle));
|
|
23157
|
+
fireEvent('community.created', payload);
|
|
23158
|
+
const data = prepareCommunityPayload(payload);
|
|
23088
23159
|
const cachedAt = client.cache && Date.now();
|
|
23089
23160
|
if (client.cache)
|
|
23090
23161
|
ingestInCache(data, { cachedAt });
|
|
23091
|
-
fireEvent('community.created', data);
|
|
23092
23162
|
const { communities } = data;
|
|
23093
23163
|
return {
|
|
23094
23164
|
data: communities[0],
|
|
@@ -23114,12 +23184,12 @@ const createCommunity = async (bundle) => {
|
|
|
23114
23184
|
const updateCommunity = async (communityId, patch) => {
|
|
23115
23185
|
const client = getActiveClient();
|
|
23116
23186
|
client.log('community/updateCommunity', communityId, patch);
|
|
23117
|
-
const { data: payload } = await client.http.put(`/api/v3/communities/${communityId}`,
|
|
23118
|
-
|
|
23187
|
+
const { data: payload } = await client.http.put(`/api/v3/communities/${communityId}`, prepareCommunityRequest(patch));
|
|
23188
|
+
fireEvent('community.updated', payload);
|
|
23189
|
+
const data = prepareCommunityPayload(payload);
|
|
23119
23190
|
const cachedAt = client.cache && Date.now();
|
|
23120
23191
|
if (client.cache)
|
|
23121
23192
|
ingestInCache(data, { cachedAt });
|
|
23122
|
-
fireEvent('community.updated', data);
|
|
23123
23193
|
const { communities } = data;
|
|
23124
23194
|
return {
|
|
23125
23195
|
data: communities.find(community => community.communityId === communityId),
|
|
@@ -23147,7 +23217,14 @@ const deleteCommunity = async (communityId) => {
|
|
|
23147
23217
|
// API-FIX: This endpoint has not been implemented yet.
|
|
23148
23218
|
await client.http.delete(`/api/v3/communities/${communityId}`);
|
|
23149
23219
|
const deleted = await getCommunity(communityId);
|
|
23150
|
-
fireEvent('community.deleted', {
|
|
23220
|
+
fireEvent('community.deleted', {
|
|
23221
|
+
communities: [deleted.data],
|
|
23222
|
+
categories: [],
|
|
23223
|
+
communityUsers: [],
|
|
23224
|
+
feeds: [],
|
|
23225
|
+
files: [],
|
|
23226
|
+
users: [],
|
|
23227
|
+
});
|
|
23151
23228
|
return deleted.data;
|
|
23152
23229
|
};
|
|
23153
23230
|
|
|
@@ -23168,11 +23245,12 @@ const deleteCommunity = async (communityId) => {
|
|
|
23168
23245
|
const joinCommunity = async (communityId) => {
|
|
23169
23246
|
const client = getActiveClient();
|
|
23170
23247
|
client.log('community/joinCommunity', communityId);
|
|
23171
|
-
const { data } = await client.http.post(`/api/v3/communities/${communityId}/join`);
|
|
23248
|
+
const { data: payload } = await client.http.post(`/api/v3/communities/${communityId}/join`);
|
|
23249
|
+
fireEvent('community.joined', payload);
|
|
23250
|
+
const data = prepareCommunityPayload(payload);
|
|
23172
23251
|
const cachedAt = client.cache && Date.now();
|
|
23173
23252
|
if (client.cache)
|
|
23174
23253
|
ingestInCache(data, { cachedAt });
|
|
23175
|
-
fireEvent('community.joined', data);
|
|
23176
23254
|
const { communityUsers } = data;
|
|
23177
23255
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23178
23256
|
};
|
|
@@ -23194,67 +23272,16 @@ const joinCommunity = async (communityId) => {
|
|
|
23194
23272
|
const leaveCommunity = async (communityId) => {
|
|
23195
23273
|
const client = getActiveClient();
|
|
23196
23274
|
client.log('community/leaveCommunity', communityId);
|
|
23197
|
-
const { data } = await client.http.delete(`/api/v3/communities/${communityId}/leave`);
|
|
23275
|
+
const { data: payload } = await client.http.delete(`/api/v3/communities/${communityId}/leave`);
|
|
23276
|
+
fireEvent('community.left', payload);
|
|
23277
|
+
const data = prepareCommunityPayload(payload);
|
|
23198
23278
|
const cachedAt = client.cache && Date.now();
|
|
23199
23279
|
if (client.cache)
|
|
23200
23280
|
ingestInCache(data, { cachedAt });
|
|
23201
|
-
fireEvent('community.left', data);
|
|
23202
23281
|
const { communityUsers } = data;
|
|
23203
23282
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23204
23283
|
};
|
|
23205
23284
|
|
|
23206
|
-
/**
|
|
23207
|
-
* Attach user object to membership model
|
|
23208
|
-
* - If cache is not enabled, set user to undefined ({..., user: undefined})
|
|
23209
|
-
* - If user object is not found in cache, set user to undefined
|
|
23210
|
-
* ({..., user: undefined})
|
|
23211
|
-
* - If a user is found in the cache, it attaches the user from the cache
|
|
23212
|
-
* ({..., user: { userId, displayName,... }})
|
|
23213
|
-
*
|
|
23214
|
-
* @param member The membership model object
|
|
23215
|
-
* @param userIdProp The user ID prop name of membership object
|
|
23216
|
-
* @param userProp The user prop name of destination object
|
|
23217
|
-
* @returns The membership model object that is already mapped to user
|
|
23218
|
-
* @hidden
|
|
23219
|
-
*/
|
|
23220
|
-
const withUser = (member, userIdProp = 'userId', userProp = 'user') => (Object.assign({ get [userProp]() {
|
|
23221
|
-
var _a;
|
|
23222
|
-
const client = getActiveClient();
|
|
23223
|
-
if (!client.cache)
|
|
23224
|
-
return undefined;
|
|
23225
|
-
const userCache = (_a = pullFromCache(['user', 'get', member[userIdProp]])) === null || _a === void 0 ? void 0 : _a.data;
|
|
23226
|
-
if (!userCache) {
|
|
23227
|
-
return undefined;
|
|
23228
|
-
}
|
|
23229
|
-
return userCache;
|
|
23230
|
-
} }, member));
|
|
23231
|
-
/**
|
|
23232
|
-
* Mapping membership model with user object
|
|
23233
|
-
*
|
|
23234
|
-
* @param members The membership model objects
|
|
23235
|
-
* @param userIdProp The user ID prop name of membership object
|
|
23236
|
-
* @param userProp The user prop name of destination object
|
|
23237
|
-
* @returns The membership model objects that is already
|
|
23238
|
-
* mapped to users
|
|
23239
|
-
* @hidden
|
|
23240
|
-
*/
|
|
23241
|
-
const withUsers = (members, userIdProp = 'userId', userProp = 'user') => members.map(member => withUser(member, userIdProp, userProp));
|
|
23242
|
-
/**
|
|
23243
|
-
* Transform members prop in any payload with attached users members
|
|
23244
|
-
*
|
|
23245
|
-
* @param payload The payload contain members prop
|
|
23246
|
-
* @param memberProp A name of members prop
|
|
23247
|
-
* @param userIdProp The user ID prop name of membership object
|
|
23248
|
-
* @param userProp The user prop name of destination object
|
|
23249
|
-
* @returns The transforming payload
|
|
23250
|
-
* @hidden
|
|
23251
|
-
*/
|
|
23252
|
-
const prepareMembershipPayload = (payload, memberProp, userIdProp = 'userId', userProp = 'user') => {
|
|
23253
|
-
const _a = payload, _b = memberProp, memberPayload = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
23254
|
-
const members = withUsers(memberPayload, userIdProp, userProp);
|
|
23255
|
-
return Object.assign(Object.assign({}, rest), { [memberProp]: members });
|
|
23256
|
-
};
|
|
23257
|
-
|
|
23258
23285
|
/**
|
|
23259
23286
|
* ```js
|
|
23260
23287
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23355,10 +23382,11 @@ queryCommunityMembers.locally = (query) => {
|
|
|
23355
23382
|
const addCommunityMembers = async (communityId, userIds) => {
|
|
23356
23383
|
const client = getActiveClient();
|
|
23357
23384
|
client.log('community/addCommunityMembers', communityId, userIds);
|
|
23358
|
-
const { data } = await client.http.post(`/api/v3/communities/${communityId}/users`, { communityId, userIds });
|
|
23385
|
+
const { data: payload } = await client.http.post(`/api/v3/communities/${communityId}/users`, { communityId, userIds });
|
|
23386
|
+
fireEvent('community.userAdded', payload);
|
|
23387
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23359
23388
|
if (client.cache)
|
|
23360
23389
|
ingestInCache(data);
|
|
23361
|
-
fireEvent('community.userAdded', data);
|
|
23362
23390
|
const { communityUsers } = data;
|
|
23363
23391
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23364
23392
|
};
|
|
@@ -23381,10 +23409,11 @@ const addCommunityMembers = async (communityId, userIds) => {
|
|
|
23381
23409
|
const removeCommunityMembers = async (communityId, userIds) => {
|
|
23382
23410
|
const client = getActiveClient();
|
|
23383
23411
|
client.log('community/removeCommunityMembers', communityId, userIds);
|
|
23384
|
-
const { data } = await client.http.delete(`/api/v3/communities/${communityId}/users`, { data: { communityId, userIds } });
|
|
23412
|
+
const { data: payload } = await client.http.delete(`/api/v3/communities/${communityId}/users`, { data: { communityId, userIds } });
|
|
23413
|
+
fireEvent('community.userRemoved', payload);
|
|
23414
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23385
23415
|
if (client.cache)
|
|
23386
23416
|
ingestInCache(data);
|
|
23387
|
-
fireEvent('community.userRemoved', data);
|
|
23388
23417
|
const { communityUsers } = data;
|
|
23389
23418
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23390
23419
|
};
|
|
@@ -23399,7 +23428,7 @@ const removeCommunityMembers = async (communityId, userIds) => {
|
|
|
23399
23428
|
*
|
|
23400
23429
|
* @param communityId The ID of the {@link Amity.Community} to perform
|
|
23401
23430
|
* @param roleIds Array of IDs of the {@link Amity.Role} to apply
|
|
23402
|
-
* @param
|
|
23431
|
+
* @param userIds Array of IDs of the {@link Amity.User} to perform
|
|
23403
23432
|
* @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.User} in the {@link Amity.Community}
|
|
23404
23433
|
*
|
|
23405
23434
|
* @category Community API
|
|
@@ -23408,7 +23437,8 @@ const removeCommunityMembers = async (communityId, userIds) => {
|
|
|
23408
23437
|
const addCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
23409
23438
|
const client = getActiveClient();
|
|
23410
23439
|
client.log('community/addCommunityMembersRoles', communityId, roleIds, userIds);
|
|
23411
|
-
const { data } = await client.http.post(`/api/v4/communities/${communityId}/users/roles`, { communityId, roles: roleIds, userIds });
|
|
23440
|
+
const { data: payload } = await client.http.post(`/api/v4/communities/${communityId}/users/roles`, { communityId, roles: roleIds, userIds });
|
|
23441
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23412
23442
|
if (client.cache)
|
|
23413
23443
|
ingestInCache(data);
|
|
23414
23444
|
const { communityUsers } = data;
|
|
@@ -23426,7 +23456,7 @@ const addCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23426
23456
|
*
|
|
23427
23457
|
* @param communityId The ID of the {@link Amity.Community} to perform
|
|
23428
23458
|
* @param roleIds Array of IDs of the {@link Amity.Role} to apply
|
|
23429
|
-
* @param
|
|
23459
|
+
* @param userIds Array of IDs of the {@link Amity.User} to perform
|
|
23430
23460
|
* @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Community}
|
|
23431
23461
|
*
|
|
23432
23462
|
* @category Community API
|
|
@@ -23435,7 +23465,8 @@ const addCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23435
23465
|
const removeCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
23436
23466
|
const client = getActiveClient();
|
|
23437
23467
|
client.log('community/removeCommunityMembersRoles', communityId, roleIds, userIds);
|
|
23438
|
-
const { data } = await client.http.delete(`/api/v4/communities/${communityId}/users/roles`, { data: { communityId, roles: roleIds, userIds } });
|
|
23468
|
+
const { data: payload } = await client.http.delete(`/api/v4/communities/${communityId}/users/roles`, { data: { communityId, roles: roleIds, userIds } });
|
|
23469
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23439
23470
|
if (client.cache)
|
|
23440
23471
|
ingestInCache(data);
|
|
23441
23472
|
const { communityUsers } = data;
|
|
@@ -23464,7 +23495,7 @@ const getTopTrendingCommunities = async (query) => {
|
|
|
23464
23495
|
// API-FIX: backend doesnt answer Amity.Response
|
|
23465
23496
|
// const { data } = await client.http.get<Amity.Response<CommunityPayload>>(
|
|
23466
23497
|
const { data: payload } = await client.http.get(`/api/v3/communities/top-trending`, { params: { options: { limit } } });
|
|
23467
|
-
const data =
|
|
23498
|
+
const data = prepareCommunityPayload(payload);
|
|
23468
23499
|
const { communities } = data;
|
|
23469
23500
|
const cachedAt = client.cache && Date.now();
|
|
23470
23501
|
if (client.cache) {
|
|
@@ -23528,7 +23559,7 @@ const getRecommendedCommunities = async (query) => {
|
|
|
23528
23559
|
// API-FIX: backend doesnt answer Amity.Response
|
|
23529
23560
|
// const { data: payload } = await client.http.get<Amity.Response<CommunityPayload>>(
|
|
23530
23561
|
const { data: payload } = await client.http.get(`/api/v3/communities/recommended`, { params: { options: { limit } } });
|
|
23531
|
-
const data =
|
|
23562
|
+
const data = prepareCommunityPayload(payload);
|
|
23532
23563
|
const { communities } = data;
|
|
23533
23564
|
const cachedAt = client.cache && Date.now();
|
|
23534
23565
|
if (client.cache) {
|
|
@@ -23602,11 +23633,28 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
23602
23633
|
// later when realtime events covers that for us.
|
|
23603
23634
|
if (post.data.targetType === 'community') {
|
|
23604
23635
|
const community = await getCommunity(post.data.targetId);
|
|
23605
|
-
fireEvent('community.updated', {
|
|
23636
|
+
fireEvent('community.updated', {
|
|
23637
|
+
communities: [community.data],
|
|
23638
|
+
categories: [],
|
|
23639
|
+
communityUsers: [],
|
|
23640
|
+
feeds: [],
|
|
23641
|
+
files: [],
|
|
23642
|
+
users: [],
|
|
23643
|
+
});
|
|
23606
23644
|
}
|
|
23607
23645
|
// to support hard deletion
|
|
23608
23646
|
const deleted = Object.assign(Object.assign({}, post.data), { isDeleted: true });
|
|
23609
|
-
fireEvent('post.deleted', {
|
|
23647
|
+
fireEvent('post.deleted', {
|
|
23648
|
+
posts: [deleted],
|
|
23649
|
+
categories: [],
|
|
23650
|
+
comments: [],
|
|
23651
|
+
communities: [],
|
|
23652
|
+
communityUsers: [],
|
|
23653
|
+
feeds: [],
|
|
23654
|
+
files: [],
|
|
23655
|
+
postChildren: [],
|
|
23656
|
+
users: [],
|
|
23657
|
+
});
|
|
23610
23658
|
if (permanent) {
|
|
23611
23659
|
setTimeout(() => {
|
|
23612
23660
|
pushToTombstone('post', postId);
|
|
@@ -23634,22 +23682,20 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
23634
23682
|
* @async
|
|
23635
23683
|
*/
|
|
23636
23684
|
const approvePost = async (postId) => {
|
|
23637
|
-
var _a;
|
|
23638
23685
|
const client = getActiveClient();
|
|
23639
23686
|
client.log('post/approvePost', postId);
|
|
23640
|
-
const { data:
|
|
23641
|
-
|
|
23642
|
-
if (client.cache)
|
|
23643
|
-
ingestInCache(approved, { cachedAt });
|
|
23687
|
+
const { data: payload } = await client.http.post(`/api/v3/posts/${encodeURIComponent(postId)}/approve`);
|
|
23688
|
+
fireEvent('post.approved', payload);
|
|
23644
23689
|
// fire virtual event for community update
|
|
23645
|
-
if (
|
|
23646
|
-
|
|
23647
|
-
// @ts-ignore as communities is optional currently in PostPayload
|
|
23648
|
-
fireEvent('community.updated', { communities: [community] });
|
|
23690
|
+
if (payload.posts[0].targetType === 'community') {
|
|
23691
|
+
fireEvent('community.updated', payload);
|
|
23649
23692
|
}
|
|
23650
|
-
|
|
23693
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23694
|
+
const cachedAt = client.cache && Date.now();
|
|
23695
|
+
if (client.cache)
|
|
23696
|
+
ingestInCache(data, { cachedAt });
|
|
23651
23697
|
return {
|
|
23652
|
-
data:
|
|
23698
|
+
data: data.posts.find(post => post.postId === postId),
|
|
23653
23699
|
cachedAt,
|
|
23654
23700
|
};
|
|
23655
23701
|
};
|
|
@@ -23670,22 +23716,20 @@ const approvePost = async (postId) => {
|
|
|
23670
23716
|
* @async
|
|
23671
23717
|
*/
|
|
23672
23718
|
const declinePost = async (postId) => {
|
|
23673
|
-
var _a;
|
|
23674
23719
|
const client = getActiveClient();
|
|
23675
23720
|
client.log('post/declinePost', postId);
|
|
23676
|
-
const { data:
|
|
23677
|
-
const cachedAt = client.cache && Date.now();
|
|
23678
|
-
if (client.cache)
|
|
23679
|
-
ingestInCache(declined, { cachedAt });
|
|
23721
|
+
const { data: payload } = await client.http.post(`/api/v3/posts/${encodeURIComponent(postId)}/decline`);
|
|
23680
23722
|
// fire virtual event
|
|
23681
|
-
if (
|
|
23682
|
-
|
|
23683
|
-
// @ts-ignore as communities is optional currently in PostPayload
|
|
23684
|
-
fireEvent('community.updated', { communities: [community] });
|
|
23723
|
+
if (payload.posts[0].targetType === 'community') {
|
|
23724
|
+
fireEvent('community.updated', payload);
|
|
23685
23725
|
}
|
|
23686
|
-
fireEvent('post.declined',
|
|
23726
|
+
fireEvent('post.declined', payload);
|
|
23727
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23728
|
+
const cachedAt = client.cache && Date.now();
|
|
23729
|
+
if (client.cache)
|
|
23730
|
+
ingestInCache(data, { cachedAt });
|
|
23687
23731
|
return {
|
|
23688
|
-
data:
|
|
23732
|
+
data: payload.posts.find(post => post.postId === postId),
|
|
23689
23733
|
cachedAt,
|
|
23690
23734
|
};
|
|
23691
23735
|
};
|
|
@@ -23924,7 +23968,17 @@ const createComment = async (bundle) => {
|
|
|
23924
23968
|
if (client.cache)
|
|
23925
23969
|
ingestInCache(data, { cachedAt });
|
|
23926
23970
|
const post = await getPost(bundle.referenceId);
|
|
23927
|
-
fireEvent('post.updated', {
|
|
23971
|
+
fireEvent('post.updated', {
|
|
23972
|
+
posts: [post.data],
|
|
23973
|
+
categories: [],
|
|
23974
|
+
comments: [],
|
|
23975
|
+
communities: [],
|
|
23976
|
+
communityUsers: [],
|
|
23977
|
+
feeds: [],
|
|
23978
|
+
files: [],
|
|
23979
|
+
postChildren: [],
|
|
23980
|
+
users: [],
|
|
23981
|
+
});
|
|
23928
23982
|
fireEvent('comment.created', data);
|
|
23929
23983
|
const { comments } = data;
|
|
23930
23984
|
return {
|
|
@@ -23993,8 +24047,23 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
23993
24047
|
// to support hard deletion
|
|
23994
24048
|
const deleted = Object.assign(Object.assign({}, comment.data), { isDeleted: true });
|
|
23995
24049
|
const post = await getPost(comment.data.referenceId);
|
|
23996
|
-
fireEvent('post.updated', {
|
|
23997
|
-
|
|
24050
|
+
fireEvent('post.updated', {
|
|
24051
|
+
posts: [post.data],
|
|
24052
|
+
categories: [],
|
|
24053
|
+
comments: [],
|
|
24054
|
+
communities: [],
|
|
24055
|
+
communityUsers: [],
|
|
24056
|
+
feeds: [],
|
|
24057
|
+
files: [],
|
|
24058
|
+
postChildren: [],
|
|
24059
|
+
users: [],
|
|
24060
|
+
});
|
|
24061
|
+
fireEvent('comment.deleted', {
|
|
24062
|
+
comments: [deleted],
|
|
24063
|
+
commentChildren: [],
|
|
24064
|
+
files: [],
|
|
24065
|
+
users: [],
|
|
24066
|
+
});
|
|
23998
24067
|
if (permanent) {
|
|
23999
24068
|
scheduleTask(() => pushToTombstone('comment', commentId));
|
|
24000
24069
|
}
|
|
@@ -24232,6 +24301,8 @@ const queryReactions = async (query) => {
|
|
|
24232
24301
|
});
|
|
24233
24302
|
const { paging } = data, payload = __rest(data, ["paging"]);
|
|
24234
24303
|
const { reactions } = payload;
|
|
24304
|
+
// FIXME: correct reactions type in model
|
|
24305
|
+
// @ts-ignore
|
|
24235
24306
|
ingestInCache(Object.assign(Object.assign({}, payload), { reactions: reactions[0].reactors }));
|
|
24236
24307
|
const nextPage = toPageRaw(paging.next);
|
|
24237
24308
|
const prevPage = toPageRaw(paging.previous);
|
|
@@ -24247,9 +24318,17 @@ const createPostEventSubscriber = (event, callback) => {
|
|
|
24247
24318
|
}
|
|
24248
24319
|
else {
|
|
24249
24320
|
const { communities } = payload, others = __rest(payload, ["communities"]);
|
|
24250
|
-
|
|
24321
|
+
const data = prepareMembershipPayload(others, 'communityUsers');
|
|
24322
|
+
ingestInCache(data);
|
|
24251
24323
|
if ((communities === null || communities === void 0 ? void 0 : communities[0]) && !['post.updated'].includes(event)) {
|
|
24252
|
-
fireEvent('community.updated', {
|
|
24324
|
+
fireEvent('community.updated', {
|
|
24325
|
+
communities,
|
|
24326
|
+
categories: [],
|
|
24327
|
+
communityUsers: [],
|
|
24328
|
+
feeds: [],
|
|
24329
|
+
files: [],
|
|
24330
|
+
users: [],
|
|
24331
|
+
});
|
|
24253
24332
|
}
|
|
24254
24333
|
const post = pullFromCache(['post', 'get', payload.posts[0].postId]);
|
|
24255
24334
|
if (['post.created', 'post.approved', 'post.declined'].includes(event)) {
|
|
@@ -24766,6 +24845,8 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
24766
24845
|
if (eventName !== 'add')
|
|
24767
24846
|
return;
|
|
24768
24847
|
ingestInCache(payload);
|
|
24848
|
+
// FIXME: correct reactions type in model
|
|
24849
|
+
// @ts-ignore
|
|
24769
24850
|
ingestInCache({ reactions: [reactor] });
|
|
24770
24851
|
callbackWrapper('message', payload.messages[0].messageId, reactor);
|
|
24771
24852
|
};
|
|
@@ -24775,6 +24856,8 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
24775
24856
|
const filter = (payload) => {
|
|
24776
24857
|
const { reactor } = payload, rest = __rest(payload, ["reactor"]);
|
|
24777
24858
|
ingestInCache(rest);
|
|
24859
|
+
// FIXME: correct reactions type in model
|
|
24860
|
+
// @ts-ignore
|
|
24778
24861
|
ingestInCache({ reactions: [reactor] });
|
|
24779
24862
|
callbackWrapper('post', payload.posts[0].postId, reactor);
|
|
24780
24863
|
};
|
|
@@ -24783,6 +24866,8 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
24783
24866
|
const filter = (payload) => {
|
|
24784
24867
|
const { reactor } = payload, rest = __rest(payload, ["reactor"]);
|
|
24785
24868
|
ingestInCache(rest);
|
|
24869
|
+
// FIXME: correct reactions type in model
|
|
24870
|
+
// @ts-ignore
|
|
24786
24871
|
ingestInCache({ reactions: [reactor] });
|
|
24787
24872
|
callbackWrapper('comment', payload.comments[0].commentId, reactor);
|
|
24788
24873
|
};
|
|
@@ -24822,6 +24907,8 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
24822
24907
|
if (eventName !== 'remove')
|
|
24823
24908
|
return;
|
|
24824
24909
|
ingestInCache(payload);
|
|
24910
|
+
// FIXME: correct reactions type in model
|
|
24911
|
+
// @ts-ignore
|
|
24825
24912
|
ingestInCache({ reactions: [reactor] });
|
|
24826
24913
|
callbackWrapper('message', payload.messages[0].messageId, reactor);
|
|
24827
24914
|
};
|
|
@@ -24831,6 +24918,8 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
24831
24918
|
const filter = (payload) => {
|
|
24832
24919
|
const { reactor } = payload, rest = __rest(payload, ["reactor"]);
|
|
24833
24920
|
ingestInCache(rest);
|
|
24921
|
+
// FIXME: correct reactions type in model
|
|
24922
|
+
// @ts-ignore
|
|
24834
24923
|
ingestInCache({ reactions: [reactor] });
|
|
24835
24924
|
callbackWrapper('post', payload.posts[0].postId, reactor);
|
|
24836
24925
|
};
|
|
@@ -24839,6 +24928,8 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
24839
24928
|
const filter = (payload) => {
|
|
24840
24929
|
const { reactor } = payload, rest = __rest(payload, ["reactor"]);
|
|
24841
24930
|
ingestInCache(rest);
|
|
24931
|
+
// FIXME: correct reactions type in model
|
|
24932
|
+
// @ts-ignore
|
|
24842
24933
|
ingestInCache({ reactions: [reactor] });
|
|
24843
24934
|
callbackWrapper('comment', payload.comments[0].commentId, reactor);
|
|
24844
24935
|
};
|
|
@@ -24989,11 +25080,20 @@ const createReport = async (referenceType, referenceId) => {
|
|
|
24989
25080
|
const { domainName } = REFERENCE_TYPES[referenceType];
|
|
24990
25081
|
return `/api/v3/${domainName}/${encodeURIComponent(referenceId)}/flag`;
|
|
24991
25082
|
};
|
|
24992
|
-
const { data } = await client.http.post(getAPIUrl());
|
|
24993
|
-
if (client.cache)
|
|
24994
|
-
|
|
24995
|
-
|
|
24996
|
-
|
|
25083
|
+
const { data: payload } = await client.http.post(getAPIUrl());
|
|
25084
|
+
if (client.cache) {
|
|
25085
|
+
if (referenceType === 'message') {
|
|
25086
|
+
ingestInCache(prepareMessagePayload(payload));
|
|
25087
|
+
}
|
|
25088
|
+
else if (referenceType === 'post') {
|
|
25089
|
+
ingestInCache(prepareMembershipPayload(payload, 'communityUsers'));
|
|
25090
|
+
}
|
|
25091
|
+
else {
|
|
25092
|
+
ingestInCache(payload);
|
|
25093
|
+
}
|
|
25094
|
+
}
|
|
25095
|
+
fireEvent(`${referenceType}.flagged`, payload);
|
|
25096
|
+
return !!payload;
|
|
24997
25097
|
};
|
|
24998
25098
|
|
|
24999
25099
|
/**
|
|
@@ -25022,12 +25122,21 @@ const deleteReport = async (referenceType, referenceId) => {
|
|
|
25022
25122
|
const { domainName } = REFERENCE_TYPES[referenceType];
|
|
25023
25123
|
return `/api/v3/${domainName}/${encodeURIComponent(referenceId)}/unflag`;
|
|
25024
25124
|
};
|
|
25025
|
-
const { data } = await client.http.delete(getAPIUrl());
|
|
25026
|
-
if (client.cache)
|
|
25027
|
-
|
|
25125
|
+
const { data: payload } = await client.http.delete(getAPIUrl());
|
|
25126
|
+
if (client.cache) {
|
|
25127
|
+
if (referenceType === 'message') {
|
|
25128
|
+
ingestInCache(prepareMessagePayload(payload));
|
|
25129
|
+
}
|
|
25130
|
+
else if (referenceType === 'post') {
|
|
25131
|
+
ingestInCache(prepareMembershipPayload(payload, 'communityUsers'));
|
|
25132
|
+
}
|
|
25133
|
+
else {
|
|
25134
|
+
ingestInCache(payload);
|
|
25135
|
+
}
|
|
25136
|
+
}
|
|
25028
25137
|
// @ts-ignore
|
|
25029
|
-
fireEvent(`${referenceType}.unflagged`,
|
|
25030
|
-
return !!
|
|
25138
|
+
fireEvent(`${referenceType}.unflagged`, payload);
|
|
25139
|
+
return !!payload;
|
|
25031
25140
|
};
|
|
25032
25141
|
|
|
25033
25142
|
/**
|
|
@@ -25085,9 +25194,10 @@ function getSegmentParams(rawChannel) {
|
|
|
25085
25194
|
localLastMentionSegment: 0,
|
|
25086
25195
|
};
|
|
25087
25196
|
}
|
|
25088
|
-
const prepareChannelPayload = (
|
|
25089
|
-
const channels =
|
|
25090
|
-
|
|
25197
|
+
const prepareChannelPayload = (rawPayload) => {
|
|
25198
|
+
const channels = rawPayload.channels.map(channel => convertFromRaw$1(channel, getSegmentParams(channel)));
|
|
25199
|
+
const channelUsers = withUsers(rawPayload.channelUsers);
|
|
25200
|
+
return Object.assign(Object.assign({}, rawPayload), { channels, channelUsers });
|
|
25091
25201
|
};
|
|
25092
25202
|
|
|
25093
25203
|
/**
|
|
@@ -25459,8 +25569,7 @@ const queryChannelMembers = async (query) => {
|
|
|
25459
25569
|
} }),
|
|
25460
25570
|
});
|
|
25461
25571
|
const { paging } = queryPayload, payload = __rest(queryPayload, ["paging"]);
|
|
25462
|
-
const
|
|
25463
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
25572
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25464
25573
|
const { channelUsers } = preparedPayload;
|
|
25465
25574
|
const cachedAt = client.cache && Date.now();
|
|
25466
25575
|
if (client.cache) {
|
|
@@ -25543,13 +25652,13 @@ const addChannelMembers = async (channelId, userIds) => {
|
|
|
25543
25652
|
const client = getActiveClient();
|
|
25544
25653
|
client.log('channel/addChannelMembers', channelId, userIds);
|
|
25545
25654
|
const { data: payload } = await client.http.post(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, { channelId, userIds });
|
|
25546
|
-
const data = prepareChannelPayload(payload);
|
|
25547
|
-
if (client.cache)
|
|
25548
|
-
ingestInCache(data);
|
|
25549
25655
|
/*
|
|
25550
25656
|
* should fire event for each user that was added
|
|
25551
25657
|
*/
|
|
25552
|
-
userIds.forEach(id => fireEvent('channel.membersAdded', Object.assign(Object.assign({}, payload), { channelUsers:
|
|
25658
|
+
userIds.forEach(id => fireEvent('channel.membersAdded', Object.assign(Object.assign({}, payload), { channelUsers: payload.channelUsers.filter(u => u.userId === id) })));
|
|
25659
|
+
const data = prepareChannelPayload(payload);
|
|
25660
|
+
if (client.cache)
|
|
25661
|
+
ingestInCache(data);
|
|
25553
25662
|
const { channelUsers } = data;
|
|
25554
25663
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership === 'member');
|
|
25555
25664
|
};
|
|
@@ -25573,13 +25682,13 @@ const removeChannelMembers = async (channelId, userIds) => {
|
|
|
25573
25682
|
const client = getActiveClient();
|
|
25574
25683
|
client.log('channel/removeChannelMembers', channelId, userIds);
|
|
25575
25684
|
const { data: payload } = await client.http.delete(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, { data: { channelId, userIds } });
|
|
25576
|
-
const data = prepareChannelPayload(payload);
|
|
25577
|
-
if (client.cache)
|
|
25578
|
-
ingestInCache(data);
|
|
25579
25685
|
/*
|
|
25580
25686
|
* should fire event for each user that was removed
|
|
25581
25687
|
*/
|
|
25582
|
-
userIds.forEach(id => fireEvent('channel.membersRemoved', Object.assign(Object.assign({}, payload), { channelUsers:
|
|
25688
|
+
userIds.forEach(id => fireEvent('channel.membersRemoved', Object.assign(Object.assign({}, payload), { channelUsers: payload.channelUsers.filter(u => u.userId === id) })));
|
|
25689
|
+
const data = prepareChannelPayload(payload);
|
|
25690
|
+
if (client.cache)
|
|
25691
|
+
ingestInCache(data);
|
|
25583
25692
|
const { channelUsers } = data;
|
|
25584
25693
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member');
|
|
25585
25694
|
};
|
|
@@ -25658,8 +25767,7 @@ const banChannelMembers = async (channelId, userIds) => {
|
|
|
25658
25767
|
const { data: payload } = await client.http.put(`/api/v3/channels/${channelId}/users/ban`, {
|
|
25659
25768
|
userIds,
|
|
25660
25769
|
});
|
|
25661
|
-
const
|
|
25662
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
25770
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25663
25771
|
const { channelUsers } = preparedPayload;
|
|
25664
25772
|
const cachedAt = client.cache && Date.now();
|
|
25665
25773
|
if (client.cache)
|
|
@@ -25690,8 +25798,7 @@ const unbanChannelMembers = async (channelId, userIds) => {
|
|
|
25690
25798
|
const { data: payload } = await client.http.put(`/api/v3/channels/${encodeURIComponent(channelId)}/users/unban`, {
|
|
25691
25799
|
userIds,
|
|
25692
25800
|
});
|
|
25693
|
-
const
|
|
25694
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
25801
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25695
25802
|
const cachedAt = client.cache && Date.now();
|
|
25696
25803
|
if (client.cache)
|
|
25697
25804
|
ingestInCache(preparedPayload, { cachedAt });
|
|
@@ -25875,8 +25982,7 @@ const onChannelDeleted = (callback) => {
|
|
|
25875
25982
|
const onChannelJoined = (callback) => {
|
|
25876
25983
|
const client = getActiveClient();
|
|
25877
25984
|
const filter = (payload) => {
|
|
25878
|
-
const
|
|
25879
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
25985
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25880
25986
|
const { channels, channelUsers } = preparedPayload;
|
|
25881
25987
|
ingestInCache(preparedPayload);
|
|
25882
25988
|
callback(channels[0], channelUsers[0]);
|
|
@@ -25902,8 +26008,7 @@ const onChannelJoined = (callback) => {
|
|
|
25902
26008
|
const onChannelLeft = (callback) => {
|
|
25903
26009
|
const client = getActiveClient();
|
|
25904
26010
|
const filter = (payload) => {
|
|
25905
|
-
const
|
|
25906
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
26011
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25907
26012
|
const { channels, channelUsers } = preparedPayload;
|
|
25908
26013
|
ingestInCache(preparedPayload);
|
|
25909
26014
|
callback(channels[0], channelUsers[0]);
|
|
@@ -25954,8 +26059,7 @@ const onChannelMuted = (callback) => {
|
|
|
25954
26059
|
const onChannelMemberAdded = (callback) => {
|
|
25955
26060
|
const client = getActiveClient();
|
|
25956
26061
|
const filter = (payload) => {
|
|
25957
|
-
const
|
|
25958
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
26062
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25959
26063
|
const { channels, channelUsers } = preparedPayload;
|
|
25960
26064
|
ingestInCache(preparedPayload);
|
|
25961
26065
|
callback(channels[0], channelUsers.find(cu => cu.membership === 'member'));
|
|
@@ -25981,8 +26085,7 @@ const onChannelMemberAdded = (callback) => {
|
|
|
25981
26085
|
const onChannelMemberRemoved = (callback) => {
|
|
25982
26086
|
const client = getActiveClient();
|
|
25983
26087
|
const filter = (payload) => {
|
|
25984
|
-
const
|
|
25985
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
26088
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25986
26089
|
const { channels, channelUsers } = preparedPayload;
|
|
25987
26090
|
ingestInCache(preparedPayload);
|
|
25988
26091
|
callback(channels[0], channelUsers[0]);
|
|
@@ -26008,8 +26111,7 @@ const onChannelMemberRemoved = (callback) => {
|
|
|
26008
26111
|
const onChannelMemberBanned = (callback) => {
|
|
26009
26112
|
const client = getActiveClient();
|
|
26010
26113
|
const filter = (payload) => {
|
|
26011
|
-
const
|
|
26012
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
26114
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
26013
26115
|
const { channels, channelUsers } = preparedPayload;
|
|
26014
26116
|
ingestInCache(preparedPayload);
|
|
26015
26117
|
callback(channels[0], channelUsers.find(cu => cu.membership === 'banned'));
|
|
@@ -26035,8 +26137,7 @@ const onChannelMemberBanned = (callback) => {
|
|
|
26035
26137
|
const onChannelMemberUnbanned = (callback) => {
|
|
26036
26138
|
const client = getActiveClient();
|
|
26037
26139
|
const filter = (payload) => {
|
|
26038
|
-
const
|
|
26039
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
26140
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
26040
26141
|
const { channels, channelUsers } = preparedPayload;
|
|
26041
26142
|
ingestInCache(preparedPayload);
|
|
26042
26143
|
callback(channels[0], channelUsers.find(cu => cu.membership === 'none'));
|
|
@@ -27405,7 +27506,7 @@ const observeMessages = (subChannelId, callback) => {
|
|
|
27405
27506
|
const createCommunityEventSubscriber = (event, callback) => {
|
|
27406
27507
|
const client = getActiveClient();
|
|
27407
27508
|
const filter = (payload) => {
|
|
27408
|
-
const unpackedPayload =
|
|
27509
|
+
const unpackedPayload = prepareCommunityPayload(payload);
|
|
27409
27510
|
if (!client.cache) {
|
|
27410
27511
|
// TODO: here we are missing specific properties here!
|
|
27411
27512
|
callback(unpackedPayload.communities[0]);
|
|
@@ -27475,10 +27576,8 @@ function getEventRelatedMember(event, payload) {
|
|
|
27475
27576
|
const createCommunityMemberEventSubscriber = (event, callback) => {
|
|
27476
27577
|
const client = getActiveClient();
|
|
27477
27578
|
const filter = (payload) => {
|
|
27478
|
-
const
|
|
27479
|
-
const { communities } =
|
|
27480
|
-
const preparedPayload = prepareMembershipPayload(communityPayload, 'communityUsers');
|
|
27481
|
-
const { communityUsers } = preparedPayload;
|
|
27579
|
+
const preparedPayload = prepareCommunityPayload(payload);
|
|
27580
|
+
const { communities, communityUsers } = preparedPayload;
|
|
27482
27581
|
/*
|
|
27483
27582
|
* community.isJoined is not part of the communityMembership payload, and needs
|
|
27484
27583
|
* to be calculated based on the communityMembership value
|
|
@@ -27677,6 +27776,40 @@ const onCommunityUserBanned = (callback) => createCommunityMemberEventSubscriber
|
|
|
27677
27776
|
*/
|
|
27678
27777
|
const onCommunityUserUnbanned = (callback) => createCommunityMemberEventSubscriber('community.userUnbanned', callback);
|
|
27679
27778
|
|
|
27779
|
+
/**
|
|
27780
|
+
* ```js
|
|
27781
|
+
* import { onCommunityUserRoleAdded } from '@amityco/ts-sdk'
|
|
27782
|
+
* const dispose = onCommunityUserRoleAdded((community, member) => {
|
|
27783
|
+
* // ...
|
|
27784
|
+
* })
|
|
27785
|
+
* ```
|
|
27786
|
+
*
|
|
27787
|
+
* Fired when a role has been added to {@link Amity.CommunityUser}
|
|
27788
|
+
*
|
|
27789
|
+
* @param callback The function to call when the event was fired
|
|
27790
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
27791
|
+
*
|
|
27792
|
+
* @category Community Events
|
|
27793
|
+
*/
|
|
27794
|
+
const onCommunityUserRoleAdded = (callback) => createCommunityMemberEventSubscriber('community.roleAdded', callback);
|
|
27795
|
+
|
|
27796
|
+
/**
|
|
27797
|
+
* ```js
|
|
27798
|
+
* import { onCommunityUserRoleRemoved } from '@amityco/ts-sdk'
|
|
27799
|
+
* const dispose = onCommunityUserRoleRemoved((community, member) => {
|
|
27800
|
+
* // ...
|
|
27801
|
+
* })
|
|
27802
|
+
* ```
|
|
27803
|
+
*
|
|
27804
|
+
* Fired when a role has been removed from {@link Amity.CommunityUser}
|
|
27805
|
+
*
|
|
27806
|
+
* @param callback The function to call when the event was fired
|
|
27807
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
27808
|
+
*
|
|
27809
|
+
* @category Community Events
|
|
27810
|
+
*/
|
|
27811
|
+
const onCommunityUserRoleRemoved = (callback) => createCommunityMemberEventSubscriber('community.roleRemoved', callback);
|
|
27812
|
+
|
|
27680
27813
|
/**
|
|
27681
27814
|
* ```js
|
|
27682
27815
|
* import { observeCommunity } from '@amityco/ts-sdk'
|
|
@@ -27837,6 +27970,149 @@ const liveCommunities = (params, callback, config) => {
|
|
|
27837
27970
|
};
|
|
27838
27971
|
};
|
|
27839
27972
|
|
|
27973
|
+
/**
|
|
27974
|
+
* ```js
|
|
27975
|
+
* import { liveCommunity } from '@amityco/ts-sdk';
|
|
27976
|
+
*
|
|
27977
|
+
* let community;
|
|
27978
|
+
*
|
|
27979
|
+
* const unsubscribe = liveCommunity(communityId, response => {
|
|
27980
|
+
* community = response.data;
|
|
27981
|
+
* });
|
|
27982
|
+
* ```
|
|
27983
|
+
*
|
|
27984
|
+
* Observe all mutation on a given {@link Amity.Community}
|
|
27985
|
+
*
|
|
27986
|
+
* @param communityId the ID of the message to observe
|
|
27987
|
+
* @param callback the function to call when new data are available
|
|
27988
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the community
|
|
27989
|
+
*
|
|
27990
|
+
* @category Community Live Object
|
|
27991
|
+
*/
|
|
27992
|
+
const liveCommunity = (communityId, callback) => {
|
|
27993
|
+
return liveObject(communityId, callback, 'communityId', getCommunity, [
|
|
27994
|
+
onCommunityUpdated,
|
|
27995
|
+
onCommunityDeleted,
|
|
27996
|
+
onCommunityJoined,
|
|
27997
|
+
onCommunityLeft,
|
|
27998
|
+
onCommunityUserBanned,
|
|
27999
|
+
onCommunityUserUnbanned,
|
|
28000
|
+
onCommunityUserChanged,
|
|
28001
|
+
]);
|
|
28002
|
+
};
|
|
28003
|
+
|
|
28004
|
+
/**
|
|
28005
|
+
* ```js
|
|
28006
|
+
* import { liveCommunityMembers } from '@amityco/ts-sdk'
|
|
28007
|
+
*
|
|
28008
|
+
* let communityMembers = []
|
|
28009
|
+
* const unsub = liveCommunityMembers({
|
|
28010
|
+
* communityId: Amity.Community['communityId'],
|
|
28011
|
+
* }, response => merge(communityMembers, response.data))
|
|
28012
|
+
* ```
|
|
28013
|
+
*
|
|
28014
|
+
* Observe all mutations on a list of {@link Amity.CommunityUser}s
|
|
28015
|
+
*
|
|
28016
|
+
* @param params for querying community users
|
|
28017
|
+
* @param callback the function to call when new data are available
|
|
28018
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the community users
|
|
28019
|
+
*
|
|
28020
|
+
* @category Community Live Collection
|
|
28021
|
+
*/
|
|
28022
|
+
const liveCommunityMembers = (params, callback, config) => {
|
|
28023
|
+
const { log, cache } = getActiveClient();
|
|
28024
|
+
if (!cache) {
|
|
28025
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
28026
|
+
}
|
|
28027
|
+
const timestamp = Date.now();
|
|
28028
|
+
log(`liveCommunityMembers(tmpid: ${timestamp}) > listen`);
|
|
28029
|
+
const { limit: queryLimit } = params, queryParams = __rest(params, ["limit"]);
|
|
28030
|
+
const limit = queryLimit !== null && queryLimit !== void 0 ? queryLimit : COLLECTION_DEFAULT_PAGINATION_LIMIT;
|
|
28031
|
+
const { policy = COLLECTION_DEFAULT_CACHING_POLICY } = config !== null && config !== void 0 ? config : {};
|
|
28032
|
+
const disposers = [];
|
|
28033
|
+
const cacheKey = ['communityUsers', 'collection', { communityId: params.communityId }];
|
|
28034
|
+
const responder = (data) => {
|
|
28035
|
+
var _a, _b;
|
|
28036
|
+
let communityMembers = (_a = data.data
|
|
28037
|
+
.map(id => pullFromCache(['communityUsers', 'get', id]))
|
|
28038
|
+
.filter(Boolean)
|
|
28039
|
+
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
28040
|
+
if (params.roles)
|
|
28041
|
+
communityMembers = communityMembers.filter(c => { var _a; return (_a = c.roles) === null || _a === void 0 ? void 0 : _a.some(t => { var _a; return (_a = params.roles) === null || _a === void 0 ? void 0 : _a.includes(t); }); });
|
|
28042
|
+
if (params.membership) {
|
|
28043
|
+
communityMembers = communityMembers.filter(({ communityMembership }) =>
|
|
28044
|
+
// @ts-ignore
|
|
28045
|
+
params.membership.includes(communityMembership));
|
|
28046
|
+
}
|
|
28047
|
+
if (params.search) {
|
|
28048
|
+
/*
|
|
28049
|
+
* Search by userId | displayName
|
|
28050
|
+
*/
|
|
28051
|
+
const containsMatcher = new RegExp(params.search);
|
|
28052
|
+
communityMembers = communityMembers.filter(m => {
|
|
28053
|
+
var _a;
|
|
28054
|
+
if (m.userId.match(containsMatcher))
|
|
28055
|
+
return true;
|
|
28056
|
+
return m.user && ((_a = m.user.displayName) === null || _a === void 0 ? void 0 : _a.match(containsMatcher));
|
|
28057
|
+
});
|
|
28058
|
+
}
|
|
28059
|
+
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
28060
|
+
communityMembers = communityMembers.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
28061
|
+
callback({
|
|
28062
|
+
onNextPage: onFetch,
|
|
28063
|
+
data: communityMembers,
|
|
28064
|
+
hasNextPage: !!((_b = data.params) === null || _b === void 0 ? void 0 : _b.page),
|
|
28065
|
+
loading: data.loading,
|
|
28066
|
+
error: data.error,
|
|
28067
|
+
});
|
|
28068
|
+
};
|
|
28069
|
+
const realtimeRouter = (_) => (_, communityMember) => {
|
|
28070
|
+
var _a;
|
|
28071
|
+
if (params.communityId !== communityMember.communityId) {
|
|
28072
|
+
return;
|
|
28073
|
+
}
|
|
28074
|
+
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
28075
|
+
if (!collection)
|
|
28076
|
+
return;
|
|
28077
|
+
const communityMemberCacheId = getResolver('communityUsers')({
|
|
28078
|
+
communityId: params.communityId,
|
|
28079
|
+
userId: communityMember.userId,
|
|
28080
|
+
});
|
|
28081
|
+
collection.data = [...new Set([communityMemberCacheId, ...collection.data])];
|
|
28082
|
+
pushToCache(cacheKey, collection);
|
|
28083
|
+
responder(collection);
|
|
28084
|
+
};
|
|
28085
|
+
const onFetch = () => {
|
|
28086
|
+
var _a, _b, _c;
|
|
28087
|
+
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
28088
|
+
const communityMembers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
28089
|
+
if (communityMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
28090
|
+
return;
|
|
28091
|
+
const query = createQuery(queryCommunityMembers, Object.assign(Object.assign({}, queryParams), { page: (_c = collection === null || collection === void 0 ? void 0 : collection.params.page) !== null && _c !== void 0 ? _c : { limit } }));
|
|
28092
|
+
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
28093
|
+
const data = {
|
|
28094
|
+
loading,
|
|
28095
|
+
error,
|
|
28096
|
+
params: { page },
|
|
28097
|
+
data: communityMembers,
|
|
28098
|
+
};
|
|
28099
|
+
if (result) {
|
|
28100
|
+
data.data = [
|
|
28101
|
+
...new Set([...communityMembers, ...result.map(getResolver('communityUsers'))]),
|
|
28102
|
+
];
|
|
28103
|
+
}
|
|
28104
|
+
pushToCache(cacheKey, data);
|
|
28105
|
+
responder(data);
|
|
28106
|
+
}, queryOptions(policy));
|
|
28107
|
+
};
|
|
28108
|
+
disposers.push(onCommunityLeft(realtimeRouter()), onCommunityJoined(realtimeRouter()), onCommunityUserBanned(realtimeRouter()), onCommunityUserUnbanned(realtimeRouter()), onCommunityUserChanged(realtimeRouter()), onCommunityUserRoleAdded(realtimeRouter()), onCommunityUserRoleRemoved(realtimeRouter()));
|
|
28109
|
+
onFetch();
|
|
28110
|
+
return () => {
|
|
28111
|
+
log(`liveCommunityMembers(tmpid: ${timestamp}) > dispose`);
|
|
28112
|
+
disposers.forEach(fn => fn());
|
|
28113
|
+
};
|
|
28114
|
+
};
|
|
28115
|
+
|
|
27840
28116
|
/**
|
|
27841
28117
|
* ```js
|
|
27842
28118
|
* import { queryCategories } from '@amityco/ts-sdk'
|
|
@@ -28073,16 +28349,17 @@ const queryGlobalFeed = async (query) => {
|
|
|
28073
28349
|
const client = getActiveClient();
|
|
28074
28350
|
client.log('feed/queryGlobalFeed', query);
|
|
28075
28351
|
const _a = query !== null && query !== void 0 ? query : {}, { useCustomRanking, page } = _a, params = __rest(_a, ["useCustomRanking", "page"]);
|
|
28076
|
-
const { data } = await client.http.get(useCustomRanking ? `/api/v5/me/global-feeds` : `/api/v4/me/global-feeds`, {
|
|
28352
|
+
const { data: queryPayload } = await client.http.get(useCustomRanking ? `/api/v5/me/global-feeds` : `/api/v4/me/global-feeds`, {
|
|
28077
28353
|
params: Object.assign(Object.assign({}, params), { options: {
|
|
28078
28354
|
token: toToken(page, 'skiplimit'),
|
|
28079
28355
|
} }),
|
|
28080
28356
|
});
|
|
28081
|
-
const { paging } =
|
|
28082
|
-
const
|
|
28357
|
+
const { paging } = queryPayload, payload = __rest(queryPayload, ["paging"]);
|
|
28358
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
28359
|
+
const { posts } = data;
|
|
28083
28360
|
const cachedAt = client.cache && Date.now();
|
|
28084
28361
|
if (client.cache) {
|
|
28085
|
-
ingestInCache(
|
|
28362
|
+
ingestInCache(data);
|
|
28086
28363
|
const cacheKey = [
|
|
28087
28364
|
'globalFeed',
|
|
28088
28365
|
'query',
|
|
@@ -29920,7 +30197,7 @@ exports.DefaultCommunityPostSetting = DefaultCommunityPostSetting;
|
|
|
29920
30197
|
exports.FileType = FileType;
|
|
29921
30198
|
exports.MessageContentType = MessageContentType;
|
|
29922
30199
|
exports.PostContentType = PostContentType;
|
|
29923
|
-
exports.VERSION = VERSION
|
|
30200
|
+
exports.VERSION = VERSION;
|
|
29924
30201
|
exports.VideoResolution = VideoResolution;
|
|
29925
30202
|
exports.VideoSize = VideoSize;
|
|
29926
30203
|
exports.VideoTranscodingStatus = VideoTranscodingStatus;
|
|
@@ -30033,6 +30310,8 @@ exports.liveChannels = liveChannels;
|
|
|
30033
30310
|
exports.liveComment = liveComment;
|
|
30034
30311
|
exports.liveComments = liveComments;
|
|
30035
30312
|
exports.liveCommunities = liveCommunities;
|
|
30313
|
+
exports.liveCommunity = liveCommunity;
|
|
30314
|
+
exports.liveCommunityMembers = liveCommunityMembers;
|
|
30036
30315
|
exports.liveFollowers = liveFollowers;
|
|
30037
30316
|
exports.liveFollowings = liveFollowings;
|
|
30038
30317
|
exports.liveMessage = liveMessage;
|
|
@@ -30088,6 +30367,8 @@ exports.onCommunityUserAdded = onCommunityUserAdded;
|
|
|
30088
30367
|
exports.onCommunityUserBanned = onCommunityUserBanned;
|
|
30089
30368
|
exports.onCommunityUserChanged = onCommunityUserChanged;
|
|
30090
30369
|
exports.onCommunityUserRemoved = onCommunityUserRemoved;
|
|
30370
|
+
exports.onCommunityUserRoleAdded = onCommunityUserRoleAdded;
|
|
30371
|
+
exports.onCommunityUserRoleRemoved = onCommunityUserRoleRemoved;
|
|
30091
30372
|
exports.onCommunityUserUnbanned = onCommunityUserUnbanned;
|
|
30092
30373
|
exports.onConnectionError = onConnectionError;
|
|
30093
30374
|
exports.onFollowInfoUpdated = onFollowInfoUpdated;
|