@amityco/ts-sdk 7.17.1-ff8249dd.0 → 7.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/domains/community.d.ts +2 -0
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/cache/api/ingestInCache.d.ts.map +1 -1
- package/dist/client/api/setupLoginSubscriptions.d.ts.map +1 -1
- package/dist/commentRepository/api/tests/integration/createComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/createComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/deleteComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/deleteComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/flagComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/flagComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/getComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/getComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/getCommentByIds.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/getCommentByIds.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/getComments.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/getComments.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/hardDeleteComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/hardDeleteComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/isCommentFlaggedByMe.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/isCommentFlaggedByMe.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/queryComments.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/queryComments.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/softDeleteComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/softDeleteComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/unflagComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/unflagComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/api/tests/integration/updateComment.integration.test.d.ts +2 -0
- package/dist/commentRepository/api/tests/integration/updateComment.integration.test.d.ts.map +1 -0
- package/dist/commentRepository/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersPaginationController.d.ts.map +1 -1
- package/dist/index.cjs.js +217 -75
- package/dist/index.esm.js +217 -75
- package/dist/index.umd.js +3 -3
- package/dist/postRepository/api/tests/integration/pinProduct.integration.test.d.ts +2 -0
- package/dist/postRepository/api/tests/integration/pinProduct.integration.test.d.ts.map +1 -0
- package/dist/postRepository/api/tests/integration/setup.d.ts +2 -0
- package/dist/postRepository/api/tests/integration/setup.d.ts.map +1 -1
- package/dist/postRepository/api/tests/integration/unpinProduct.integration.test.d.ts +2 -0
- package/dist/postRepository/api/tests/integration/unpinProduct.integration.test.d.ts.map +1 -0
- package/dist/postRepository/api/tests/integration/updateProductTags.integration.test.d.ts +2 -0
- package/dist/postRepository/api/tests/integration/updateProductTags.integration.test.d.ts.map +1 -0
- package/dist/productRepository/tests/integration/productAnalytics.integration.test.d.ts +2 -0
- package/dist/productRepository/tests/integration/productAnalytics.integration.test.d.ts.map +1 -0
- package/dist/roomRepository/api/tests/integration/setup.d.ts +11 -0
- package/dist/roomRepository/api/tests/integration/setup.d.ts.map +1 -0
- package/dist/roomRepository/api/tests/integration/updateCohostPermission.integration.test.d.ts +2 -0
- package/dist/roomRepository/api/tests/integration/updateCohostPermission.integration.test.d.ts.map +1 -0
- package/dist/userRepository/api/getAllBlockedUsers.d.ts +17 -0
- package/dist/userRepository/api/getAllBlockedUsers.d.ts.map +1 -0
- package/dist/userRepository/api/index.d.ts +1 -1
- package/dist/userRepository/api/index.d.ts.map +1 -1
- package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngine.d.ts +55 -0
- package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngine.d.ts.map +1 -0
- package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngineOnLoginHandler.d.ts +3 -0
- package/dist/userRepository/services/BlockedUserSyncEngine/blockedUserSyncEngineOnLoginHandler.d.ts.map +1 -0
- package/package.json +3 -2
- package/dist/userRepository/api/getBlockedUsersList.d.ts +0 -22
- package/dist/userRepository/api/getBlockedUsersList.d.ts.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -242,8 +242,8 @@ var AnalyticsSourceTypeEnum;
|
|
|
242
242
|
|
|
243
243
|
function getVersion() {
|
|
244
244
|
try {
|
|
245
|
-
// the string ''v7.
|
|
246
|
-
return 'v7.
|
|
245
|
+
// the string ''v7.18.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
246
|
+
return 'v7.18.0-esm';
|
|
247
247
|
}
|
|
248
248
|
catch (error) {
|
|
249
249
|
return '__dev__';
|
|
@@ -1833,13 +1833,13 @@ class NetworkActivitiesWatcher {
|
|
|
1833
1833
|
this._listener.clear();
|
|
1834
1834
|
}
|
|
1835
1835
|
}
|
|
1836
|
-
let instance$
|
|
1836
|
+
let instance$9;
|
|
1837
1837
|
var NetworkActivitiesWatcher$1 = {
|
|
1838
1838
|
getInstance: () => {
|
|
1839
|
-
if (!instance$
|
|
1840
|
-
instance$
|
|
1839
|
+
if (!instance$9) {
|
|
1840
|
+
instance$9 = new NetworkActivitiesWatcher();
|
|
1841
1841
|
}
|
|
1842
|
-
return instance$
|
|
1842
|
+
return instance$9;
|
|
1843
1843
|
},
|
|
1844
1844
|
};
|
|
1845
1845
|
|
|
@@ -20955,6 +20955,8 @@ const ingestInCache = (payload = {}, options, replace = true) => {
|
|
|
20955
20955
|
const resolver = getResolver(type);
|
|
20956
20956
|
if (!resolver)
|
|
20957
20957
|
return;
|
|
20958
|
+
if (!models)
|
|
20959
|
+
return;
|
|
20958
20960
|
models.forEach(model => {
|
|
20959
20961
|
(replace ? pushToCache : upsertInCache)([type, 'get', resolver(model)], model, options);
|
|
20960
20962
|
});
|
|
@@ -23005,13 +23007,13 @@ class SessionWatcher {
|
|
|
23005
23007
|
this._listener.clear();
|
|
23006
23008
|
}
|
|
23007
23009
|
}
|
|
23008
|
-
let instance$
|
|
23010
|
+
let instance$8;
|
|
23009
23011
|
var SessionWatcher$1 = {
|
|
23010
23012
|
getInstance: () => {
|
|
23011
|
-
if (!instance$
|
|
23012
|
-
instance$
|
|
23013
|
+
if (!instance$8) {
|
|
23014
|
+
instance$8 = new SessionWatcher();
|
|
23013
23015
|
}
|
|
23014
|
-
return instance$
|
|
23016
|
+
return instance$8;
|
|
23015
23017
|
},
|
|
23016
23018
|
};
|
|
23017
23019
|
|
|
@@ -24073,13 +24075,13 @@ class AnalyticsEngine {
|
|
|
24073
24075
|
this._eventCapturer.resetAllBuckets();
|
|
24074
24076
|
}
|
|
24075
24077
|
}
|
|
24076
|
-
let instance$
|
|
24078
|
+
let instance$7;
|
|
24077
24079
|
var AnalyticsEngine$1 = {
|
|
24078
24080
|
getInstance: () => {
|
|
24079
|
-
if (!instance$
|
|
24080
|
-
instance$
|
|
24081
|
+
if (!instance$7) {
|
|
24082
|
+
instance$7 = new AnalyticsEngine();
|
|
24081
24083
|
}
|
|
24082
|
-
return instance$
|
|
24084
|
+
return instance$7;
|
|
24083
24085
|
},
|
|
24084
24086
|
};
|
|
24085
24087
|
|
|
@@ -24307,12 +24309,12 @@ class MessageReadReceiptSyncEngine {
|
|
|
24307
24309
|
}
|
|
24308
24310
|
}
|
|
24309
24311
|
}
|
|
24310
|
-
let instance$
|
|
24312
|
+
let instance$6 = null;
|
|
24311
24313
|
var ReadReceiptSyncEngine = {
|
|
24312
24314
|
getInstance: () => {
|
|
24313
|
-
if (!instance$
|
|
24314
|
-
instance$
|
|
24315
|
-
return instance$
|
|
24315
|
+
if (!instance$6)
|
|
24316
|
+
instance$6 = new MessageReadReceiptSyncEngine();
|
|
24317
|
+
return instance$6;
|
|
24316
24318
|
},
|
|
24317
24319
|
};
|
|
24318
24320
|
|
|
@@ -24566,12 +24568,12 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
24566
24568
|
}
|
|
24567
24569
|
}
|
|
24568
24570
|
}
|
|
24569
|
-
let instance$
|
|
24571
|
+
let instance$5 = null;
|
|
24570
24572
|
var LegacyReadReceiptSyncEngine = {
|
|
24571
24573
|
getInstance: () => {
|
|
24572
|
-
if (!instance$
|
|
24573
|
-
instance$
|
|
24574
|
-
return instance$
|
|
24574
|
+
if (!instance$5)
|
|
24575
|
+
instance$5 = new LegacyMessageReadReceiptSyncEngine();
|
|
24576
|
+
return instance$5;
|
|
24575
24577
|
},
|
|
24576
24578
|
};
|
|
24577
24579
|
|
|
@@ -24817,12 +24819,12 @@ class ObjectResolverEngine {
|
|
|
24817
24819
|
this.stopResolver();
|
|
24818
24820
|
}
|
|
24819
24821
|
}
|
|
24820
|
-
let instance$
|
|
24822
|
+
let instance$4 = null;
|
|
24821
24823
|
var ObjectResolverEngine$1 = {
|
|
24822
24824
|
getInstance: () => {
|
|
24823
|
-
if (!instance$
|
|
24824
|
-
instance$
|
|
24825
|
-
return instance$
|
|
24825
|
+
if (!instance$4)
|
|
24826
|
+
instance$4 = new ObjectResolverEngine();
|
|
24827
|
+
return instance$4;
|
|
24826
24828
|
},
|
|
24827
24829
|
};
|
|
24828
24830
|
|
|
@@ -24972,13 +24974,13 @@ class LiveReactionSyncEngine {
|
|
|
24972
24974
|
this.stopReactionsSync();
|
|
24973
24975
|
}
|
|
24974
24976
|
}
|
|
24975
|
-
let instance$
|
|
24977
|
+
let instance$3;
|
|
24976
24978
|
var ReactionSyncEngine = {
|
|
24977
24979
|
getInstance: () => {
|
|
24978
|
-
if (!instance$
|
|
24979
|
-
instance$
|
|
24980
|
+
if (!instance$3) {
|
|
24981
|
+
instance$3 = new LiveReactionSyncEngine();
|
|
24980
24982
|
}
|
|
24981
|
-
return instance$
|
|
24983
|
+
return instance$3;
|
|
24982
24984
|
},
|
|
24983
24985
|
};
|
|
24984
24986
|
|
|
@@ -25000,6 +25002,148 @@ var reactionSyncEngineOnLoginHandler = () => {
|
|
|
25000
25002
|
};
|
|
25001
25003
|
};
|
|
25002
25004
|
|
|
25005
|
+
function prepareBlockedUserPayload(response) {
|
|
25006
|
+
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
25007
|
+
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
25008
|
+
const followUser = users.find(user => user.userId === follow.from);
|
|
25009
|
+
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
25010
|
+
}), users: users.map(convertRawUserToInternalUser) });
|
|
25011
|
+
}
|
|
25012
|
+
|
|
25013
|
+
const BLOCK_LIST_LIMIT = 100;
|
|
25014
|
+
const TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
25015
|
+
/**
|
|
25016
|
+
* Session-scoped singleton engine that manages TTL-based fetching and caching
|
|
25017
|
+
* of blocked users. Provides a lazy `ensureFetched()` gate for the
|
|
25018
|
+
* `getAllBlockedUsers()` API.
|
|
25019
|
+
*
|
|
25020
|
+
* Key behaviours:
|
|
25021
|
+
* - `establish()` is a no-op — fetch is lazy, triggered only by consumer call
|
|
25022
|
+
* - `destroy()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
|
|
25023
|
+
* - `ensureFetched()` fetches from server only when cache is expired or never fetched
|
|
25024
|
+
* - `lastFetchedAt` is only updated on successful fetch
|
|
25025
|
+
* - `blockedUserIds` is kept in sync with each successful fetch
|
|
25026
|
+
*
|
|
25027
|
+
* @internal
|
|
25028
|
+
*/
|
|
25029
|
+
class BlockedUserSyncEngine {
|
|
25030
|
+
constructor() {
|
|
25031
|
+
/** Epoch ms of last successful fetch. null = never fetched in this session. */
|
|
25032
|
+
this.lastFetchedAt = null;
|
|
25033
|
+
/** Ordered list of userId strings from the most recent successful fetch. */
|
|
25034
|
+
this.blockedUserIds = [];
|
|
25035
|
+
}
|
|
25036
|
+
// ---------------------------------------------------------------------------
|
|
25037
|
+
// SessionComponent lifecycle
|
|
25038
|
+
// ---------------------------------------------------------------------------
|
|
25039
|
+
/** No-op — fetch is lazy, triggered by consumer calling getAllBlockedUsers(). */
|
|
25040
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25041
|
+
onSessionEstablished() {
|
|
25042
|
+
// intentionally empty
|
|
25043
|
+
}
|
|
25044
|
+
/** Resets state so the next session starts with a cold cache. */
|
|
25045
|
+
onSessionDestroyed() {
|
|
25046
|
+
this.lastFetchedAt = null;
|
|
25047
|
+
this.blockedUserIds = [];
|
|
25048
|
+
}
|
|
25049
|
+
/** No-op for this engine. */
|
|
25050
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25051
|
+
onTokenExpired() {
|
|
25052
|
+
// intentionally empty
|
|
25053
|
+
}
|
|
25054
|
+
// ---------------------------------------------------------------------------
|
|
25055
|
+
// Cache helpers
|
|
25056
|
+
// ---------------------------------------------------------------------------
|
|
25057
|
+
isCacheExpired() {
|
|
25058
|
+
if (this.lastFetchedAt === null)
|
|
25059
|
+
return true;
|
|
25060
|
+
return Date.now() - this.lastFetchedAt > TTL_MS;
|
|
25061
|
+
}
|
|
25062
|
+
// ---------------------------------------------------------------------------
|
|
25063
|
+
// Core fetch gate
|
|
25064
|
+
// ---------------------------------------------------------------------------
|
|
25065
|
+
/**
|
|
25066
|
+
* Ensures the local store is populated with fresh blocked-user data.
|
|
25067
|
+
*
|
|
25068
|
+
* - If the cache is still within the 5-minute TTL window: resolves immediately
|
|
25069
|
+
* (no server call).
|
|
25070
|
+
* - If the cache is expired (or never fetched): fetches from the server,
|
|
25071
|
+
* persists the payload to the cache, and updates `lastFetchedAt`.
|
|
25072
|
+
*
|
|
25073
|
+
* On failure the error propagates to the caller and `lastFetchedAt` is NOT
|
|
25074
|
+
* updated, so the next call will retry.
|
|
25075
|
+
*/
|
|
25076
|
+
async ensureFetched() {
|
|
25077
|
+
if (!this.isCacheExpired())
|
|
25078
|
+
return;
|
|
25079
|
+
const client = getActiveClient();
|
|
25080
|
+
const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options: { limit: BLOCK_LIST_LIMIT }, isDeleted: false } });
|
|
25081
|
+
const cachedAt = client.cache && Date.now();
|
|
25082
|
+
const payload = prepareBlockedUserPayload(data);
|
|
25083
|
+
if (client.cache) {
|
|
25084
|
+
ingestInCache(payload, { cachedAt });
|
|
25085
|
+
}
|
|
25086
|
+
// Keep the ordered list of blocked user IDs for getCachedUsers()
|
|
25087
|
+
this.blockedUserIds = payload.users.map(u => u.userId);
|
|
25088
|
+
// Only update timestamp on success — failure leaves it unchanged so the
|
|
25089
|
+
// next call retries.
|
|
25090
|
+
this.lastFetchedAt = Date.now();
|
|
25091
|
+
}
|
|
25092
|
+
// ---------------------------------------------------------------------------
|
|
25093
|
+
// Local store read
|
|
25094
|
+
// ---------------------------------------------------------------------------
|
|
25095
|
+
/**
|
|
25096
|
+
* Returns blocked {@link Amity.InternalUser} objects from the in-memory cache.
|
|
25097
|
+
*
|
|
25098
|
+
* Applies the spec-mandated filter:
|
|
25099
|
+
* - Only users whose `isDeleted` is false or null
|
|
25100
|
+
* - Hard limit of 100 results
|
|
25101
|
+
*
|
|
25102
|
+
* This always reads the latest local state, so changes made by `blockUser()`
|
|
25103
|
+
* and `unblockUser()` are reflected even within the TTL window.
|
|
25104
|
+
*/
|
|
25105
|
+
getCachedUsers() {
|
|
25106
|
+
const client = getActiveClient();
|
|
25107
|
+
if (!client.cache) {
|
|
25108
|
+
// No cache available — fall back to the in-memory list from the last fetch
|
|
25109
|
+
return [];
|
|
25110
|
+
}
|
|
25111
|
+
return this.blockedUserIds
|
|
25112
|
+
.map(id => { var _a; return (_a = pullFromCache(['user', 'get', id])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
25113
|
+
.filter((user) => user != null && user.isDeleted !== true)
|
|
25114
|
+
.slice(0, BLOCK_LIST_LIMIT);
|
|
25115
|
+
}
|
|
25116
|
+
}
|
|
25117
|
+
// ---------------------------------------------------------------------------
|
|
25118
|
+
// Module-level singleton
|
|
25119
|
+
// ---------------------------------------------------------------------------
|
|
25120
|
+
let instance$2 = null;
|
|
25121
|
+
var BlockedUserSyncEngine$1 = {
|
|
25122
|
+
getInstance: () => {
|
|
25123
|
+
if (!instance$2)
|
|
25124
|
+
instance$2 = new BlockedUserSyncEngine();
|
|
25125
|
+
return instance$2;
|
|
25126
|
+
},
|
|
25127
|
+
};
|
|
25128
|
+
|
|
25129
|
+
var blockedUserSyncEngineOnLoginHandler = () => {
|
|
25130
|
+
const blockedUserSyncEngine = BlockedUserSyncEngine$1.getInstance();
|
|
25131
|
+
onSessionStateChange(state => {
|
|
25132
|
+
if (state === "established" /* Amity.SessionStates.ESTABLISHED */) {
|
|
25133
|
+
blockedUserSyncEngine.onSessionEstablished();
|
|
25134
|
+
}
|
|
25135
|
+
else if (state === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
|
|
25136
|
+
blockedUserSyncEngine.onTokenExpired();
|
|
25137
|
+
}
|
|
25138
|
+
else {
|
|
25139
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
25140
|
+
}
|
|
25141
|
+
});
|
|
25142
|
+
return () => {
|
|
25143
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
25144
|
+
};
|
|
25145
|
+
};
|
|
25146
|
+
|
|
25003
25147
|
const EVENTS = [
|
|
25004
25148
|
'disconnected',
|
|
25005
25149
|
'error',
|
|
@@ -25165,7 +25309,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
|
|
|
25165
25309
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
25166
25310
|
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
25167
25311
|
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
25168
|
-
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler());
|
|
25312
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler());
|
|
25169
25313
|
if (client.useLegacyUnreadCount) {
|
|
25170
25314
|
subscriptions.push(readReceiptSyncEngineOnLoginHandler());
|
|
25171
25315
|
}
|
|
@@ -29143,7 +29287,7 @@ const getWatchSessionStorage = () => {
|
|
|
29143
29287
|
return storageInstance;
|
|
29144
29288
|
};
|
|
29145
29289
|
|
|
29146
|
-
const privateKey = "
|
|
29290
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHo80SecH7FuF2\nhFYnb+l26/VN8UMLXAQFLnxciNTEwkGVFMpdezlH8rU2HtUJL4RETogbAOLVY0XM\njs6sPn8G1nALmh9qeDpUtVqFOVtBHxEZ910TLOtQiunjqJKO5nWdqZ71EC3OFluR\niGQkO84BiIFbv37ub7xl3S8XarbtKoLcyVpkDHi+1wx1pgCAn6gtBUgckPL5NR8j\nLseabl3HAXQfhTCKo4tmOFM2Dxwl1IUMmIJrJg/aIU/U0tj/1Eoo7mG0JcNWX19l\nW3EecCbi0ncCJOrkUdwlBrcjaMayaX/ubEwyUeTGiLdyc4L3GRLHjyK8xgVNXRMH\nbZWJ2a5NAgMBAAECggEASxuE+35zTFO/XydKgmvIGcWL9FbgMlXb7Vcf0nBoG945\nbiz0NVc2paraIhJXc608xbYF3qLmtAE1MVBI0ORyRdBHNxY024l/6H6SH60Ed+uI\nM4ysp5ourY6Vj+DLwpdRiI9YDjqYAQDIUmhNxJP7XPhOMoZI6st+xZQBM34ic/bv\nAMSJm9OZphSp3+qXVkFZztr2mxD2EZSJJLYxi8BCdgM2qhazalbcJ6zDKHCZWVWm\n8RRxDGldyMb/237JxETzP40tAlzOZDmBAbUgEnurDJ93RVDIE3rbZUshwgeQd18a\nem096mWgvB1AIKYgsTAR3pw+V19YWAjq/glP6fz8wQKBgQD/oQq+ukKF0PRgBeM5\ngeTjSwsdGppQLmf5ndujvoiz/TpdjDEPu6R8kigQr1rG2t4K/yfdZoI8RdmJD1al\n3Q7N9hofooSy4rj6E3txzWZCHJjHad2cnCp/O26HiReGAl7wTcfTmNdiFHhZQzm5\nJBkvWAiwuvQMNfEbnXxw6/vIDwKBgQDH7fX8gsc77JLvAWgp1MaQN/sbqVb6JeT1\nFQfR8E/WFCSmzQBtNzd5KgYuCeelwr/8DyYytvN2BzCYZXp73gI1jF3YlW5jVn74\nOY6TwQ095digwo6Z0yuxopdIOApKgAkL9PRKgNrqAf3NAyMua6lOGifzjDojC3KU\nfylQmxMn4wKBgHp2B9O/H0dEBw5JQ8W0+JX6yWQz7mEjGiR2/1W+XXb8hQ1zr709\nw1r6Gb+EghRpnZ3fBpYGGbYOMFx8wKHM+N6qW3F0ReX8v2juFGE8aRSa5oYBrWzt\nU16Idjbv8hj84cZ1PJmdyvDtpYn9rpWHOZl4rxEbPvbqkIsOMyNVqdT5AoGAOSge\nmwIIU2le2FVeohbibXiToWTYKMuMmURZ5/r72AgKMmWJKbAPe+Q3wBG01/7FRBpQ\noU8Ma0HC8s6QJbliiEyIx9JwrJWd1vkdecBHONrtA4ibm/5zD2WcOllLF+FitLhi\n3qnX6+6F0IaFGFBPJrTzlv0P4dTz/OAdv52V7GECgYEA2TttOKBAqWllgOaZOkql\nLVMJVmgR7s6tLi1+cEP8ZcapV9aRbRzTAKXm4f8AEhtlG9F9kCOvHYCYGi6JaiWJ\nZkHjeex3T+eE6Di6y5Bm/Ift5jtVhJ4jCVwHOKTMej79NPUFTJfv8hCo29haBDv6\nRXFrv+T21KCcw8k3sJeJWWQ=\n-----END PRIVATE KEY-----";
|
|
29147
29291
|
/*
|
|
29148
29292
|
* The crypto algorithm used for importing key and signing string
|
|
29149
29293
|
*/
|
|
@@ -31654,56 +31798,32 @@ const isUserFlaggedByMe = async (userId) => {
|
|
|
31654
31798
|
};
|
|
31655
31799
|
/* end_public_function */
|
|
31656
31800
|
|
|
31657
|
-
function prepareBlockedUserPayload(response) {
|
|
31658
|
-
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
31659
|
-
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
31660
|
-
const followUser = users.find(user => user.userId === follow.from);
|
|
31661
|
-
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
31662
|
-
}), users: users.map(convertRawUserToInternalUser) });
|
|
31663
|
-
}
|
|
31664
|
-
|
|
31665
|
-
const BLOCK_LIST_DEFAULT_PAGE_LIMIT = 100;
|
|
31666
31801
|
/* begin_public_function
|
|
31667
|
-
id: user.
|
|
31802
|
+
id: user.get_all_blocked_users
|
|
31668
31803
|
*/
|
|
31669
31804
|
/**
|
|
31670
31805
|
* ```js
|
|
31671
31806
|
* import { UserRepository } from '@amityco/ts-sdk'
|
|
31672
|
-
* const blockedUsers = await UserRepository.
|
|
31673
|
-
* // or with a limit on total results:
|
|
31674
|
-
* const blockedUsers = await UserRepository.getBlockedUsersList({ limit: 3 })
|
|
31807
|
+
* const blockedUsers = await UserRepository.getAllBlockedUsers()
|
|
31675
31808
|
* ```
|
|
31676
31809
|
*
|
|
31677
|
-
*
|
|
31678
|
-
*
|
|
31810
|
+
* Returns all blocked users as a non-paginated list (limit 100) with TTL-based caching (5-minute window).
|
|
31811
|
+
* Within the TTL window, subsequent calls resolve instantly from the local store without any server call.
|
|
31812
|
+
* After the TTL expires, the next call triggers a fresh server fetch.
|
|
31679
31813
|
*
|
|
31680
|
-
* @
|
|
31681
|
-
* @param params.limit Maximum total number of blocked users to return (max: 100). Fetches all if not specified.
|
|
31682
|
-
* @returns Array of blocked {@link Amity.User} objects
|
|
31814
|
+
* @returns A promise that resolves to an array of blocked {@link Amity.User} objects
|
|
31683
31815
|
*
|
|
31684
31816
|
* @category Block API
|
|
31685
31817
|
* @async
|
|
31686
31818
|
*/
|
|
31687
|
-
const
|
|
31688
|
-
const client = getActiveClient();
|
|
31689
|
-
client.log('user/
|
|
31690
|
-
const
|
|
31691
|
-
|
|
31692
|
-
|
|
31693
|
-
|
|
31694
|
-
|
|
31695
|
-
const options = token ? { token } : { limit: remaining };
|
|
31696
|
-
// eslint-disable-next-line no-await-in-loop
|
|
31697
|
-
const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options, isDeleted: false } });
|
|
31698
|
-
const cachedAt = client.cache && Date.now();
|
|
31699
|
-
const payload = prepareBlockedUserPayload(data);
|
|
31700
|
-
if (client.cache) {
|
|
31701
|
-
ingestInCache(payload, { cachedAt });
|
|
31702
|
-
}
|
|
31703
|
-
allUsers.push(...payload.users);
|
|
31704
|
-
token = data.paging.next;
|
|
31705
|
-
} while (token && (maxResults === undefined || allUsers.length < maxResults));
|
|
31706
|
-
return allUsers.map(userLinkedObject);
|
|
31819
|
+
const getAllBlockedUsers = async () => {
|
|
31820
|
+
const client = getActiveClient();
|
|
31821
|
+
client.log('user/getAllBlockedUsers');
|
|
31822
|
+
const engine = BlockedUserSyncEngine$1.getInstance();
|
|
31823
|
+
// Ensure data is fetched (no-op if cache is fresh)
|
|
31824
|
+
await engine.ensureFetched();
|
|
31825
|
+
// Read from the engine's bounded ID list — O(blocked users) not O(cache size)
|
|
31826
|
+
return engine.getCachedUsers();
|
|
31707
31827
|
};
|
|
31708
31828
|
/* end_public_function */
|
|
31709
31829
|
|
|
@@ -32514,7 +32634,7 @@ var index$q = /*#__PURE__*/Object.freeze({
|
|
|
32514
32634
|
flagUser: flagUser,
|
|
32515
32635
|
unflagUser: unflagUser,
|
|
32516
32636
|
isUserFlaggedByMe: isUserFlaggedByMe,
|
|
32517
|
-
|
|
32637
|
+
getAllBlockedUsers: getAllBlockedUsers,
|
|
32518
32638
|
onUserUpdated: onUserUpdated,
|
|
32519
32639
|
onUserDeleted: onUserDeleted$2,
|
|
32520
32640
|
onUserFlagged: onUserFlagged,
|
|
@@ -34194,8 +34314,10 @@ const createLocalCommentEventSubscriber = (event, callback) => {
|
|
|
34194
34314
|
else {
|
|
34195
34315
|
const postCacheKey = ['post', 'get', comments[0].referenceId];
|
|
34196
34316
|
const postCache = (_d = pullFromCache(postCacheKey)) === null || _d === void 0 ? void 0 : _d.data;
|
|
34197
|
-
|
|
34198
|
-
|
|
34317
|
+
if (postCache) {
|
|
34318
|
+
const updatedPost = Object.assign(Object.assign({}, postCache), { comments: postCache === null || postCache === void 0 ? void 0 : postCache.comments.filter(commentId => { var _a; return commentId !== ((_a = comments[0]) === null || _a === void 0 ? void 0 : _a.commentId); }) });
|
|
34319
|
+
pushToCache(postCacheKey, updatedPost);
|
|
34320
|
+
}
|
|
34199
34321
|
}
|
|
34200
34322
|
const queries = (_e = queryCache(['comment', 'query'])) === null || _e === void 0 ? void 0 : _e.filter(({ key }) => { var _a; return ((_a = key[2]) === null || _a === void 0 ? void 0 : _a.referenceId) === comment.data.referenceId; });
|
|
34201
34323
|
queries === null || queries === void 0 ? void 0 : queries.map(({ key, data }) => upsertInCache(key, data, { cachedAt: -1 }));
|
|
@@ -39282,7 +39404,7 @@ const removeMembers = async (communityId, userIds) => {
|
|
|
39282
39404
|
*/
|
|
39283
39405
|
class CommunityMembersPaginationController extends PaginationController {
|
|
39284
39406
|
async getRequest(queryParams, token) {
|
|
39285
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
39407
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles: _excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
39286
39408
|
const options = token ? { token } : { limit };
|
|
39287
39409
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
39288
39410
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -39332,6 +39454,7 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
|
|
|
39332
39454
|
if (!collection)
|
|
39333
39455
|
return;
|
|
39334
39456
|
communityMembers.forEach(communityMember => {
|
|
39457
|
+
var _a;
|
|
39335
39458
|
const communityMemberCacheId = getResolver('communityUsers')({
|
|
39336
39459
|
communityId: this.query.communityId,
|
|
39337
39460
|
userId: communityMember.userId,
|
|
@@ -39340,6 +39463,13 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
|
|
|
39340
39463
|
collection.data = collection.data.filter(m => m !== communityMemberCacheId);
|
|
39341
39464
|
}
|
|
39342
39465
|
else if (!collection.data.includes(communityMemberCacheId)) {
|
|
39466
|
+
// Reactor-level exclusion: prevent excluded items from entering query stream
|
|
39467
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
39468
|
+
const memberRoles = communityMember.roles || [];
|
|
39469
|
+
if (memberRoles.some(role => this.query.excludingRoles.includes(role))) {
|
|
39470
|
+
return; // Skip — don't add to query stream
|
|
39471
|
+
}
|
|
39472
|
+
}
|
|
39343
39473
|
collection.data = [communityMemberCacheId, ...collection.data];
|
|
39344
39474
|
}
|
|
39345
39475
|
});
|
|
@@ -39827,6 +39957,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
39827
39957
|
});
|
|
39828
39958
|
}
|
|
39829
39959
|
applyFilter(data) {
|
|
39960
|
+
var _a;
|
|
39830
39961
|
let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
|
|
39831
39962
|
if (this.query.memberships) {
|
|
39832
39963
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -39834,6 +39965,9 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
39834
39965
|
return memberships.includes(communityMembership);
|
|
39835
39966
|
});
|
|
39836
39967
|
}
|
|
39968
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
39969
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
|
|
39970
|
+
}
|
|
39837
39971
|
if (this.query.includeDeleted === false) {
|
|
39838
39972
|
communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
|
|
39839
39973
|
}
|
|
@@ -39855,6 +39989,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
39855
39989
|
* @hidden
|
|
39856
39990
|
*/
|
|
39857
39991
|
const applyFilter = (data, params) => {
|
|
39992
|
+
var _a;
|
|
39858
39993
|
let communityMembers = filterByPropIntersection(data, 'roles', params.roles);
|
|
39859
39994
|
if (params.memberships) {
|
|
39860
39995
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -39862,6 +39997,9 @@ const applyFilter = (data, params) => {
|
|
|
39862
39997
|
return membership.includes(communityMembership);
|
|
39863
39998
|
});
|
|
39864
39999
|
}
|
|
40000
|
+
if ((_a = params.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
40001
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => params.excludingRoles.includes(role)));
|
|
40002
|
+
}
|
|
39865
40003
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
39866
40004
|
communityMembers = communityMembers.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
39867
40005
|
return communityMembers;
|
|
@@ -39915,7 +40053,7 @@ const getMembers = (params, callback, config) => {
|
|
|
39915
40053
|
*/
|
|
39916
40054
|
class SearchCommunityMembersPaginationController extends PaginationController {
|
|
39917
40055
|
async getRequest(queryParams, token) {
|
|
39918
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
40056
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
39919
40057
|
const options = token ? { token } : { limit };
|
|
39920
40058
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
39921
40059
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -40065,6 +40203,7 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
|
|
|
40065
40203
|
});
|
|
40066
40204
|
}
|
|
40067
40205
|
applyFilter(data) {
|
|
40206
|
+
var _a;
|
|
40068
40207
|
let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
|
|
40069
40208
|
if (this.query.memberships) {
|
|
40070
40209
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -40075,6 +40214,9 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
|
|
|
40075
40214
|
if (this.query.search) {
|
|
40076
40215
|
communityMembers = filterBySearchTerm(communityMembers, this.query.search);
|
|
40077
40216
|
}
|
|
40217
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
40218
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
|
|
40219
|
+
}
|
|
40078
40220
|
if (this.query.includeDeleted === false) {
|
|
40079
40221
|
communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
|
|
40080
40222
|
}
|