@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.esm.js
CHANGED
|
@@ -79,16 +79,16 @@ const PostContentType = Object.freeze({
|
|
|
79
79
|
POLL: 'poll',
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const VERSION
|
|
82
|
+
function getVersion() {
|
|
83
|
+
try {
|
|
84
|
+
// the string ''v0.0.1-beta.40-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
85
|
+
return 'v0.0.1-beta.40-esm';
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return '__dev__';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const VERSION = getVersion();
|
|
92
92
|
|
|
93
93
|
// cache constants
|
|
94
94
|
const CACHE_KEY_GET = 'get';
|
|
@@ -426,6 +426,8 @@ const queryOptions = (policy, lifeSpan = CACHE_LIFESPAN) => {
|
|
|
426
426
|
* @category Query
|
|
427
427
|
*/
|
|
428
428
|
const runQuery = ({ func, args }, callback, options = queryOptions('cache_then_server')) => {
|
|
429
|
+
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');
|
|
430
|
+
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.');
|
|
429
431
|
let local;
|
|
430
432
|
const { lifeSpan } = queryOptions('cache_then_server', options.lifeSpan);
|
|
431
433
|
// offline first
|
|
@@ -545,7 +547,7 @@ const hasKeys = (object, needles) => {
|
|
|
545
547
|
/**
|
|
546
548
|
* Finds the name of the store for a given unknown model
|
|
547
549
|
*
|
|
548
|
-
* @param model one of the {@link Amity.
|
|
550
|
+
* @param model one of the {@link Amity.Models} to identify
|
|
549
551
|
* @returns the name of the corresponding store
|
|
550
552
|
*/
|
|
551
553
|
const identifyModel = (model) => {
|
|
@@ -1360,6 +1362,14 @@ function subscribeTopic(topic, callback) {
|
|
|
1360
1362
|
return mqtt.subscribe(topic, callback);
|
|
1361
1363
|
}
|
|
1362
1364
|
|
|
1365
|
+
var _a;
|
|
1366
|
+
/* eslint-disable no-undef */
|
|
1367
|
+
const theGlobal =
|
|
1368
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1369
|
+
typeof globalThis === 'object' ? globalThis : typeof global === 'object' ? global : window;
|
|
1370
|
+
const { process: safeProcess = {} } = theGlobal;
|
|
1371
|
+
const isProduction = ((_a = safeProcess.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) === 'production';
|
|
1372
|
+
|
|
1363
1373
|
/**
|
|
1364
1374
|
* Creates a pre-configured logger instance
|
|
1365
1375
|
*
|
|
@@ -20354,8 +20364,6 @@ const ACCESS_TOKEN_WATCHER_INTERVAL = 10 * MINUTE;
|
|
|
20354
20364
|
|
|
20355
20365
|
// TODO: find a way to uniquely identify the device
|
|
20356
20366
|
/** @hidden */
|
|
20357
|
-
const VERSION = '11.0.0';
|
|
20358
|
-
/** @hidden */
|
|
20359
20367
|
const getDeviceId = () => {
|
|
20360
20368
|
// here maybe put some auto detection of the device id based on if it's react or not?
|
|
20361
20369
|
// anyhow we let consumer branch out if they want, but it doesn't mean we shouldn't try to be nice
|
|
@@ -20377,10 +20385,10 @@ const getDeviceModel = () => {
|
|
|
20377
20385
|
const getDeviceInfo = () => {
|
|
20378
20386
|
const model = getDeviceModel();
|
|
20379
20387
|
return {
|
|
20380
|
-
version: VERSION,
|
|
20381
20388
|
// TODO: replace with: kind: process.versions ? 'node' : 'web', when backend has fixed this
|
|
20382
20389
|
kind: 'web',
|
|
20383
20390
|
model,
|
|
20391
|
+
sdkVersion: VERSION,
|
|
20384
20392
|
};
|
|
20385
20393
|
};
|
|
20386
20394
|
|
|
@@ -20557,9 +20565,10 @@ const ingestInCache = (payload = {}, options) => {
|
|
|
20557
20565
|
if (!type)
|
|
20558
20566
|
return;
|
|
20559
20567
|
const resolver = getResolver(type);
|
|
20568
|
+
if (!resolver)
|
|
20569
|
+
return;
|
|
20560
20570
|
models.forEach(model => {
|
|
20561
|
-
upsertInCache([type, 'get', resolver(model)],
|
|
20562
|
-
model, options);
|
|
20571
|
+
upsertInCache([type, 'get', resolver(model)], model, options);
|
|
20563
20572
|
});
|
|
20564
20573
|
});
|
|
20565
20574
|
};
|
|
@@ -20994,7 +21003,7 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
20994
21003
|
const sessionState = "notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */;
|
|
20995
21004
|
const sessionHandler = undefined;
|
|
20996
21005
|
const client = {
|
|
20997
|
-
version: `${VERSION
|
|
21006
|
+
version: `${VERSION}`,
|
|
20998
21007
|
apiKey,
|
|
20999
21008
|
log,
|
|
21000
21009
|
http,
|
|
@@ -22370,15 +22379,14 @@ const createMessage = async (bundle) => {
|
|
|
22370
22379
|
client.log('message/createMessage', bundle);
|
|
22371
22380
|
const referenceId = uniqueId;
|
|
22372
22381
|
uniqueId = undefined;
|
|
22373
|
-
const { data } = await client.http
|
|
22374
|
-
|
|
22375
|
-
|
|
22382
|
+
const { data: payload } = await client.http.post('/api/v5/messages', Object.assign(Object.assign({}, convertParams(bundle)), { referenceId }));
|
|
22383
|
+
const data = prepareMessagePayload(payload);
|
|
22384
|
+
const { messages } = data;
|
|
22376
22385
|
const cachedAt = client.cache && Date.now();
|
|
22377
22386
|
if (client.cache) {
|
|
22378
22387
|
dropFromCache(['message', 'get', referenceId]);
|
|
22379
22388
|
ingestInCache(data, { cachedAt });
|
|
22380
22389
|
}
|
|
22381
|
-
const { messages } = data;
|
|
22382
22390
|
fireEvent('local.message.created', { messages });
|
|
22383
22391
|
return {
|
|
22384
22392
|
data: messages[0],
|
|
@@ -22559,6 +22567,66 @@ deleteMessage.optimistically = (messageId) => {
|
|
|
22559
22567
|
};
|
|
22560
22568
|
};
|
|
22561
22569
|
|
|
22570
|
+
/**
|
|
22571
|
+
* Attach user object to membership model
|
|
22572
|
+
* - If cache is not enabled, set user to undefined ({..., user: undefined})
|
|
22573
|
+
* - If user object is not found in cache, set user to undefined
|
|
22574
|
+
* ({..., user: undefined})
|
|
22575
|
+
* - If a user is found in the cache, it attaches the user from the cache
|
|
22576
|
+
* ({..., user: { userId, displayName,... }})
|
|
22577
|
+
*
|
|
22578
|
+
* @param member The membership model object
|
|
22579
|
+
* @param userIdProp The user ID prop name of membership object
|
|
22580
|
+
* @param userProp The user prop name of destination object
|
|
22581
|
+
* @returns The membership model object that is already mapped to user
|
|
22582
|
+
* @hidden
|
|
22583
|
+
*/
|
|
22584
|
+
const withUser = (member, userIdProp = 'userId', userProp = 'user') => {
|
|
22585
|
+
// If the user prop already exists, do not overwrite.
|
|
22586
|
+
if (member[userProp])
|
|
22587
|
+
return member;
|
|
22588
|
+
return Object.assign({ get [userProp]() {
|
|
22589
|
+
var _a;
|
|
22590
|
+
const client = getActiveClient();
|
|
22591
|
+
if (!client.cache)
|
|
22592
|
+
return undefined;
|
|
22593
|
+
const userCache = (_a = pullFromCache(['user', 'get', member[userIdProp]])) === null || _a === void 0 ? void 0 : _a.data;
|
|
22594
|
+
if (!userCache) {
|
|
22595
|
+
return undefined;
|
|
22596
|
+
}
|
|
22597
|
+
return userCache;
|
|
22598
|
+
} }, member);
|
|
22599
|
+
};
|
|
22600
|
+
/**
|
|
22601
|
+
* Mapping membership model with user object
|
|
22602
|
+
*
|
|
22603
|
+
* @param members The membership model objects
|
|
22604
|
+
* @param userIdProp The user ID prop name of membership object
|
|
22605
|
+
* @param userProp The user prop name of destination object
|
|
22606
|
+
* @returns The membership model objects that is already
|
|
22607
|
+
* mapped to users
|
|
22608
|
+
* @hidden
|
|
22609
|
+
*/
|
|
22610
|
+
const withUsers = (members, userIdProp = 'userId', userProp = 'user') => {
|
|
22611
|
+
var _a;
|
|
22612
|
+
return (_a = members === null || members === void 0 ? void 0 : members.map(member => withUser(member, userIdProp, userProp))) !== null && _a !== void 0 ? _a : members;
|
|
22613
|
+
};
|
|
22614
|
+
/**
|
|
22615
|
+
* Transform members prop in any payload with attached users members
|
|
22616
|
+
*
|
|
22617
|
+
* @param payload The payload contain members prop
|
|
22618
|
+
* @param memberProp A name of members prop
|
|
22619
|
+
* @param userIdProp The user ID prop name of membership object
|
|
22620
|
+
* @param userProp The user prop name of destination object
|
|
22621
|
+
* @returns The transforming payload
|
|
22622
|
+
* @hidden
|
|
22623
|
+
*/
|
|
22624
|
+
const prepareMembershipPayload = (payload, memberProp, userIdProp = 'userId', userProp = 'user') => {
|
|
22625
|
+
const _a = payload, _b = memberProp, memberPayload = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
22626
|
+
const members = withUsers(memberPayload, userIdProp, userProp);
|
|
22627
|
+
return Object.assign(Object.assign({}, rest), { [memberProp]: members });
|
|
22628
|
+
};
|
|
22629
|
+
|
|
22562
22630
|
/**
|
|
22563
22631
|
* ```js
|
|
22564
22632
|
* import { queryPosts } from '@amityco/ts-sdk'
|
|
@@ -22598,10 +22666,11 @@ const queryPosts = async (query) => {
|
|
|
22598
22666
|
// const { paging, posts } = unwrapPayload(data)
|
|
22599
22667
|
// unpacking
|
|
22600
22668
|
const { paging } = data, payload = __rest(data, ["paging"]);
|
|
22669
|
+
const paperedPayload = prepareMembershipPayload(payload, 'communityUsers');
|
|
22601
22670
|
const { posts } = payload;
|
|
22602
22671
|
const cachedAt = client.cache && Date.now();
|
|
22603
22672
|
if (client.cache) {
|
|
22604
|
-
ingestInCache(
|
|
22673
|
+
ingestInCache(paperedPayload, { cachedAt });
|
|
22605
22674
|
const cacheKey = ['post', 'query', Object.assign(Object.assign({}, params), { options: Object.assign({}, page) })];
|
|
22606
22675
|
pushToCache(cacheKey, { posts: posts.map(getResolver('post')), paging });
|
|
22607
22676
|
}
|
|
@@ -22663,9 +22732,10 @@ const getPosts = async (postIds) => {
|
|
|
22663
22732
|
client.log('post/getPosts', postIds);
|
|
22664
22733
|
const encodedPostIds = postIds.map(postId => encodeURIComponent(postId));
|
|
22665
22734
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
22666
|
-
const { data } = await client.http.get(`/api/v3/posts/list`, {
|
|
22735
|
+
const { data: payload } = await client.http.get(`/api/v3/posts/list`, {
|
|
22667
22736
|
params: { postIds: encodedPostIds },
|
|
22668
22737
|
});
|
|
22738
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
22669
22739
|
const cachedAt = client.cache && Date.now();
|
|
22670
22740
|
if (client.cache)
|
|
22671
22741
|
ingestInCache(data, { cachedAt });
|
|
@@ -22724,11 +22794,11 @@ const getPost = async (postId) => {
|
|
|
22724
22794
|
const client = getActiveClient();
|
|
22725
22795
|
client.log('post/getPost', postId);
|
|
22726
22796
|
isInTombstone('post', postId);
|
|
22727
|
-
let
|
|
22797
|
+
let payload;
|
|
22728
22798
|
try {
|
|
22729
22799
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
22730
22800
|
const response = await client.http.get(`/api/v3/posts/${encodeURIComponent(postId)}`);
|
|
22731
|
-
|
|
22801
|
+
payload = response.data;
|
|
22732
22802
|
}
|
|
22733
22803
|
catch (error) {
|
|
22734
22804
|
if (checkIfShouldGoesToTombstone(error === null || error === void 0 ? void 0 : error.code)) {
|
|
@@ -22736,6 +22806,7 @@ const getPost = async (postId) => {
|
|
|
22736
22806
|
}
|
|
22737
22807
|
throw error;
|
|
22738
22808
|
}
|
|
22809
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
22739
22810
|
const cachedAt = client.cache && Date.now();
|
|
22740
22811
|
if (client.cache)
|
|
22741
22812
|
ingestInCache(data, { cachedAt });
|
|
@@ -22798,11 +22869,12 @@ const createPost = async (bundle) => {
|
|
|
22798
22869
|
// eslint-disable-next-line no-param-reassign
|
|
22799
22870
|
delete bundle.dataType;
|
|
22800
22871
|
}
|
|
22801
|
-
const { data } = await client.http.post('/api/v4/posts', bundle);
|
|
22872
|
+
const { data: payload } = await client.http.post('/api/v4/posts', bundle);
|
|
22873
|
+
fireEvent('post.created', payload);
|
|
22874
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
22802
22875
|
const cachedAt = client.cache && Date.now();
|
|
22803
22876
|
if (client.cache)
|
|
22804
22877
|
ingestInCache(data, { cachedAt });
|
|
22805
|
-
fireEvent('post.created', data);
|
|
22806
22878
|
const { posts } = data;
|
|
22807
22879
|
return {
|
|
22808
22880
|
data: posts[0],
|
|
@@ -22830,7 +22902,8 @@ const createPost = async (bundle) => {
|
|
|
22830
22902
|
const updatePost = async (postId, patch) => {
|
|
22831
22903
|
const client = getActiveClient();
|
|
22832
22904
|
client.log('user/updatePost', patch);
|
|
22833
|
-
const { data } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, patch);
|
|
22905
|
+
const { data: payload } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, patch);
|
|
22906
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
22834
22907
|
const cachedAt = client.cache && Date.now();
|
|
22835
22908
|
if (client.cache)
|
|
22836
22909
|
ingestInCache(data, { cachedAt });
|
|
@@ -22848,25 +22921,22 @@ const getMatchPostSetting = (value) => {
|
|
|
22848
22921
|
CommunityPostSettingMaps[key].needApprovalOnPostCreation &&
|
|
22849
22922
|
value.onlyAdminCanPost === CommunityPostSettingMaps[key].onlyAdminCanPost)) !== null && _a !== void 0 ? _a : DefaultCommunityPostSetting;
|
|
22850
22923
|
};
|
|
22851
|
-
|
|
22852
|
-
|
|
22853
|
-
|
|
22854
|
-
|
|
22855
|
-
|
|
22856
|
-
|
|
22857
|
-
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
22862
|
-
|
|
22924
|
+
const prepareCommunityPayload = (rawPayload) => {
|
|
22925
|
+
// Unpack community payload by mapping payload field to postSetting value.
|
|
22926
|
+
const communities = rawPayload.communities.map((_a) => {
|
|
22927
|
+
var { needApprovalOnPostCreation, onlyAdminCanPost } = _a, restCommunityPayload = __rest(_a, ["needApprovalOnPostCreation", "onlyAdminCanPost"]);
|
|
22928
|
+
return (Object.assign({ postSetting: getMatchPostSetting({
|
|
22929
|
+
needApprovalOnPostCreation,
|
|
22930
|
+
onlyAdminCanPost,
|
|
22931
|
+
}) }, restCommunityPayload));
|
|
22932
|
+
});
|
|
22933
|
+
const communityUsers = withUsers(rawPayload.communityUsers);
|
|
22934
|
+
return Object.assign(Object.assign({}, rawPayload), { communities,
|
|
22935
|
+
communityUsers });
|
|
22863
22936
|
};
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
const packCommunityPayload = (_a) => {
|
|
22868
|
-
var { postSetting = undefined } = _a, restParam = __rest(_a, ["postSetting"]);
|
|
22869
|
-
return (Object.assign(Object.assign({}, restParam), (postSetting ? CommunityPostSettingMaps[postSetting] : undefined)));
|
|
22937
|
+
const prepareCommunityRequest = (params) => {
|
|
22938
|
+
const { postSetting = undefined } = params, restParam = __rest(params, ["postSetting"]);
|
|
22939
|
+
return Object.assign(Object.assign({}, restParam), (postSetting ? CommunityPostSettingMaps[postSetting] : undefined));
|
|
22870
22940
|
};
|
|
22871
22941
|
|
|
22872
22942
|
/**
|
|
@@ -22899,7 +22969,7 @@ const queryCommunities = async (query) => {
|
|
|
22899
22969
|
} }),
|
|
22900
22970
|
});
|
|
22901
22971
|
const { paging } = data, payload = __rest(data, ["paging"]);
|
|
22902
|
-
const unpackedPayload =
|
|
22972
|
+
const unpackedPayload = prepareCommunityPayload(payload);
|
|
22903
22973
|
const { communities } = unpackedPayload;
|
|
22904
22974
|
const cachedAt = client.cache && Date.now();
|
|
22905
22975
|
if (client.cache) {
|
|
@@ -22955,7 +23025,7 @@ const getCommunities = async (communityIds) => {
|
|
|
22955
23025
|
const { data: payload } = await client.http.get(`/api/v3/communities/list`, {
|
|
22956
23026
|
params: { communityIds },
|
|
22957
23027
|
});
|
|
22958
|
-
const data =
|
|
23028
|
+
const data = prepareCommunityPayload(payload);
|
|
22959
23029
|
const cachedAt = client.cache && Date.now();
|
|
22960
23030
|
if (client.cache)
|
|
22961
23031
|
ingestInCache(data, { cachedAt });
|
|
@@ -23015,7 +23085,7 @@ const getCommunity = async (communityId) => {
|
|
|
23015
23085
|
client.log('community/getCommunity', communityId);
|
|
23016
23086
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
23017
23087
|
const { data: payload } = await client.http.get(`/api/v3/communities/${communityId}`);
|
|
23018
|
-
const data =
|
|
23088
|
+
const data = prepareCommunityPayload(payload);
|
|
23019
23089
|
const cachedAt = client.cache && Date.now();
|
|
23020
23090
|
if (client.cache)
|
|
23021
23091
|
ingestInCache(data, { cachedAt });
|
|
@@ -23069,12 +23139,12 @@ getCommunity.locally = (communityId) => {
|
|
|
23069
23139
|
const createCommunity = async (bundle) => {
|
|
23070
23140
|
const client = getActiveClient();
|
|
23071
23141
|
client.log('user/createCommunity', bundle);
|
|
23072
|
-
const { data: payload } = await client.http.post('/api/v3/communities/',
|
|
23073
|
-
|
|
23142
|
+
const { data: payload } = await client.http.post('/api/v3/communities/', prepareCommunityRequest(bundle));
|
|
23143
|
+
fireEvent('community.created', payload);
|
|
23144
|
+
const data = prepareCommunityPayload(payload);
|
|
23074
23145
|
const cachedAt = client.cache && Date.now();
|
|
23075
23146
|
if (client.cache)
|
|
23076
23147
|
ingestInCache(data, { cachedAt });
|
|
23077
|
-
fireEvent('community.created', data);
|
|
23078
23148
|
const { communities } = data;
|
|
23079
23149
|
return {
|
|
23080
23150
|
data: communities[0],
|
|
@@ -23100,12 +23170,12 @@ const createCommunity = async (bundle) => {
|
|
|
23100
23170
|
const updateCommunity = async (communityId, patch) => {
|
|
23101
23171
|
const client = getActiveClient();
|
|
23102
23172
|
client.log('community/updateCommunity', communityId, patch);
|
|
23103
|
-
const { data: payload } = await client.http.put(`/api/v3/communities/${communityId}`,
|
|
23104
|
-
|
|
23173
|
+
const { data: payload } = await client.http.put(`/api/v3/communities/${communityId}`, prepareCommunityRequest(patch));
|
|
23174
|
+
fireEvent('community.updated', payload);
|
|
23175
|
+
const data = prepareCommunityPayload(payload);
|
|
23105
23176
|
const cachedAt = client.cache && Date.now();
|
|
23106
23177
|
if (client.cache)
|
|
23107
23178
|
ingestInCache(data, { cachedAt });
|
|
23108
|
-
fireEvent('community.updated', data);
|
|
23109
23179
|
const { communities } = data;
|
|
23110
23180
|
return {
|
|
23111
23181
|
data: communities.find(community => community.communityId === communityId),
|
|
@@ -23133,7 +23203,14 @@ const deleteCommunity = async (communityId) => {
|
|
|
23133
23203
|
// API-FIX: This endpoint has not been implemented yet.
|
|
23134
23204
|
await client.http.delete(`/api/v3/communities/${communityId}`);
|
|
23135
23205
|
const deleted = await getCommunity(communityId);
|
|
23136
|
-
fireEvent('community.deleted', {
|
|
23206
|
+
fireEvent('community.deleted', {
|
|
23207
|
+
communities: [deleted.data],
|
|
23208
|
+
categories: [],
|
|
23209
|
+
communityUsers: [],
|
|
23210
|
+
feeds: [],
|
|
23211
|
+
files: [],
|
|
23212
|
+
users: [],
|
|
23213
|
+
});
|
|
23137
23214
|
return deleted.data;
|
|
23138
23215
|
};
|
|
23139
23216
|
|
|
@@ -23154,11 +23231,12 @@ const deleteCommunity = async (communityId) => {
|
|
|
23154
23231
|
const joinCommunity = async (communityId) => {
|
|
23155
23232
|
const client = getActiveClient();
|
|
23156
23233
|
client.log('community/joinCommunity', communityId);
|
|
23157
|
-
const { data } = await client.http.post(`/api/v3/communities/${communityId}/join`);
|
|
23234
|
+
const { data: payload } = await client.http.post(`/api/v3/communities/${communityId}/join`);
|
|
23235
|
+
fireEvent('community.joined', payload);
|
|
23236
|
+
const data = prepareCommunityPayload(payload);
|
|
23158
23237
|
const cachedAt = client.cache && Date.now();
|
|
23159
23238
|
if (client.cache)
|
|
23160
23239
|
ingestInCache(data, { cachedAt });
|
|
23161
|
-
fireEvent('community.joined', data);
|
|
23162
23240
|
const { communityUsers } = data;
|
|
23163
23241
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23164
23242
|
};
|
|
@@ -23180,67 +23258,16 @@ const joinCommunity = async (communityId) => {
|
|
|
23180
23258
|
const leaveCommunity = async (communityId) => {
|
|
23181
23259
|
const client = getActiveClient();
|
|
23182
23260
|
client.log('community/leaveCommunity', communityId);
|
|
23183
|
-
const { data } = await client.http.delete(`/api/v3/communities/${communityId}/leave`);
|
|
23261
|
+
const { data: payload } = await client.http.delete(`/api/v3/communities/${communityId}/leave`);
|
|
23262
|
+
fireEvent('community.left', payload);
|
|
23263
|
+
const data = prepareCommunityPayload(payload);
|
|
23184
23264
|
const cachedAt = client.cache && Date.now();
|
|
23185
23265
|
if (client.cache)
|
|
23186
23266
|
ingestInCache(data, { cachedAt });
|
|
23187
|
-
fireEvent('community.left', data);
|
|
23188
23267
|
const { communityUsers } = data;
|
|
23189
23268
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23190
23269
|
};
|
|
23191
23270
|
|
|
23192
|
-
/**
|
|
23193
|
-
* Attach user object to membership model
|
|
23194
|
-
* - If cache is not enabled, set user to undefined ({..., user: undefined})
|
|
23195
|
-
* - If user object is not found in cache, set user to undefined
|
|
23196
|
-
* ({..., user: undefined})
|
|
23197
|
-
* - If a user is found in the cache, it attaches the user from the cache
|
|
23198
|
-
* ({..., user: { userId, displayName,... }})
|
|
23199
|
-
*
|
|
23200
|
-
* @param member The membership model object
|
|
23201
|
-
* @param userIdProp The user ID prop name of membership object
|
|
23202
|
-
* @param userProp The user prop name of destination object
|
|
23203
|
-
* @returns The membership model object that is already mapped to user
|
|
23204
|
-
* @hidden
|
|
23205
|
-
*/
|
|
23206
|
-
const withUser = (member, userIdProp = 'userId', userProp = 'user') => (Object.assign({ get [userProp]() {
|
|
23207
|
-
var _a;
|
|
23208
|
-
const client = getActiveClient();
|
|
23209
|
-
if (!client.cache)
|
|
23210
|
-
return undefined;
|
|
23211
|
-
const userCache = (_a = pullFromCache(['user', 'get', member[userIdProp]])) === null || _a === void 0 ? void 0 : _a.data;
|
|
23212
|
-
if (!userCache) {
|
|
23213
|
-
return undefined;
|
|
23214
|
-
}
|
|
23215
|
-
return userCache;
|
|
23216
|
-
} }, member));
|
|
23217
|
-
/**
|
|
23218
|
-
* Mapping membership model with user object
|
|
23219
|
-
*
|
|
23220
|
-
* @param members The membership model objects
|
|
23221
|
-
* @param userIdProp The user ID prop name of membership object
|
|
23222
|
-
* @param userProp The user prop name of destination object
|
|
23223
|
-
* @returns The membership model objects that is already
|
|
23224
|
-
* mapped to users
|
|
23225
|
-
* @hidden
|
|
23226
|
-
*/
|
|
23227
|
-
const withUsers = (members, userIdProp = 'userId', userProp = 'user') => members.map(member => withUser(member, userIdProp, userProp));
|
|
23228
|
-
/**
|
|
23229
|
-
* Transform members prop in any payload with attached users members
|
|
23230
|
-
*
|
|
23231
|
-
* @param payload The payload contain members prop
|
|
23232
|
-
* @param memberProp A name of members prop
|
|
23233
|
-
* @param userIdProp The user ID prop name of membership object
|
|
23234
|
-
* @param userProp The user prop name of destination object
|
|
23235
|
-
* @returns The transforming payload
|
|
23236
|
-
* @hidden
|
|
23237
|
-
*/
|
|
23238
|
-
const prepareMembershipPayload = (payload, memberProp, userIdProp = 'userId', userProp = 'user') => {
|
|
23239
|
-
const _a = payload, _b = memberProp, memberPayload = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
23240
|
-
const members = withUsers(memberPayload, userIdProp, userProp);
|
|
23241
|
-
return Object.assign(Object.assign({}, rest), { [memberProp]: members });
|
|
23242
|
-
};
|
|
23243
|
-
|
|
23244
23271
|
/**
|
|
23245
23272
|
* ```js
|
|
23246
23273
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23341,10 +23368,11 @@ queryCommunityMembers.locally = (query) => {
|
|
|
23341
23368
|
const addCommunityMembers = async (communityId, userIds) => {
|
|
23342
23369
|
const client = getActiveClient();
|
|
23343
23370
|
client.log('community/addCommunityMembers', communityId, userIds);
|
|
23344
|
-
const { data } = await client.http.post(`/api/v3/communities/${communityId}/users`, { communityId, userIds });
|
|
23371
|
+
const { data: payload } = await client.http.post(`/api/v3/communities/${communityId}/users`, { communityId, userIds });
|
|
23372
|
+
fireEvent('community.userAdded', payload);
|
|
23373
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23345
23374
|
if (client.cache)
|
|
23346
23375
|
ingestInCache(data);
|
|
23347
|
-
fireEvent('community.userAdded', data);
|
|
23348
23376
|
const { communityUsers } = data;
|
|
23349
23377
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23350
23378
|
};
|
|
@@ -23367,10 +23395,11 @@ const addCommunityMembers = async (communityId, userIds) => {
|
|
|
23367
23395
|
const removeCommunityMembers = async (communityId, userIds) => {
|
|
23368
23396
|
const client = getActiveClient();
|
|
23369
23397
|
client.log('community/removeCommunityMembers', communityId, userIds);
|
|
23370
|
-
const { data } = await client.http.delete(`/api/v3/communities/${communityId}/users`, { data: { communityId, userIds } });
|
|
23398
|
+
const { data: payload } = await client.http.delete(`/api/v3/communities/${communityId}/users`, { data: { communityId, userIds } });
|
|
23399
|
+
fireEvent('community.userRemoved', payload);
|
|
23400
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23371
23401
|
if (client.cache)
|
|
23372
23402
|
ingestInCache(data);
|
|
23373
|
-
fireEvent('community.userRemoved', data);
|
|
23374
23403
|
const { communityUsers } = data;
|
|
23375
23404
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23376
23405
|
};
|
|
@@ -23385,7 +23414,7 @@ const removeCommunityMembers = async (communityId, userIds) => {
|
|
|
23385
23414
|
*
|
|
23386
23415
|
* @param communityId The ID of the {@link Amity.Community} to perform
|
|
23387
23416
|
* @param roleIds Array of IDs of the {@link Amity.Role} to apply
|
|
23388
|
-
* @param
|
|
23417
|
+
* @param userIds Array of IDs of the {@link Amity.User} to perform
|
|
23389
23418
|
* @returns A success boolean if the {@link Amity.Role} were added to list of {@link Amity.User} in the {@link Amity.Community}
|
|
23390
23419
|
*
|
|
23391
23420
|
* @category Community API
|
|
@@ -23394,7 +23423,8 @@ const removeCommunityMembers = async (communityId, userIds) => {
|
|
|
23394
23423
|
const addCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
23395
23424
|
const client = getActiveClient();
|
|
23396
23425
|
client.log('community/addCommunityMembersRoles', communityId, roleIds, userIds);
|
|
23397
|
-
const { data } = await client.http.post(`/api/v4/communities/${communityId}/users/roles`, { communityId, roles: roleIds, userIds });
|
|
23426
|
+
const { data: payload } = await client.http.post(`/api/v4/communities/${communityId}/users/roles`, { communityId, roles: roleIds, userIds });
|
|
23427
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23398
23428
|
if (client.cache)
|
|
23399
23429
|
ingestInCache(data);
|
|
23400
23430
|
const { communityUsers } = data;
|
|
@@ -23412,7 +23442,7 @@ const addCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23412
23442
|
*
|
|
23413
23443
|
* @param communityId The ID of the {@link Amity.Community} to perform
|
|
23414
23444
|
* @param roleIds Array of IDs of the {@link Amity.Role} to apply
|
|
23415
|
-
* @param
|
|
23445
|
+
* @param userIds Array of IDs of the {@link Amity.User} to perform
|
|
23416
23446
|
* @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Community}
|
|
23417
23447
|
*
|
|
23418
23448
|
* @category Community API
|
|
@@ -23421,7 +23451,8 @@ const addCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23421
23451
|
const removeCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
23422
23452
|
const client = getActiveClient();
|
|
23423
23453
|
client.log('community/removeCommunityMembersRoles', communityId, roleIds, userIds);
|
|
23424
|
-
const { data } = await client.http.delete(`/api/v4/communities/${communityId}/users/roles`, { data: { communityId, roles: roleIds, userIds } });
|
|
23454
|
+
const { data: payload } = await client.http.delete(`/api/v4/communities/${communityId}/users/roles`, { data: { communityId, roles: roleIds, userIds } });
|
|
23455
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23425
23456
|
if (client.cache)
|
|
23426
23457
|
ingestInCache(data);
|
|
23427
23458
|
const { communityUsers } = data;
|
|
@@ -23450,7 +23481,7 @@ const getTopTrendingCommunities = async (query) => {
|
|
|
23450
23481
|
// API-FIX: backend doesnt answer Amity.Response
|
|
23451
23482
|
// const { data } = await client.http.get<Amity.Response<CommunityPayload>>(
|
|
23452
23483
|
const { data: payload } = await client.http.get(`/api/v3/communities/top-trending`, { params: { options: { limit } } });
|
|
23453
|
-
const data =
|
|
23484
|
+
const data = prepareCommunityPayload(payload);
|
|
23454
23485
|
const { communities } = data;
|
|
23455
23486
|
const cachedAt = client.cache && Date.now();
|
|
23456
23487
|
if (client.cache) {
|
|
@@ -23514,7 +23545,7 @@ const getRecommendedCommunities = async (query) => {
|
|
|
23514
23545
|
// API-FIX: backend doesnt answer Amity.Response
|
|
23515
23546
|
// const { data: payload } = await client.http.get<Amity.Response<CommunityPayload>>(
|
|
23516
23547
|
const { data: payload } = await client.http.get(`/api/v3/communities/recommended`, { params: { options: { limit } } });
|
|
23517
|
-
const data =
|
|
23548
|
+
const data = prepareCommunityPayload(payload);
|
|
23518
23549
|
const { communities } = data;
|
|
23519
23550
|
const cachedAt = client.cache && Date.now();
|
|
23520
23551
|
if (client.cache) {
|
|
@@ -23588,11 +23619,28 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
23588
23619
|
// later when realtime events covers that for us.
|
|
23589
23620
|
if (post.data.targetType === 'community') {
|
|
23590
23621
|
const community = await getCommunity(post.data.targetId);
|
|
23591
|
-
fireEvent('community.updated', {
|
|
23622
|
+
fireEvent('community.updated', {
|
|
23623
|
+
communities: [community.data],
|
|
23624
|
+
categories: [],
|
|
23625
|
+
communityUsers: [],
|
|
23626
|
+
feeds: [],
|
|
23627
|
+
files: [],
|
|
23628
|
+
users: [],
|
|
23629
|
+
});
|
|
23592
23630
|
}
|
|
23593
23631
|
// to support hard deletion
|
|
23594
23632
|
const deleted = Object.assign(Object.assign({}, post.data), { isDeleted: true });
|
|
23595
|
-
fireEvent('post.deleted', {
|
|
23633
|
+
fireEvent('post.deleted', {
|
|
23634
|
+
posts: [deleted],
|
|
23635
|
+
categories: [],
|
|
23636
|
+
comments: [],
|
|
23637
|
+
communities: [],
|
|
23638
|
+
communityUsers: [],
|
|
23639
|
+
feeds: [],
|
|
23640
|
+
files: [],
|
|
23641
|
+
postChildren: [],
|
|
23642
|
+
users: [],
|
|
23643
|
+
});
|
|
23596
23644
|
if (permanent) {
|
|
23597
23645
|
setTimeout(() => {
|
|
23598
23646
|
pushToTombstone('post', postId);
|
|
@@ -23620,22 +23668,20 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
23620
23668
|
* @async
|
|
23621
23669
|
*/
|
|
23622
23670
|
const approvePost = async (postId) => {
|
|
23623
|
-
var _a;
|
|
23624
23671
|
const client = getActiveClient();
|
|
23625
23672
|
client.log('post/approvePost', postId);
|
|
23626
|
-
const { data:
|
|
23627
|
-
|
|
23628
|
-
if (client.cache)
|
|
23629
|
-
ingestInCache(approved, { cachedAt });
|
|
23673
|
+
const { data: payload } = await client.http.post(`/api/v3/posts/${encodeURIComponent(postId)}/approve`);
|
|
23674
|
+
fireEvent('post.approved', payload);
|
|
23630
23675
|
// fire virtual event for community update
|
|
23631
|
-
if (
|
|
23632
|
-
|
|
23633
|
-
// @ts-ignore as communities is optional currently in PostPayload
|
|
23634
|
-
fireEvent('community.updated', { communities: [community] });
|
|
23676
|
+
if (payload.posts[0].targetType === 'community') {
|
|
23677
|
+
fireEvent('community.updated', payload);
|
|
23635
23678
|
}
|
|
23636
|
-
|
|
23679
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23680
|
+
const cachedAt = client.cache && Date.now();
|
|
23681
|
+
if (client.cache)
|
|
23682
|
+
ingestInCache(data, { cachedAt });
|
|
23637
23683
|
return {
|
|
23638
|
-
data:
|
|
23684
|
+
data: data.posts.find(post => post.postId === postId),
|
|
23639
23685
|
cachedAt,
|
|
23640
23686
|
};
|
|
23641
23687
|
};
|
|
@@ -23656,22 +23702,20 @@ const approvePost = async (postId) => {
|
|
|
23656
23702
|
* @async
|
|
23657
23703
|
*/
|
|
23658
23704
|
const declinePost = async (postId) => {
|
|
23659
|
-
var _a;
|
|
23660
23705
|
const client = getActiveClient();
|
|
23661
23706
|
client.log('post/declinePost', postId);
|
|
23662
|
-
const { data:
|
|
23663
|
-
const cachedAt = client.cache && Date.now();
|
|
23664
|
-
if (client.cache)
|
|
23665
|
-
ingestInCache(declined, { cachedAt });
|
|
23707
|
+
const { data: payload } = await client.http.post(`/api/v3/posts/${encodeURIComponent(postId)}/decline`);
|
|
23666
23708
|
// fire virtual event
|
|
23667
|
-
if (
|
|
23668
|
-
|
|
23669
|
-
// @ts-ignore as communities is optional currently in PostPayload
|
|
23670
|
-
fireEvent('community.updated', { communities: [community] });
|
|
23709
|
+
if (payload.posts[0].targetType === 'community') {
|
|
23710
|
+
fireEvent('community.updated', payload);
|
|
23671
23711
|
}
|
|
23672
|
-
fireEvent('post.declined',
|
|
23712
|
+
fireEvent('post.declined', payload);
|
|
23713
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
23714
|
+
const cachedAt = client.cache && Date.now();
|
|
23715
|
+
if (client.cache)
|
|
23716
|
+
ingestInCache(data, { cachedAt });
|
|
23673
23717
|
return {
|
|
23674
|
-
data:
|
|
23718
|
+
data: payload.posts.find(post => post.postId === postId),
|
|
23675
23719
|
cachedAt,
|
|
23676
23720
|
};
|
|
23677
23721
|
};
|
|
@@ -23910,7 +23954,17 @@ const createComment = async (bundle) => {
|
|
|
23910
23954
|
if (client.cache)
|
|
23911
23955
|
ingestInCache(data, { cachedAt });
|
|
23912
23956
|
const post = await getPost(bundle.referenceId);
|
|
23913
|
-
fireEvent('post.updated', {
|
|
23957
|
+
fireEvent('post.updated', {
|
|
23958
|
+
posts: [post.data],
|
|
23959
|
+
categories: [],
|
|
23960
|
+
comments: [],
|
|
23961
|
+
communities: [],
|
|
23962
|
+
communityUsers: [],
|
|
23963
|
+
feeds: [],
|
|
23964
|
+
files: [],
|
|
23965
|
+
postChildren: [],
|
|
23966
|
+
users: [],
|
|
23967
|
+
});
|
|
23914
23968
|
fireEvent('comment.created', data);
|
|
23915
23969
|
const { comments } = data;
|
|
23916
23970
|
return {
|
|
@@ -23979,8 +24033,23 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
23979
24033
|
// to support hard deletion
|
|
23980
24034
|
const deleted = Object.assign(Object.assign({}, comment.data), { isDeleted: true });
|
|
23981
24035
|
const post = await getPost(comment.data.referenceId);
|
|
23982
|
-
fireEvent('post.updated', {
|
|
23983
|
-
|
|
24036
|
+
fireEvent('post.updated', {
|
|
24037
|
+
posts: [post.data],
|
|
24038
|
+
categories: [],
|
|
24039
|
+
comments: [],
|
|
24040
|
+
communities: [],
|
|
24041
|
+
communityUsers: [],
|
|
24042
|
+
feeds: [],
|
|
24043
|
+
files: [],
|
|
24044
|
+
postChildren: [],
|
|
24045
|
+
users: [],
|
|
24046
|
+
});
|
|
24047
|
+
fireEvent('comment.deleted', {
|
|
24048
|
+
comments: [deleted],
|
|
24049
|
+
commentChildren: [],
|
|
24050
|
+
files: [],
|
|
24051
|
+
users: [],
|
|
24052
|
+
});
|
|
23984
24053
|
if (permanent) {
|
|
23985
24054
|
scheduleTask(() => pushToTombstone('comment', commentId));
|
|
23986
24055
|
}
|
|
@@ -24218,6 +24287,8 @@ const queryReactions = async (query) => {
|
|
|
24218
24287
|
});
|
|
24219
24288
|
const { paging } = data, payload = __rest(data, ["paging"]);
|
|
24220
24289
|
const { reactions } = payload;
|
|
24290
|
+
// FIXME: correct reactions type in model
|
|
24291
|
+
// @ts-ignore
|
|
24221
24292
|
ingestInCache(Object.assign(Object.assign({}, payload), { reactions: reactions[0].reactors }));
|
|
24222
24293
|
const nextPage = toPageRaw(paging.next);
|
|
24223
24294
|
const prevPage = toPageRaw(paging.previous);
|
|
@@ -24233,9 +24304,17 @@ const createPostEventSubscriber = (event, callback) => {
|
|
|
24233
24304
|
}
|
|
24234
24305
|
else {
|
|
24235
24306
|
const { communities } = payload, others = __rest(payload, ["communities"]);
|
|
24236
|
-
|
|
24307
|
+
const data = prepareMembershipPayload(others, 'communityUsers');
|
|
24308
|
+
ingestInCache(data);
|
|
24237
24309
|
if ((communities === null || communities === void 0 ? void 0 : communities[0]) && !['post.updated'].includes(event)) {
|
|
24238
|
-
fireEvent('community.updated', {
|
|
24310
|
+
fireEvent('community.updated', {
|
|
24311
|
+
communities,
|
|
24312
|
+
categories: [],
|
|
24313
|
+
communityUsers: [],
|
|
24314
|
+
feeds: [],
|
|
24315
|
+
files: [],
|
|
24316
|
+
users: [],
|
|
24317
|
+
});
|
|
24239
24318
|
}
|
|
24240
24319
|
const post = pullFromCache(['post', 'get', payload.posts[0].postId]);
|
|
24241
24320
|
if (['post.created', 'post.approved', 'post.declined'].includes(event)) {
|
|
@@ -24752,6 +24831,8 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
24752
24831
|
if (eventName !== 'add')
|
|
24753
24832
|
return;
|
|
24754
24833
|
ingestInCache(payload);
|
|
24834
|
+
// FIXME: correct reactions type in model
|
|
24835
|
+
// @ts-ignore
|
|
24755
24836
|
ingestInCache({ reactions: [reactor] });
|
|
24756
24837
|
callbackWrapper('message', payload.messages[0].messageId, reactor);
|
|
24757
24838
|
};
|
|
@@ -24761,6 +24842,8 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
24761
24842
|
const filter = (payload) => {
|
|
24762
24843
|
const { reactor } = payload, rest = __rest(payload, ["reactor"]);
|
|
24763
24844
|
ingestInCache(rest);
|
|
24845
|
+
// FIXME: correct reactions type in model
|
|
24846
|
+
// @ts-ignore
|
|
24764
24847
|
ingestInCache({ reactions: [reactor] });
|
|
24765
24848
|
callbackWrapper('post', payload.posts[0].postId, reactor);
|
|
24766
24849
|
};
|
|
@@ -24769,6 +24852,8 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
24769
24852
|
const filter = (payload) => {
|
|
24770
24853
|
const { reactor } = payload, rest = __rest(payload, ["reactor"]);
|
|
24771
24854
|
ingestInCache(rest);
|
|
24855
|
+
// FIXME: correct reactions type in model
|
|
24856
|
+
// @ts-ignore
|
|
24772
24857
|
ingestInCache({ reactions: [reactor] });
|
|
24773
24858
|
callbackWrapper('comment', payload.comments[0].commentId, reactor);
|
|
24774
24859
|
};
|
|
@@ -24808,6 +24893,8 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
24808
24893
|
if (eventName !== 'remove')
|
|
24809
24894
|
return;
|
|
24810
24895
|
ingestInCache(payload);
|
|
24896
|
+
// FIXME: correct reactions type in model
|
|
24897
|
+
// @ts-ignore
|
|
24811
24898
|
ingestInCache({ reactions: [reactor] });
|
|
24812
24899
|
callbackWrapper('message', payload.messages[0].messageId, reactor);
|
|
24813
24900
|
};
|
|
@@ -24817,6 +24904,8 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
24817
24904
|
const filter = (payload) => {
|
|
24818
24905
|
const { reactor } = payload, rest = __rest(payload, ["reactor"]);
|
|
24819
24906
|
ingestInCache(rest);
|
|
24907
|
+
// FIXME: correct reactions type in model
|
|
24908
|
+
// @ts-ignore
|
|
24820
24909
|
ingestInCache({ reactions: [reactor] });
|
|
24821
24910
|
callbackWrapper('post', payload.posts[0].postId, reactor);
|
|
24822
24911
|
};
|
|
@@ -24825,6 +24914,8 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
24825
24914
|
const filter = (payload) => {
|
|
24826
24915
|
const { reactor } = payload, rest = __rest(payload, ["reactor"]);
|
|
24827
24916
|
ingestInCache(rest);
|
|
24917
|
+
// FIXME: correct reactions type in model
|
|
24918
|
+
// @ts-ignore
|
|
24828
24919
|
ingestInCache({ reactions: [reactor] });
|
|
24829
24920
|
callbackWrapper('comment', payload.comments[0].commentId, reactor);
|
|
24830
24921
|
};
|
|
@@ -24975,11 +25066,20 @@ const createReport = async (referenceType, referenceId) => {
|
|
|
24975
25066
|
const { domainName } = REFERENCE_TYPES[referenceType];
|
|
24976
25067
|
return `/api/v3/${domainName}/${encodeURIComponent(referenceId)}/flag`;
|
|
24977
25068
|
};
|
|
24978
|
-
const { data } = await client.http.post(getAPIUrl());
|
|
24979
|
-
if (client.cache)
|
|
24980
|
-
|
|
24981
|
-
|
|
24982
|
-
|
|
25069
|
+
const { data: payload } = await client.http.post(getAPIUrl());
|
|
25070
|
+
if (client.cache) {
|
|
25071
|
+
if (referenceType === 'message') {
|
|
25072
|
+
ingestInCache(prepareMessagePayload(payload));
|
|
25073
|
+
}
|
|
25074
|
+
else if (referenceType === 'post') {
|
|
25075
|
+
ingestInCache(prepareMembershipPayload(payload, 'communityUsers'));
|
|
25076
|
+
}
|
|
25077
|
+
else {
|
|
25078
|
+
ingestInCache(payload);
|
|
25079
|
+
}
|
|
25080
|
+
}
|
|
25081
|
+
fireEvent(`${referenceType}.flagged`, payload);
|
|
25082
|
+
return !!payload;
|
|
24983
25083
|
};
|
|
24984
25084
|
|
|
24985
25085
|
/**
|
|
@@ -25008,12 +25108,21 @@ const deleteReport = async (referenceType, referenceId) => {
|
|
|
25008
25108
|
const { domainName } = REFERENCE_TYPES[referenceType];
|
|
25009
25109
|
return `/api/v3/${domainName}/${encodeURIComponent(referenceId)}/unflag`;
|
|
25010
25110
|
};
|
|
25011
|
-
const { data } = await client.http.delete(getAPIUrl());
|
|
25012
|
-
if (client.cache)
|
|
25013
|
-
|
|
25111
|
+
const { data: payload } = await client.http.delete(getAPIUrl());
|
|
25112
|
+
if (client.cache) {
|
|
25113
|
+
if (referenceType === 'message') {
|
|
25114
|
+
ingestInCache(prepareMessagePayload(payload));
|
|
25115
|
+
}
|
|
25116
|
+
else if (referenceType === 'post') {
|
|
25117
|
+
ingestInCache(prepareMembershipPayload(payload, 'communityUsers'));
|
|
25118
|
+
}
|
|
25119
|
+
else {
|
|
25120
|
+
ingestInCache(payload);
|
|
25121
|
+
}
|
|
25122
|
+
}
|
|
25014
25123
|
// @ts-ignore
|
|
25015
|
-
fireEvent(`${referenceType}.unflagged`,
|
|
25016
|
-
return !!
|
|
25124
|
+
fireEvent(`${referenceType}.unflagged`, payload);
|
|
25125
|
+
return !!payload;
|
|
25017
25126
|
};
|
|
25018
25127
|
|
|
25019
25128
|
/**
|
|
@@ -25071,9 +25180,10 @@ function getSegmentParams(rawChannel) {
|
|
|
25071
25180
|
localLastMentionSegment: 0,
|
|
25072
25181
|
};
|
|
25073
25182
|
}
|
|
25074
|
-
const prepareChannelPayload = (
|
|
25075
|
-
const channels =
|
|
25076
|
-
|
|
25183
|
+
const prepareChannelPayload = (rawPayload) => {
|
|
25184
|
+
const channels = rawPayload.channels.map(channel => convertFromRaw$1(channel, getSegmentParams(channel)));
|
|
25185
|
+
const channelUsers = withUsers(rawPayload.channelUsers);
|
|
25186
|
+
return Object.assign(Object.assign({}, rawPayload), { channels, channelUsers });
|
|
25077
25187
|
};
|
|
25078
25188
|
|
|
25079
25189
|
/**
|
|
@@ -25445,8 +25555,7 @@ const queryChannelMembers = async (query) => {
|
|
|
25445
25555
|
} }),
|
|
25446
25556
|
});
|
|
25447
25557
|
const { paging } = queryPayload, payload = __rest(queryPayload, ["paging"]);
|
|
25448
|
-
const
|
|
25449
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
25558
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25450
25559
|
const { channelUsers } = preparedPayload;
|
|
25451
25560
|
const cachedAt = client.cache && Date.now();
|
|
25452
25561
|
if (client.cache) {
|
|
@@ -25529,13 +25638,13 @@ const addChannelMembers = async (channelId, userIds) => {
|
|
|
25529
25638
|
const client = getActiveClient();
|
|
25530
25639
|
client.log('channel/addChannelMembers', channelId, userIds);
|
|
25531
25640
|
const { data: payload } = await client.http.post(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, { channelId, userIds });
|
|
25532
|
-
const data = prepareChannelPayload(payload);
|
|
25533
|
-
if (client.cache)
|
|
25534
|
-
ingestInCache(data);
|
|
25535
25641
|
/*
|
|
25536
25642
|
* should fire event for each user that was added
|
|
25537
25643
|
*/
|
|
25538
|
-
userIds.forEach(id => fireEvent('channel.membersAdded', Object.assign(Object.assign({}, payload), { channelUsers:
|
|
25644
|
+
userIds.forEach(id => fireEvent('channel.membersAdded', Object.assign(Object.assign({}, payload), { channelUsers: payload.channelUsers.filter(u => u.userId === id) })));
|
|
25645
|
+
const data = prepareChannelPayload(payload);
|
|
25646
|
+
if (client.cache)
|
|
25647
|
+
ingestInCache(data);
|
|
25539
25648
|
const { channelUsers } = data;
|
|
25540
25649
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership === 'member');
|
|
25541
25650
|
};
|
|
@@ -25559,13 +25668,13 @@ const removeChannelMembers = async (channelId, userIds) => {
|
|
|
25559
25668
|
const client = getActiveClient();
|
|
25560
25669
|
client.log('channel/removeChannelMembers', channelId, userIds);
|
|
25561
25670
|
const { data: payload } = await client.http.delete(`/api/v3/channels/${encodeURIComponent(channelId)}/users`, { data: { channelId, userIds } });
|
|
25562
|
-
const data = prepareChannelPayload(payload);
|
|
25563
|
-
if (client.cache)
|
|
25564
|
-
ingestInCache(data);
|
|
25565
25671
|
/*
|
|
25566
25672
|
* should fire event for each user that was removed
|
|
25567
25673
|
*/
|
|
25568
|
-
userIds.forEach(id => fireEvent('channel.membersRemoved', Object.assign(Object.assign({}, payload), { channelUsers:
|
|
25674
|
+
userIds.forEach(id => fireEvent('channel.membersRemoved', Object.assign(Object.assign({}, payload), { channelUsers: payload.channelUsers.filter(u => u.userId === id) })));
|
|
25675
|
+
const data = prepareChannelPayload(payload);
|
|
25676
|
+
if (client.cache)
|
|
25677
|
+
ingestInCache(data);
|
|
25569
25678
|
const { channelUsers } = data;
|
|
25570
25679
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member');
|
|
25571
25680
|
};
|
|
@@ -25644,8 +25753,7 @@ const banChannelMembers = async (channelId, userIds) => {
|
|
|
25644
25753
|
const { data: payload } = await client.http.put(`/api/v3/channels/${channelId}/users/ban`, {
|
|
25645
25754
|
userIds,
|
|
25646
25755
|
});
|
|
25647
|
-
const
|
|
25648
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
25756
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25649
25757
|
const { channelUsers } = preparedPayload;
|
|
25650
25758
|
const cachedAt = client.cache && Date.now();
|
|
25651
25759
|
if (client.cache)
|
|
@@ -25676,8 +25784,7 @@ const unbanChannelMembers = async (channelId, userIds) => {
|
|
|
25676
25784
|
const { data: payload } = await client.http.put(`/api/v3/channels/${encodeURIComponent(channelId)}/users/unban`, {
|
|
25677
25785
|
userIds,
|
|
25678
25786
|
});
|
|
25679
|
-
const
|
|
25680
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
25787
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25681
25788
|
const cachedAt = client.cache && Date.now();
|
|
25682
25789
|
if (client.cache)
|
|
25683
25790
|
ingestInCache(preparedPayload, { cachedAt });
|
|
@@ -25861,8 +25968,7 @@ const onChannelDeleted = (callback) => {
|
|
|
25861
25968
|
const onChannelJoined = (callback) => {
|
|
25862
25969
|
const client = getActiveClient();
|
|
25863
25970
|
const filter = (payload) => {
|
|
25864
|
-
const
|
|
25865
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
25971
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25866
25972
|
const { channels, channelUsers } = preparedPayload;
|
|
25867
25973
|
ingestInCache(preparedPayload);
|
|
25868
25974
|
callback(channels[0], channelUsers[0]);
|
|
@@ -25888,8 +25994,7 @@ const onChannelJoined = (callback) => {
|
|
|
25888
25994
|
const onChannelLeft = (callback) => {
|
|
25889
25995
|
const client = getActiveClient();
|
|
25890
25996
|
const filter = (payload) => {
|
|
25891
|
-
const
|
|
25892
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
25997
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25893
25998
|
const { channels, channelUsers } = preparedPayload;
|
|
25894
25999
|
ingestInCache(preparedPayload);
|
|
25895
26000
|
callback(channels[0], channelUsers[0]);
|
|
@@ -25940,8 +26045,7 @@ const onChannelMuted = (callback) => {
|
|
|
25940
26045
|
const onChannelMemberAdded = (callback) => {
|
|
25941
26046
|
const client = getActiveClient();
|
|
25942
26047
|
const filter = (payload) => {
|
|
25943
|
-
const
|
|
25944
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
26048
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25945
26049
|
const { channels, channelUsers } = preparedPayload;
|
|
25946
26050
|
ingestInCache(preparedPayload);
|
|
25947
26051
|
callback(channels[0], channelUsers.find(cu => cu.membership === 'member'));
|
|
@@ -25967,8 +26071,7 @@ const onChannelMemberAdded = (callback) => {
|
|
|
25967
26071
|
const onChannelMemberRemoved = (callback) => {
|
|
25968
26072
|
const client = getActiveClient();
|
|
25969
26073
|
const filter = (payload) => {
|
|
25970
|
-
const
|
|
25971
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
26074
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25972
26075
|
const { channels, channelUsers } = preparedPayload;
|
|
25973
26076
|
ingestInCache(preparedPayload);
|
|
25974
26077
|
callback(channels[0], channelUsers[0]);
|
|
@@ -25994,8 +26097,7 @@ const onChannelMemberRemoved = (callback) => {
|
|
|
25994
26097
|
const onChannelMemberBanned = (callback) => {
|
|
25995
26098
|
const client = getActiveClient();
|
|
25996
26099
|
const filter = (payload) => {
|
|
25997
|
-
const
|
|
25998
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
26100
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
25999
26101
|
const { channels, channelUsers } = preparedPayload;
|
|
26000
26102
|
ingestInCache(preparedPayload);
|
|
26001
26103
|
callback(channels[0], channelUsers.find(cu => cu.membership === 'banned'));
|
|
@@ -26021,8 +26123,7 @@ const onChannelMemberBanned = (callback) => {
|
|
|
26021
26123
|
const onChannelMemberUnbanned = (callback) => {
|
|
26022
26124
|
const client = getActiveClient();
|
|
26023
26125
|
const filter = (payload) => {
|
|
26024
|
-
const
|
|
26025
|
-
const preparedPayload = prepareMembershipPayload(channelPayload, 'channelUsers');
|
|
26126
|
+
const preparedPayload = prepareChannelPayload(payload);
|
|
26026
26127
|
const { channels, channelUsers } = preparedPayload;
|
|
26027
26128
|
ingestInCache(preparedPayload);
|
|
26028
26129
|
callback(channels[0], channelUsers.find(cu => cu.membership === 'none'));
|
|
@@ -27391,7 +27492,7 @@ const observeMessages = (subChannelId, callback) => {
|
|
|
27391
27492
|
const createCommunityEventSubscriber = (event, callback) => {
|
|
27392
27493
|
const client = getActiveClient();
|
|
27393
27494
|
const filter = (payload) => {
|
|
27394
|
-
const unpackedPayload =
|
|
27495
|
+
const unpackedPayload = prepareCommunityPayload(payload);
|
|
27395
27496
|
if (!client.cache) {
|
|
27396
27497
|
// TODO: here we are missing specific properties here!
|
|
27397
27498
|
callback(unpackedPayload.communities[0]);
|
|
@@ -27461,10 +27562,8 @@ function getEventRelatedMember(event, payload) {
|
|
|
27461
27562
|
const createCommunityMemberEventSubscriber = (event, callback) => {
|
|
27462
27563
|
const client = getActiveClient();
|
|
27463
27564
|
const filter = (payload) => {
|
|
27464
|
-
const
|
|
27465
|
-
const { communities } =
|
|
27466
|
-
const preparedPayload = prepareMembershipPayload(communityPayload, 'communityUsers');
|
|
27467
|
-
const { communityUsers } = preparedPayload;
|
|
27565
|
+
const preparedPayload = prepareCommunityPayload(payload);
|
|
27566
|
+
const { communities, communityUsers } = preparedPayload;
|
|
27468
27567
|
/*
|
|
27469
27568
|
* community.isJoined is not part of the communityMembership payload, and needs
|
|
27470
27569
|
* to be calculated based on the communityMembership value
|
|
@@ -27663,6 +27762,40 @@ const onCommunityUserBanned = (callback) => createCommunityMemberEventSubscriber
|
|
|
27663
27762
|
*/
|
|
27664
27763
|
const onCommunityUserUnbanned = (callback) => createCommunityMemberEventSubscriber('community.userUnbanned', callback);
|
|
27665
27764
|
|
|
27765
|
+
/**
|
|
27766
|
+
* ```js
|
|
27767
|
+
* import { onCommunityUserRoleAdded } from '@amityco/ts-sdk'
|
|
27768
|
+
* const dispose = onCommunityUserRoleAdded((community, member) => {
|
|
27769
|
+
* // ...
|
|
27770
|
+
* })
|
|
27771
|
+
* ```
|
|
27772
|
+
*
|
|
27773
|
+
* Fired when a role has been added to {@link Amity.CommunityUser}
|
|
27774
|
+
*
|
|
27775
|
+
* @param callback The function to call when the event was fired
|
|
27776
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
27777
|
+
*
|
|
27778
|
+
* @category Community Events
|
|
27779
|
+
*/
|
|
27780
|
+
const onCommunityUserRoleAdded = (callback) => createCommunityMemberEventSubscriber('community.roleAdded', callback);
|
|
27781
|
+
|
|
27782
|
+
/**
|
|
27783
|
+
* ```js
|
|
27784
|
+
* import { onCommunityUserRoleRemoved } from '@amityco/ts-sdk'
|
|
27785
|
+
* const dispose = onCommunityUserRoleRemoved((community, member) => {
|
|
27786
|
+
* // ...
|
|
27787
|
+
* })
|
|
27788
|
+
* ```
|
|
27789
|
+
*
|
|
27790
|
+
* Fired when a role has been removed from {@link Amity.CommunityUser}
|
|
27791
|
+
*
|
|
27792
|
+
* @param callback The function to call when the event was fired
|
|
27793
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
27794
|
+
*
|
|
27795
|
+
* @category Community Events
|
|
27796
|
+
*/
|
|
27797
|
+
const onCommunityUserRoleRemoved = (callback) => createCommunityMemberEventSubscriber('community.roleRemoved', callback);
|
|
27798
|
+
|
|
27666
27799
|
/**
|
|
27667
27800
|
* ```js
|
|
27668
27801
|
* import { observeCommunity } from '@amityco/ts-sdk'
|
|
@@ -27823,6 +27956,149 @@ const liveCommunities = (params, callback, config) => {
|
|
|
27823
27956
|
};
|
|
27824
27957
|
};
|
|
27825
27958
|
|
|
27959
|
+
/**
|
|
27960
|
+
* ```js
|
|
27961
|
+
* import { liveCommunity } from '@amityco/ts-sdk';
|
|
27962
|
+
*
|
|
27963
|
+
* let community;
|
|
27964
|
+
*
|
|
27965
|
+
* const unsubscribe = liveCommunity(communityId, response => {
|
|
27966
|
+
* community = response.data;
|
|
27967
|
+
* });
|
|
27968
|
+
* ```
|
|
27969
|
+
*
|
|
27970
|
+
* Observe all mutation on a given {@link Amity.Community}
|
|
27971
|
+
*
|
|
27972
|
+
* @param communityId the ID of the message to observe
|
|
27973
|
+
* @param callback the function to call when new data are available
|
|
27974
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the community
|
|
27975
|
+
*
|
|
27976
|
+
* @category Community Live Object
|
|
27977
|
+
*/
|
|
27978
|
+
const liveCommunity = (communityId, callback) => {
|
|
27979
|
+
return liveObject(communityId, callback, 'communityId', getCommunity, [
|
|
27980
|
+
onCommunityUpdated,
|
|
27981
|
+
onCommunityDeleted,
|
|
27982
|
+
onCommunityJoined,
|
|
27983
|
+
onCommunityLeft,
|
|
27984
|
+
onCommunityUserBanned,
|
|
27985
|
+
onCommunityUserUnbanned,
|
|
27986
|
+
onCommunityUserChanged,
|
|
27987
|
+
]);
|
|
27988
|
+
};
|
|
27989
|
+
|
|
27990
|
+
/**
|
|
27991
|
+
* ```js
|
|
27992
|
+
* import { liveCommunityMembers } from '@amityco/ts-sdk'
|
|
27993
|
+
*
|
|
27994
|
+
* let communityMembers = []
|
|
27995
|
+
* const unsub = liveCommunityMembers({
|
|
27996
|
+
* communityId: Amity.Community['communityId'],
|
|
27997
|
+
* }, response => merge(communityMembers, response.data))
|
|
27998
|
+
* ```
|
|
27999
|
+
*
|
|
28000
|
+
* Observe all mutations on a list of {@link Amity.CommunityUser}s
|
|
28001
|
+
*
|
|
28002
|
+
* @param params for querying community users
|
|
28003
|
+
* @param callback the function to call when new data are available
|
|
28004
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the community users
|
|
28005
|
+
*
|
|
28006
|
+
* @category Community Live Collection
|
|
28007
|
+
*/
|
|
28008
|
+
const liveCommunityMembers = (params, callback, config) => {
|
|
28009
|
+
const { log, cache } = getActiveClient();
|
|
28010
|
+
if (!cache) {
|
|
28011
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
28012
|
+
}
|
|
28013
|
+
const timestamp = Date.now();
|
|
28014
|
+
log(`liveCommunityMembers(tmpid: ${timestamp}) > listen`);
|
|
28015
|
+
const { limit: queryLimit } = params, queryParams = __rest(params, ["limit"]);
|
|
28016
|
+
const limit = queryLimit !== null && queryLimit !== void 0 ? queryLimit : COLLECTION_DEFAULT_PAGINATION_LIMIT;
|
|
28017
|
+
const { policy = COLLECTION_DEFAULT_CACHING_POLICY } = config !== null && config !== void 0 ? config : {};
|
|
28018
|
+
const disposers = [];
|
|
28019
|
+
const cacheKey = ['communityUsers', 'collection', { communityId: params.communityId }];
|
|
28020
|
+
const responder = (data) => {
|
|
28021
|
+
var _a, _b;
|
|
28022
|
+
let communityMembers = (_a = data.data
|
|
28023
|
+
.map(id => pullFromCache(['communityUsers', 'get', id]))
|
|
28024
|
+
.filter(Boolean)
|
|
28025
|
+
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
28026
|
+
if (params.roles)
|
|
28027
|
+
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); }); });
|
|
28028
|
+
if (params.membership) {
|
|
28029
|
+
communityMembers = communityMembers.filter(({ communityMembership }) =>
|
|
28030
|
+
// @ts-ignore
|
|
28031
|
+
params.membership.includes(communityMembership));
|
|
28032
|
+
}
|
|
28033
|
+
if (params.search) {
|
|
28034
|
+
/*
|
|
28035
|
+
* Search by userId | displayName
|
|
28036
|
+
*/
|
|
28037
|
+
const containsMatcher = new RegExp(params.search);
|
|
28038
|
+
communityMembers = communityMembers.filter(m => {
|
|
28039
|
+
var _a;
|
|
28040
|
+
if (m.userId.match(containsMatcher))
|
|
28041
|
+
return true;
|
|
28042
|
+
return m.user && ((_a = m.user.displayName) === null || _a === void 0 ? void 0 : _a.match(containsMatcher));
|
|
28043
|
+
});
|
|
28044
|
+
}
|
|
28045
|
+
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
28046
|
+
communityMembers = communityMembers.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
28047
|
+
callback({
|
|
28048
|
+
onNextPage: onFetch,
|
|
28049
|
+
data: communityMembers,
|
|
28050
|
+
hasNextPage: !!((_b = data.params) === null || _b === void 0 ? void 0 : _b.page),
|
|
28051
|
+
loading: data.loading,
|
|
28052
|
+
error: data.error,
|
|
28053
|
+
});
|
|
28054
|
+
};
|
|
28055
|
+
const realtimeRouter = (_) => (_, communityMember) => {
|
|
28056
|
+
var _a;
|
|
28057
|
+
if (params.communityId !== communityMember.communityId) {
|
|
28058
|
+
return;
|
|
28059
|
+
}
|
|
28060
|
+
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
28061
|
+
if (!collection)
|
|
28062
|
+
return;
|
|
28063
|
+
const communityMemberCacheId = getResolver('communityUsers')({
|
|
28064
|
+
communityId: params.communityId,
|
|
28065
|
+
userId: communityMember.userId,
|
|
28066
|
+
});
|
|
28067
|
+
collection.data = [...new Set([communityMemberCacheId, ...collection.data])];
|
|
28068
|
+
pushToCache(cacheKey, collection);
|
|
28069
|
+
responder(collection);
|
|
28070
|
+
};
|
|
28071
|
+
const onFetch = () => {
|
|
28072
|
+
var _a, _b, _c;
|
|
28073
|
+
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
28074
|
+
const communityMembers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
28075
|
+
if (communityMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
28076
|
+
return;
|
|
28077
|
+
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 } }));
|
|
28078
|
+
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
28079
|
+
const data = {
|
|
28080
|
+
loading,
|
|
28081
|
+
error,
|
|
28082
|
+
params: { page },
|
|
28083
|
+
data: communityMembers,
|
|
28084
|
+
};
|
|
28085
|
+
if (result) {
|
|
28086
|
+
data.data = [
|
|
28087
|
+
...new Set([...communityMembers, ...result.map(getResolver('communityUsers'))]),
|
|
28088
|
+
];
|
|
28089
|
+
}
|
|
28090
|
+
pushToCache(cacheKey, data);
|
|
28091
|
+
responder(data);
|
|
28092
|
+
}, queryOptions(policy));
|
|
28093
|
+
};
|
|
28094
|
+
disposers.push(onCommunityLeft(realtimeRouter()), onCommunityJoined(realtimeRouter()), onCommunityUserBanned(realtimeRouter()), onCommunityUserUnbanned(realtimeRouter()), onCommunityUserChanged(realtimeRouter()), onCommunityUserRoleAdded(realtimeRouter()), onCommunityUserRoleRemoved(realtimeRouter()));
|
|
28095
|
+
onFetch();
|
|
28096
|
+
return () => {
|
|
28097
|
+
log(`liveCommunityMembers(tmpid: ${timestamp}) > dispose`);
|
|
28098
|
+
disposers.forEach(fn => fn());
|
|
28099
|
+
};
|
|
28100
|
+
};
|
|
28101
|
+
|
|
27826
28102
|
/**
|
|
27827
28103
|
* ```js
|
|
27828
28104
|
* import { queryCategories } from '@amityco/ts-sdk'
|
|
@@ -28059,16 +28335,17 @@ const queryGlobalFeed = async (query) => {
|
|
|
28059
28335
|
const client = getActiveClient();
|
|
28060
28336
|
client.log('feed/queryGlobalFeed', query);
|
|
28061
28337
|
const _a = query !== null && query !== void 0 ? query : {}, { useCustomRanking, page } = _a, params = __rest(_a, ["useCustomRanking", "page"]);
|
|
28062
|
-
const { data } = await client.http.get(useCustomRanking ? `/api/v5/me/global-feeds` : `/api/v4/me/global-feeds`, {
|
|
28338
|
+
const { data: queryPayload } = await client.http.get(useCustomRanking ? `/api/v5/me/global-feeds` : `/api/v4/me/global-feeds`, {
|
|
28063
28339
|
params: Object.assign(Object.assign({}, params), { options: {
|
|
28064
28340
|
token: toToken(page, 'skiplimit'),
|
|
28065
28341
|
} }),
|
|
28066
28342
|
});
|
|
28067
|
-
const { paging } =
|
|
28068
|
-
const
|
|
28343
|
+
const { paging } = queryPayload, payload = __rest(queryPayload, ["paging"]);
|
|
28344
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
28345
|
+
const { posts } = data;
|
|
28069
28346
|
const cachedAt = client.cache && Date.now();
|
|
28070
28347
|
if (client.cache) {
|
|
28071
|
-
ingestInCache(
|
|
28348
|
+
ingestInCache(data);
|
|
28072
28349
|
const cacheKey = [
|
|
28073
28350
|
'globalFeed',
|
|
28074
28351
|
'query',
|
|
@@ -29898,4 +30175,4 @@ const createUserToken = async (apiKey, apiRegion, params) => {
|
|
|
29898
30175
|
return { accessToken: data.accessToken };
|
|
29899
30176
|
};
|
|
29900
30177
|
|
|
29901
|
-
export { API_REGIONS, CommunityPostSettingMaps, CommunityPostSettings, ContentFeedType, DefaultCommunityPostSetting, FileType, MessageContentType, PostContentType, SubscriptionLevels, VERSION
|
|
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 };
|