@amityco/ts-sdk 7.17.1-1f0ca75.0 → 7.17.1-239ff56.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/client/api/setupLoginSubscriptions.d.ts.map +1 -1
- package/dist/commentRepository/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersPaginationController.d.ts.map +1 -1
- package/dist/index.cjs.js +192 -72
- package/dist/index.esm.js +192 -72
- package/dist/index.umd.js +1 -1
- 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 +1 -1
- package/dist/userRepository/api/getBlockedUsersList.d.ts +0 -22
- package/dist/userRepository/api/getBlockedUsersList.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupLoginSubscriptions.d.ts","sourceRoot":"","sources":["../../../src/client/api/setupLoginSubscriptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setupLoginSubscriptions.d.ts","sourceRoot":"","sources":["../../../src/client/api/setupLoginSubscriptions.ts"],"names":[],"mappings":"AAmBA;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,YAAY,KAAG,MAAM,YAAY,EA4D5F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/utils.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,4BAA4B,UAChC,MAAM,MAAM,iBAAiB,YAC1B,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,uBA0FhD,CAAC;AAEF,eAAO,MAAM,iCAAiC,UACrC,MAAM,KACX,MAAM,kBAAkB,EACxB,2BAA2B,GAAG,8BAA8B,CAC7D,YACS,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/events/utils.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,4BAA4B,UAChC,MAAM,MAAM,iBAAiB,YAC1B,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,uBA0FhD,CAAC;AAEF,eAAO,MAAM,iCAAiC,UACrC,MAAM,KACX,MAAM,kBAAkB,EACxB,2BAA2B,GAAG,8BAA8B,CAC7D,YACS,MAAM,QAAQ,CAAC,MAAM,eAAe,CAAC,uBAqIhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommunityMembersPaginationController.d.ts","sourceRoot":"","sources":["../../../../../src/communityRepository/communityMembership/observers/getMembers/CommunityMembersPaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF;;;GAGG;AACH,qBAAa,oCAAqC,SAAQ,oBAAoB,CAC5E,eAAe,EACf,KAAK,CAAC,6BAA6B,CACpC;IACO,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,6BAA6B,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"CommunityMembersPaginationController.d.ts","sourceRoot":"","sources":["../../../../../src/communityRepository/communityMembership/observers/getMembers/CommunityMembersPaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF;;;GAGG;AACH,qBAAa,oCAAqC,SAAQ,oBAAoB,CAC5E,eAAe,EACf,KAAK,CAAC,6BAA6B,CACpC;IACO,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,6BAA6B,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS;CAsB7F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchCommunityMembersPaginationController.d.ts","sourceRoot":"","sources":["../../../../../src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersPaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF;;;GAGG;AACH,qBAAa,0CAA2C,SAAQ,oBAAoB,CAClF,eAAe,EACf,KAAK,CAAC,mCAAmC,CAC1C;IACO,UAAU,CACd,WAAW,EAAE,KAAK,CAAC,mCAAmC,EACtD,KAAK,EAAE,MAAM,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"SearchCommunityMembersPaginationController.d.ts","sourceRoot":"","sources":["../../../../../src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersPaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF;;;GAGG;AACH,qBAAa,0CAA2C,SAAQ,oBAAoB,CAClF,eAAe,EACf,KAAK,CAAC,mCAAmC,CAC1C;IACO,UAAU,CACd,WAAW,EAAE,KAAK,CAAC,mCAAmC,EACtD,KAAK,EAAE,MAAM,GAAG,SAAS;CAuB5B"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1848,13 +1848,13 @@ class NetworkActivitiesWatcher {
|
|
|
1848
1848
|
this._listener.clear();
|
|
1849
1849
|
}
|
|
1850
1850
|
}
|
|
1851
|
-
let instance$
|
|
1851
|
+
let instance$9;
|
|
1852
1852
|
var NetworkActivitiesWatcher$1 = {
|
|
1853
1853
|
getInstance: () => {
|
|
1854
|
-
if (!instance$
|
|
1855
|
-
instance$
|
|
1854
|
+
if (!instance$9) {
|
|
1855
|
+
instance$9 = new NetworkActivitiesWatcher();
|
|
1856
1856
|
}
|
|
1857
|
-
return instance$
|
|
1857
|
+
return instance$9;
|
|
1858
1858
|
},
|
|
1859
1859
|
};
|
|
1860
1860
|
|
|
@@ -6915,13 +6915,13 @@ class SessionWatcher {
|
|
|
6915
6915
|
this._listener.clear();
|
|
6916
6916
|
}
|
|
6917
6917
|
}
|
|
6918
|
-
let instance$
|
|
6918
|
+
let instance$8;
|
|
6919
6919
|
var SessionWatcher$1 = {
|
|
6920
6920
|
getInstance: () => {
|
|
6921
|
-
if (!instance$
|
|
6922
|
-
instance$
|
|
6921
|
+
if (!instance$8) {
|
|
6922
|
+
instance$8 = new SessionWatcher();
|
|
6923
6923
|
}
|
|
6924
|
-
return instance$
|
|
6924
|
+
return instance$8;
|
|
6925
6925
|
},
|
|
6926
6926
|
};
|
|
6927
6927
|
|
|
@@ -7983,13 +7983,13 @@ class AnalyticsEngine {
|
|
|
7983
7983
|
this._eventCapturer.resetAllBuckets();
|
|
7984
7984
|
}
|
|
7985
7985
|
}
|
|
7986
|
-
let instance$
|
|
7986
|
+
let instance$7;
|
|
7987
7987
|
var AnalyticsEngine$1 = {
|
|
7988
7988
|
getInstance: () => {
|
|
7989
|
-
if (!instance$
|
|
7990
|
-
instance$
|
|
7989
|
+
if (!instance$7) {
|
|
7990
|
+
instance$7 = new AnalyticsEngine();
|
|
7991
7991
|
}
|
|
7992
|
-
return instance$
|
|
7992
|
+
return instance$7;
|
|
7993
7993
|
},
|
|
7994
7994
|
};
|
|
7995
7995
|
|
|
@@ -8217,12 +8217,12 @@ class MessageReadReceiptSyncEngine {
|
|
|
8217
8217
|
}
|
|
8218
8218
|
}
|
|
8219
8219
|
}
|
|
8220
|
-
let instance$
|
|
8220
|
+
let instance$6 = null;
|
|
8221
8221
|
var ReadReceiptSyncEngine = {
|
|
8222
8222
|
getInstance: () => {
|
|
8223
|
-
if (!instance$
|
|
8224
|
-
instance$
|
|
8225
|
-
return instance$
|
|
8223
|
+
if (!instance$6)
|
|
8224
|
+
instance$6 = new MessageReadReceiptSyncEngine();
|
|
8225
|
+
return instance$6;
|
|
8226
8226
|
},
|
|
8227
8227
|
};
|
|
8228
8228
|
|
|
@@ -8476,12 +8476,12 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
8476
8476
|
}
|
|
8477
8477
|
}
|
|
8478
8478
|
}
|
|
8479
|
-
let instance$
|
|
8479
|
+
let instance$5 = null;
|
|
8480
8480
|
var LegacyReadReceiptSyncEngine = {
|
|
8481
8481
|
getInstance: () => {
|
|
8482
|
-
if (!instance$
|
|
8483
|
-
instance$
|
|
8484
|
-
return instance$
|
|
8482
|
+
if (!instance$5)
|
|
8483
|
+
instance$5 = new LegacyMessageReadReceiptSyncEngine();
|
|
8484
|
+
return instance$5;
|
|
8485
8485
|
},
|
|
8486
8486
|
};
|
|
8487
8487
|
|
|
@@ -8727,12 +8727,12 @@ class ObjectResolverEngine {
|
|
|
8727
8727
|
this.stopResolver();
|
|
8728
8728
|
}
|
|
8729
8729
|
}
|
|
8730
|
-
let instance$
|
|
8730
|
+
let instance$4 = null;
|
|
8731
8731
|
var ObjectResolverEngine$1 = {
|
|
8732
8732
|
getInstance: () => {
|
|
8733
|
-
if (!instance$
|
|
8734
|
-
instance$
|
|
8735
|
-
return instance$
|
|
8733
|
+
if (!instance$4)
|
|
8734
|
+
instance$4 = new ObjectResolverEngine();
|
|
8735
|
+
return instance$4;
|
|
8736
8736
|
},
|
|
8737
8737
|
};
|
|
8738
8738
|
|
|
@@ -8882,13 +8882,13 @@ class LiveReactionSyncEngine {
|
|
|
8882
8882
|
this.stopReactionsSync();
|
|
8883
8883
|
}
|
|
8884
8884
|
}
|
|
8885
|
-
let instance$
|
|
8885
|
+
let instance$3;
|
|
8886
8886
|
var ReactionSyncEngine = {
|
|
8887
8887
|
getInstance: () => {
|
|
8888
|
-
if (!instance$
|
|
8889
|
-
instance$
|
|
8888
|
+
if (!instance$3) {
|
|
8889
|
+
instance$3 = new LiveReactionSyncEngine();
|
|
8890
8890
|
}
|
|
8891
|
-
return instance$
|
|
8891
|
+
return instance$3;
|
|
8892
8892
|
},
|
|
8893
8893
|
};
|
|
8894
8894
|
|
|
@@ -8910,6 +8910,148 @@ var reactionSyncEngineOnLoginHandler = () => {
|
|
|
8910
8910
|
};
|
|
8911
8911
|
};
|
|
8912
8912
|
|
|
8913
|
+
function prepareBlockedUserPayload(response) {
|
|
8914
|
+
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
8915
|
+
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
8916
|
+
const followUser = users.find(user => user.userId === follow.from);
|
|
8917
|
+
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
8918
|
+
}), users: users.map(convertRawUserToInternalUser) });
|
|
8919
|
+
}
|
|
8920
|
+
|
|
8921
|
+
const BLOCK_LIST_LIMIT = 100;
|
|
8922
|
+
const TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
8923
|
+
/**
|
|
8924
|
+
* Session-scoped singleton engine that manages TTL-based fetching and caching
|
|
8925
|
+
* of blocked users. Provides a lazy `ensureFetched()` gate for the
|
|
8926
|
+
* `getAllBlockedUsers()` API.
|
|
8927
|
+
*
|
|
8928
|
+
* Key behaviours:
|
|
8929
|
+
* - `establish()` is a no-op — fetch is lazy, triggered only by consumer call
|
|
8930
|
+
* - `destroy()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
|
|
8931
|
+
* - `ensureFetched()` fetches from server only when cache is expired or never fetched
|
|
8932
|
+
* - `lastFetchedAt` is only updated on successful fetch
|
|
8933
|
+
* - `blockedUserIds` is kept in sync with each successful fetch
|
|
8934
|
+
*
|
|
8935
|
+
* @internal
|
|
8936
|
+
*/
|
|
8937
|
+
class BlockedUserSyncEngine {
|
|
8938
|
+
constructor() {
|
|
8939
|
+
/** Epoch ms of last successful fetch. null = never fetched in this session. */
|
|
8940
|
+
this.lastFetchedAt = null;
|
|
8941
|
+
/** Ordered list of userId strings from the most recent successful fetch. */
|
|
8942
|
+
this.blockedUserIds = [];
|
|
8943
|
+
}
|
|
8944
|
+
// ---------------------------------------------------------------------------
|
|
8945
|
+
// SessionComponent lifecycle
|
|
8946
|
+
// ---------------------------------------------------------------------------
|
|
8947
|
+
/** No-op — fetch is lazy, triggered by consumer calling getAllBlockedUsers(). */
|
|
8948
|
+
// eslint-disable-next-line class-methods-use-this
|
|
8949
|
+
onSessionEstablished() {
|
|
8950
|
+
// intentionally empty
|
|
8951
|
+
}
|
|
8952
|
+
/** Resets state so the next session starts with a cold cache. */
|
|
8953
|
+
onSessionDestroyed() {
|
|
8954
|
+
this.lastFetchedAt = null;
|
|
8955
|
+
this.blockedUserIds = [];
|
|
8956
|
+
}
|
|
8957
|
+
/** No-op for this engine. */
|
|
8958
|
+
// eslint-disable-next-line class-methods-use-this
|
|
8959
|
+
onTokenExpired() {
|
|
8960
|
+
// intentionally empty
|
|
8961
|
+
}
|
|
8962
|
+
// ---------------------------------------------------------------------------
|
|
8963
|
+
// Cache helpers
|
|
8964
|
+
// ---------------------------------------------------------------------------
|
|
8965
|
+
isCacheExpired() {
|
|
8966
|
+
if (this.lastFetchedAt === null)
|
|
8967
|
+
return true;
|
|
8968
|
+
return Date.now() - this.lastFetchedAt > TTL_MS;
|
|
8969
|
+
}
|
|
8970
|
+
// ---------------------------------------------------------------------------
|
|
8971
|
+
// Core fetch gate
|
|
8972
|
+
// ---------------------------------------------------------------------------
|
|
8973
|
+
/**
|
|
8974
|
+
* Ensures the local store is populated with fresh blocked-user data.
|
|
8975
|
+
*
|
|
8976
|
+
* - If the cache is still within the 5-minute TTL window: resolves immediately
|
|
8977
|
+
* (no server call).
|
|
8978
|
+
* - If the cache is expired (or never fetched): fetches from the server,
|
|
8979
|
+
* persists the payload to the cache, and updates `lastFetchedAt`.
|
|
8980
|
+
*
|
|
8981
|
+
* On failure the error propagates to the caller and `lastFetchedAt` is NOT
|
|
8982
|
+
* updated, so the next call will retry.
|
|
8983
|
+
*/
|
|
8984
|
+
async ensureFetched() {
|
|
8985
|
+
if (!this.isCacheExpired())
|
|
8986
|
+
return;
|
|
8987
|
+
const client = getActiveClient();
|
|
8988
|
+
const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options: { limit: BLOCK_LIST_LIMIT }, isDeleted: false } });
|
|
8989
|
+
const cachedAt = client.cache && Date.now();
|
|
8990
|
+
const payload = prepareBlockedUserPayload(data);
|
|
8991
|
+
if (client.cache) {
|
|
8992
|
+
ingestInCache(payload, { cachedAt });
|
|
8993
|
+
}
|
|
8994
|
+
// Keep the ordered list of blocked user IDs for getCachedUsers()
|
|
8995
|
+
this.blockedUserIds = payload.users.map(u => u.userId);
|
|
8996
|
+
// Only update timestamp on success — failure leaves it unchanged so the
|
|
8997
|
+
// next call retries.
|
|
8998
|
+
this.lastFetchedAt = Date.now();
|
|
8999
|
+
}
|
|
9000
|
+
// ---------------------------------------------------------------------------
|
|
9001
|
+
// Local store read
|
|
9002
|
+
// ---------------------------------------------------------------------------
|
|
9003
|
+
/**
|
|
9004
|
+
* Returns blocked {@link Amity.InternalUser} objects from the in-memory cache.
|
|
9005
|
+
*
|
|
9006
|
+
* Applies the spec-mandated filter:
|
|
9007
|
+
* - Only users whose `isDeleted` is false or null
|
|
9008
|
+
* - Hard limit of 100 results
|
|
9009
|
+
*
|
|
9010
|
+
* This always reads the latest local state, so changes made by `blockUser()`
|
|
9011
|
+
* and `unblockUser()` are reflected even within the TTL window.
|
|
9012
|
+
*/
|
|
9013
|
+
getCachedUsers() {
|
|
9014
|
+
const client = getActiveClient();
|
|
9015
|
+
if (!client.cache) {
|
|
9016
|
+
// No cache available — fall back to the in-memory list from the last fetch
|
|
9017
|
+
return [];
|
|
9018
|
+
}
|
|
9019
|
+
return this.blockedUserIds
|
|
9020
|
+
.map(id => { var _a; return (_a = pullFromCache(['user', 'get', id])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
9021
|
+
.filter((user) => user != null && user.isDeleted !== true)
|
|
9022
|
+
.slice(0, BLOCK_LIST_LIMIT);
|
|
9023
|
+
}
|
|
9024
|
+
}
|
|
9025
|
+
// ---------------------------------------------------------------------------
|
|
9026
|
+
// Module-level singleton
|
|
9027
|
+
// ---------------------------------------------------------------------------
|
|
9028
|
+
let instance$2 = null;
|
|
9029
|
+
var BlockedUserSyncEngine$1 = {
|
|
9030
|
+
getInstance: () => {
|
|
9031
|
+
if (!instance$2)
|
|
9032
|
+
instance$2 = new BlockedUserSyncEngine();
|
|
9033
|
+
return instance$2;
|
|
9034
|
+
},
|
|
9035
|
+
};
|
|
9036
|
+
|
|
9037
|
+
var blockedUserSyncEngineOnLoginHandler = () => {
|
|
9038
|
+
const blockedUserSyncEngine = BlockedUserSyncEngine$1.getInstance();
|
|
9039
|
+
onSessionStateChange(state => {
|
|
9040
|
+
if (state === "established" /* Amity.SessionStates.ESTABLISHED */) {
|
|
9041
|
+
blockedUserSyncEngine.onSessionEstablished();
|
|
9042
|
+
}
|
|
9043
|
+
else if (state === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
|
|
9044
|
+
blockedUserSyncEngine.onTokenExpired();
|
|
9045
|
+
}
|
|
9046
|
+
else {
|
|
9047
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
9048
|
+
}
|
|
9049
|
+
});
|
|
9050
|
+
return () => {
|
|
9051
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
9052
|
+
};
|
|
9053
|
+
};
|
|
9054
|
+
|
|
8913
9055
|
const EVENTS = [
|
|
8914
9056
|
'disconnected',
|
|
8915
9057
|
'error',
|
|
@@ -9075,7 +9217,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
|
|
|
9075
9217
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
9076
9218
|
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
9077
9219
|
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
9078
|
-
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler());
|
|
9220
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler());
|
|
9079
9221
|
if (client.useLegacyUnreadCount) {
|
|
9080
9222
|
subscriptions.push(readReceiptSyncEngineOnLoginHandler());
|
|
9081
9223
|
}
|
|
@@ -15564,56 +15706,32 @@ const isUserFlaggedByMe = async (userId) => {
|
|
|
15564
15706
|
};
|
|
15565
15707
|
/* end_public_function */
|
|
15566
15708
|
|
|
15567
|
-
function prepareBlockedUserPayload(response) {
|
|
15568
|
-
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
15569
|
-
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
15570
|
-
const followUser = users.find(user => user.userId === follow.from);
|
|
15571
|
-
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
15572
|
-
}), users: users.map(convertRawUserToInternalUser) });
|
|
15573
|
-
}
|
|
15574
|
-
|
|
15575
|
-
const BLOCK_LIST_DEFAULT_PAGE_LIMIT = 100;
|
|
15576
15709
|
/* begin_public_function
|
|
15577
|
-
id: user.
|
|
15710
|
+
id: user.get_all_blocked_users
|
|
15578
15711
|
*/
|
|
15579
15712
|
/**
|
|
15580
15713
|
* ```js
|
|
15581
15714
|
* import { UserRepository } from '@amityco/ts-sdk'
|
|
15582
|
-
* const blockedUsers = await UserRepository.
|
|
15583
|
-
* // or with a limit on total results:
|
|
15584
|
-
* const blockedUsers = await UserRepository.getBlockedUsersList({ limit: 3 })
|
|
15715
|
+
* const blockedUsers = await UserRepository.getAllBlockedUsers()
|
|
15585
15716
|
* ```
|
|
15586
15717
|
*
|
|
15587
|
-
*
|
|
15588
|
-
*
|
|
15718
|
+
* Returns all blocked users as a non-paginated list (limit 100) with TTL-based caching (5-minute window).
|
|
15719
|
+
* Within the TTL window, subsequent calls resolve instantly from the local store without any server call.
|
|
15720
|
+
* After the TTL expires, the next call triggers a fresh server fetch.
|
|
15589
15721
|
*
|
|
15590
|
-
* @
|
|
15591
|
-
* @param params.limit Maximum total number of blocked users to return (max: 100). Fetches all if not specified.
|
|
15592
|
-
* @returns Array of blocked {@link Amity.User} objects
|
|
15722
|
+
* @returns A promise that resolves to an array of blocked {@link Amity.User} objects
|
|
15593
15723
|
*
|
|
15594
15724
|
* @category Block API
|
|
15595
15725
|
* @async
|
|
15596
15726
|
*/
|
|
15597
|
-
const
|
|
15598
|
-
const client = getActiveClient();
|
|
15599
|
-
client.log('user/
|
|
15600
|
-
const
|
|
15601
|
-
|
|
15602
|
-
|
|
15603
|
-
|
|
15604
|
-
|
|
15605
|
-
const options = token ? { token } : { limit: remaining };
|
|
15606
|
-
// eslint-disable-next-line no-await-in-loop
|
|
15607
|
-
const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options, isDeleted: false } });
|
|
15608
|
-
const cachedAt = client.cache && Date.now();
|
|
15609
|
-
const payload = prepareBlockedUserPayload(data);
|
|
15610
|
-
if (client.cache) {
|
|
15611
|
-
ingestInCache(payload, { cachedAt });
|
|
15612
|
-
}
|
|
15613
|
-
allUsers.push(...payload.users);
|
|
15614
|
-
token = data.paging.next;
|
|
15615
|
-
} while (token && (maxResults === undefined || allUsers.length < maxResults));
|
|
15616
|
-
return allUsers.map(userLinkedObject);
|
|
15727
|
+
const getAllBlockedUsers = async () => {
|
|
15728
|
+
const client = getActiveClient();
|
|
15729
|
+
client.log('user/getAllBlockedUsers');
|
|
15730
|
+
const engine = BlockedUserSyncEngine$1.getInstance();
|
|
15731
|
+
// Ensure data is fetched (no-op if cache is fresh)
|
|
15732
|
+
await engine.ensureFetched();
|
|
15733
|
+
// Read from the engine's bounded ID list — O(blocked users) not O(cache size)
|
|
15734
|
+
return engine.getCachedUsers();
|
|
15617
15735
|
};
|
|
15618
15736
|
/* end_public_function */
|
|
15619
15737
|
|
|
@@ -16424,7 +16542,7 @@ var index$q = /*#__PURE__*/Object.freeze({
|
|
|
16424
16542
|
flagUser: flagUser,
|
|
16425
16543
|
unflagUser: unflagUser,
|
|
16426
16544
|
isUserFlaggedByMe: isUserFlaggedByMe,
|
|
16427
|
-
|
|
16545
|
+
getAllBlockedUsers: getAllBlockedUsers,
|
|
16428
16546
|
onUserUpdated: onUserUpdated,
|
|
16429
16547
|
onUserDeleted: onUserDeleted$2,
|
|
16430
16548
|
onUserFlagged: onUserFlagged,
|
|
@@ -18104,8 +18222,10 @@ const createLocalCommentEventSubscriber = (event, callback) => {
|
|
|
18104
18222
|
else {
|
|
18105
18223
|
const postCacheKey = ['post', 'get', comments[0].referenceId];
|
|
18106
18224
|
const postCache = (_d = pullFromCache(postCacheKey)) === null || _d === void 0 ? void 0 : _d.data;
|
|
18107
|
-
|
|
18108
|
-
|
|
18225
|
+
if (postCache) {
|
|
18226
|
+
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); }) });
|
|
18227
|
+
pushToCache(postCacheKey, updatedPost);
|
|
18228
|
+
}
|
|
18109
18229
|
}
|
|
18110
18230
|
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; });
|
|
18111
18231
|
queries === null || queries === void 0 ? void 0 : queries.map(({ key, data }) => upsertInCache(key, data, { cachedAt: -1 }));
|
|
@@ -23192,7 +23312,7 @@ const removeMembers = async (communityId, userIds) => {
|
|
|
23192
23312
|
*/
|
|
23193
23313
|
class CommunityMembersPaginationController extends PaginationController {
|
|
23194
23314
|
async getRequest(queryParams, token) {
|
|
23195
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
23315
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles: _excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
23196
23316
|
const options = token ? { token } : { limit };
|
|
23197
23317
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
23198
23318
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -23841,7 +23961,7 @@ const getMembers = (params, callback, config) => {
|
|
|
23841
23961
|
*/
|
|
23842
23962
|
class SearchCommunityMembersPaginationController extends PaginationController {
|
|
23843
23963
|
async getRequest(queryParams, token) {
|
|
23844
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
23964
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
23845
23965
|
const options = token ? { token } : { limit };
|
|
23846
23966
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
23847
23967
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|