@amityco/ts-sdk-react-native 7.17.1-fe996ae.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/@types/domains/content.d.ts +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 +233 -45
- package/dist/index.esm.js +233 -45
- 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 -0
- 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/index.cjs.js
CHANGED
|
@@ -135,7 +135,7 @@ exports.ContentFlagReasonEnum = void 0;
|
|
|
135
135
|
ContentFlagReasonEnum["SelfHarmOrSuicide"] = "Self-harm or suicide";
|
|
136
136
|
ContentFlagReasonEnum["ViolenceOrThreateningContent"] = "Violence or threatening content";
|
|
137
137
|
ContentFlagReasonEnum["SellingRestrictedItems"] = "Selling and promoting restricted items";
|
|
138
|
-
ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual
|
|
138
|
+
ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual content or nudity";
|
|
139
139
|
ContentFlagReasonEnum["SpamOrScams"] = "Spam or scams";
|
|
140
140
|
ContentFlagReasonEnum["FalseInformation"] = "False information or misinformation";
|
|
141
141
|
ContentFlagReasonEnum["Others"] = "Others";
|
|
@@ -278,8 +278,8 @@ exports.AnalyticsSourceTypeEnum = void 0;
|
|
|
278
278
|
|
|
279
279
|
function getVersion() {
|
|
280
280
|
try {
|
|
281
|
-
// the string ''v7.
|
|
282
|
-
return 'v7.
|
|
281
|
+
// the string ''v7.18.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
282
|
+
return 'v7.18.0-cjs';
|
|
283
283
|
}
|
|
284
284
|
catch (error) {
|
|
285
285
|
return '__dev__';
|
|
@@ -1881,13 +1881,13 @@ class NetworkActivitiesWatcher {
|
|
|
1881
1881
|
this._listener.clear();
|
|
1882
1882
|
}
|
|
1883
1883
|
}
|
|
1884
|
-
let instance$
|
|
1884
|
+
let instance$9;
|
|
1885
1885
|
var NetworkActivitiesWatcher$1 = {
|
|
1886
1886
|
getInstance: () => {
|
|
1887
|
-
if (!instance$
|
|
1888
|
-
instance$
|
|
1887
|
+
if (!instance$9) {
|
|
1888
|
+
instance$9 = new NetworkActivitiesWatcher();
|
|
1889
1889
|
}
|
|
1890
|
-
return instance$
|
|
1890
|
+
return instance$9;
|
|
1891
1891
|
},
|
|
1892
1892
|
};
|
|
1893
1893
|
|
|
@@ -4955,6 +4955,8 @@ const ingestInCache = (payload = {}, options, replace = true) => {
|
|
|
4955
4955
|
const resolver = getResolver(type);
|
|
4956
4956
|
if (!resolver)
|
|
4957
4957
|
return;
|
|
4958
|
+
if (!models)
|
|
4959
|
+
return;
|
|
4958
4960
|
models.forEach(model => {
|
|
4959
4961
|
(replace ? pushToCache : upsertInCache)([type, 'get', resolver(model)], model, options);
|
|
4960
4962
|
});
|
|
@@ -6989,13 +6991,13 @@ class SessionWatcher {
|
|
|
6989
6991
|
this._listener.clear();
|
|
6990
6992
|
}
|
|
6991
6993
|
}
|
|
6992
|
-
let instance$
|
|
6994
|
+
let instance$8;
|
|
6993
6995
|
var SessionWatcher$1 = {
|
|
6994
6996
|
getInstance: () => {
|
|
6995
|
-
if (!instance$
|
|
6996
|
-
instance$
|
|
6997
|
+
if (!instance$8) {
|
|
6998
|
+
instance$8 = new SessionWatcher();
|
|
6997
6999
|
}
|
|
6998
|
-
return instance$
|
|
7000
|
+
return instance$8;
|
|
6999
7001
|
},
|
|
7000
7002
|
};
|
|
7001
7003
|
|
|
@@ -8057,13 +8059,13 @@ class AnalyticsEngine {
|
|
|
8057
8059
|
this._eventCapturer.resetAllBuckets();
|
|
8058
8060
|
}
|
|
8059
8061
|
}
|
|
8060
|
-
let instance$
|
|
8062
|
+
let instance$7;
|
|
8061
8063
|
var AnalyticsEngine$1 = {
|
|
8062
8064
|
getInstance: () => {
|
|
8063
|
-
if (!instance$
|
|
8064
|
-
instance$
|
|
8065
|
+
if (!instance$7) {
|
|
8066
|
+
instance$7 = new AnalyticsEngine();
|
|
8065
8067
|
}
|
|
8066
|
-
return instance$
|
|
8068
|
+
return instance$7;
|
|
8067
8069
|
},
|
|
8068
8070
|
};
|
|
8069
8071
|
|
|
@@ -8291,12 +8293,12 @@ class MessageReadReceiptSyncEngine {
|
|
|
8291
8293
|
}
|
|
8292
8294
|
}
|
|
8293
8295
|
}
|
|
8294
|
-
let instance$
|
|
8296
|
+
let instance$6 = null;
|
|
8295
8297
|
var ReadReceiptSyncEngine = {
|
|
8296
8298
|
getInstance: () => {
|
|
8297
|
-
if (!instance$
|
|
8298
|
-
instance$
|
|
8299
|
-
return instance$
|
|
8299
|
+
if (!instance$6)
|
|
8300
|
+
instance$6 = new MessageReadReceiptSyncEngine();
|
|
8301
|
+
return instance$6;
|
|
8300
8302
|
},
|
|
8301
8303
|
};
|
|
8302
8304
|
|
|
@@ -8550,12 +8552,12 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
8550
8552
|
}
|
|
8551
8553
|
}
|
|
8552
8554
|
}
|
|
8553
|
-
let instance$
|
|
8555
|
+
let instance$5 = null;
|
|
8554
8556
|
var LegacyReadReceiptSyncEngine = {
|
|
8555
8557
|
getInstance: () => {
|
|
8556
|
-
if (!instance$
|
|
8557
|
-
instance$
|
|
8558
|
-
return instance$
|
|
8558
|
+
if (!instance$5)
|
|
8559
|
+
instance$5 = new LegacyMessageReadReceiptSyncEngine();
|
|
8560
|
+
return instance$5;
|
|
8559
8561
|
},
|
|
8560
8562
|
};
|
|
8561
8563
|
|
|
@@ -8831,12 +8833,12 @@ class ObjectResolverEngine {
|
|
|
8831
8833
|
this.stopResolver();
|
|
8832
8834
|
}
|
|
8833
8835
|
}
|
|
8834
|
-
let instance$
|
|
8836
|
+
let instance$4 = null;
|
|
8835
8837
|
var ObjectResolverEngine$1 = {
|
|
8836
8838
|
getInstance: () => {
|
|
8837
|
-
if (!instance$
|
|
8838
|
-
instance$
|
|
8839
|
-
return instance$
|
|
8839
|
+
if (!instance$4)
|
|
8840
|
+
instance$4 = new ObjectResolverEngine();
|
|
8841
|
+
return instance$4;
|
|
8840
8842
|
},
|
|
8841
8843
|
};
|
|
8842
8844
|
|
|
@@ -8986,13 +8988,13 @@ class LiveReactionSyncEngine {
|
|
|
8986
8988
|
this.stopReactionsSync();
|
|
8987
8989
|
}
|
|
8988
8990
|
}
|
|
8989
|
-
let instance$
|
|
8991
|
+
let instance$3;
|
|
8990
8992
|
var ReactionSyncEngine = {
|
|
8991
8993
|
getInstance: () => {
|
|
8992
|
-
if (!instance$
|
|
8993
|
-
instance$
|
|
8994
|
+
if (!instance$3) {
|
|
8995
|
+
instance$3 = new LiveReactionSyncEngine();
|
|
8994
8996
|
}
|
|
8995
|
-
return instance$
|
|
8997
|
+
return instance$3;
|
|
8996
8998
|
},
|
|
8997
8999
|
};
|
|
8998
9000
|
|
|
@@ -9014,6 +9016,148 @@ var reactionSyncEngineOnLoginHandler = () => {
|
|
|
9014
9016
|
};
|
|
9015
9017
|
};
|
|
9016
9018
|
|
|
9019
|
+
function prepareBlockedUserPayload(response) {
|
|
9020
|
+
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
9021
|
+
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
9022
|
+
const followUser = users.find(user => user.userId === follow.from);
|
|
9023
|
+
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
9024
|
+
}), users: users.map(convertRawUserToInternalUser) });
|
|
9025
|
+
}
|
|
9026
|
+
|
|
9027
|
+
const BLOCK_LIST_LIMIT = 100;
|
|
9028
|
+
const TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
9029
|
+
/**
|
|
9030
|
+
* Session-scoped singleton engine that manages TTL-based fetching and caching
|
|
9031
|
+
* of blocked users. Provides a lazy `ensureFetched()` gate for the
|
|
9032
|
+
* `getAllBlockedUsers()` API.
|
|
9033
|
+
*
|
|
9034
|
+
* Key behaviours:
|
|
9035
|
+
* - `establish()` is a no-op — fetch is lazy, triggered only by consumer call
|
|
9036
|
+
* - `destroy()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
|
|
9037
|
+
* - `ensureFetched()` fetches from server only when cache is expired or never fetched
|
|
9038
|
+
* - `lastFetchedAt` is only updated on successful fetch
|
|
9039
|
+
* - `blockedUserIds` is kept in sync with each successful fetch
|
|
9040
|
+
*
|
|
9041
|
+
* @internal
|
|
9042
|
+
*/
|
|
9043
|
+
class BlockedUserSyncEngine {
|
|
9044
|
+
constructor() {
|
|
9045
|
+
/** Epoch ms of last successful fetch. null = never fetched in this session. */
|
|
9046
|
+
this.lastFetchedAt = null;
|
|
9047
|
+
/** Ordered list of userId strings from the most recent successful fetch. */
|
|
9048
|
+
this.blockedUserIds = [];
|
|
9049
|
+
}
|
|
9050
|
+
// ---------------------------------------------------------------------------
|
|
9051
|
+
// SessionComponent lifecycle
|
|
9052
|
+
// ---------------------------------------------------------------------------
|
|
9053
|
+
/** No-op — fetch is lazy, triggered by consumer calling getAllBlockedUsers(). */
|
|
9054
|
+
// eslint-disable-next-line class-methods-use-this
|
|
9055
|
+
onSessionEstablished() {
|
|
9056
|
+
// intentionally empty
|
|
9057
|
+
}
|
|
9058
|
+
/** Resets state so the next session starts with a cold cache. */
|
|
9059
|
+
onSessionDestroyed() {
|
|
9060
|
+
this.lastFetchedAt = null;
|
|
9061
|
+
this.blockedUserIds = [];
|
|
9062
|
+
}
|
|
9063
|
+
/** No-op for this engine. */
|
|
9064
|
+
// eslint-disable-next-line class-methods-use-this
|
|
9065
|
+
onTokenExpired() {
|
|
9066
|
+
// intentionally empty
|
|
9067
|
+
}
|
|
9068
|
+
// ---------------------------------------------------------------------------
|
|
9069
|
+
// Cache helpers
|
|
9070
|
+
// ---------------------------------------------------------------------------
|
|
9071
|
+
isCacheExpired() {
|
|
9072
|
+
if (this.lastFetchedAt === null)
|
|
9073
|
+
return true;
|
|
9074
|
+
return Date.now() - this.lastFetchedAt > TTL_MS;
|
|
9075
|
+
}
|
|
9076
|
+
// ---------------------------------------------------------------------------
|
|
9077
|
+
// Core fetch gate
|
|
9078
|
+
// ---------------------------------------------------------------------------
|
|
9079
|
+
/**
|
|
9080
|
+
* Ensures the local store is populated with fresh blocked-user data.
|
|
9081
|
+
*
|
|
9082
|
+
* - If the cache is still within the 5-minute TTL window: resolves immediately
|
|
9083
|
+
* (no server call).
|
|
9084
|
+
* - If the cache is expired (or never fetched): fetches from the server,
|
|
9085
|
+
* persists the payload to the cache, and updates `lastFetchedAt`.
|
|
9086
|
+
*
|
|
9087
|
+
* On failure the error propagates to the caller and `lastFetchedAt` is NOT
|
|
9088
|
+
* updated, so the next call will retry.
|
|
9089
|
+
*/
|
|
9090
|
+
async ensureFetched() {
|
|
9091
|
+
if (!this.isCacheExpired())
|
|
9092
|
+
return;
|
|
9093
|
+
const client = getActiveClient();
|
|
9094
|
+
const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options: { limit: BLOCK_LIST_LIMIT }, isDeleted: false } });
|
|
9095
|
+
const cachedAt = client.cache && Date.now();
|
|
9096
|
+
const payload = prepareBlockedUserPayload(data);
|
|
9097
|
+
if (client.cache) {
|
|
9098
|
+
ingestInCache(payload, { cachedAt });
|
|
9099
|
+
}
|
|
9100
|
+
// Keep the ordered list of blocked user IDs for getCachedUsers()
|
|
9101
|
+
this.blockedUserIds = payload.users.map(u => u.userId);
|
|
9102
|
+
// Only update timestamp on success — failure leaves it unchanged so the
|
|
9103
|
+
// next call retries.
|
|
9104
|
+
this.lastFetchedAt = Date.now();
|
|
9105
|
+
}
|
|
9106
|
+
// ---------------------------------------------------------------------------
|
|
9107
|
+
// Local store read
|
|
9108
|
+
// ---------------------------------------------------------------------------
|
|
9109
|
+
/**
|
|
9110
|
+
* Returns blocked {@link Amity.InternalUser} objects from the in-memory cache.
|
|
9111
|
+
*
|
|
9112
|
+
* Applies the spec-mandated filter:
|
|
9113
|
+
* - Only users whose `isDeleted` is false or null
|
|
9114
|
+
* - Hard limit of 100 results
|
|
9115
|
+
*
|
|
9116
|
+
* This always reads the latest local state, so changes made by `blockUser()`
|
|
9117
|
+
* and `unblockUser()` are reflected even within the TTL window.
|
|
9118
|
+
*/
|
|
9119
|
+
getCachedUsers() {
|
|
9120
|
+
const client = getActiveClient();
|
|
9121
|
+
if (!client.cache) {
|
|
9122
|
+
// No cache available — fall back to the in-memory list from the last fetch
|
|
9123
|
+
return [];
|
|
9124
|
+
}
|
|
9125
|
+
return this.blockedUserIds
|
|
9126
|
+
.map(id => { var _a; return (_a = pullFromCache(['user', 'get', id])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
9127
|
+
.filter((user) => user != null && user.isDeleted !== true)
|
|
9128
|
+
.slice(0, BLOCK_LIST_LIMIT);
|
|
9129
|
+
}
|
|
9130
|
+
}
|
|
9131
|
+
// ---------------------------------------------------------------------------
|
|
9132
|
+
// Module-level singleton
|
|
9133
|
+
// ---------------------------------------------------------------------------
|
|
9134
|
+
let instance$2 = null;
|
|
9135
|
+
var BlockedUserSyncEngine$1 = {
|
|
9136
|
+
getInstance: () => {
|
|
9137
|
+
if (!instance$2)
|
|
9138
|
+
instance$2 = new BlockedUserSyncEngine();
|
|
9139
|
+
return instance$2;
|
|
9140
|
+
},
|
|
9141
|
+
};
|
|
9142
|
+
|
|
9143
|
+
var blockedUserSyncEngineOnLoginHandler = () => {
|
|
9144
|
+
const blockedUserSyncEngine = BlockedUserSyncEngine$1.getInstance();
|
|
9145
|
+
onSessionStateChange(state => {
|
|
9146
|
+
if (state === "established" /* Amity.SessionStates.ESTABLISHED */) {
|
|
9147
|
+
blockedUserSyncEngine.onSessionEstablished();
|
|
9148
|
+
}
|
|
9149
|
+
else if (state === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
|
|
9150
|
+
blockedUserSyncEngine.onTokenExpired();
|
|
9151
|
+
}
|
|
9152
|
+
else {
|
|
9153
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
9154
|
+
}
|
|
9155
|
+
});
|
|
9156
|
+
return () => {
|
|
9157
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
9158
|
+
};
|
|
9159
|
+
};
|
|
9160
|
+
|
|
9017
9161
|
const EVENTS = [
|
|
9018
9162
|
'disconnected',
|
|
9019
9163
|
'error',
|
|
@@ -9179,7 +9323,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
|
|
|
9179
9323
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
9180
9324
|
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
9181
9325
|
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
9182
|
-
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler());
|
|
9326
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler());
|
|
9183
9327
|
if (client.useLegacyUnreadCount) {
|
|
9184
9328
|
subscriptions.push(readReceiptSyncEngineOnLoginHandler());
|
|
9185
9329
|
}
|
|
@@ -13218,7 +13362,7 @@ const getWatchSessionStorage = () => {
|
|
|
13218
13362
|
return storageInstance;
|
|
13219
13363
|
};
|
|
13220
13364
|
|
|
13221
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
13365
|
+
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-----";
|
|
13222
13366
|
/*
|
|
13223
13367
|
* The crypto algorithm used for importing key and signing string
|
|
13224
13368
|
*/
|
|
@@ -15729,6 +15873,35 @@ const isUserFlaggedByMe = async (userId) => {
|
|
|
15729
15873
|
};
|
|
15730
15874
|
/* end_public_function */
|
|
15731
15875
|
|
|
15876
|
+
/* begin_public_function
|
|
15877
|
+
id: user.get_all_blocked_users
|
|
15878
|
+
*/
|
|
15879
|
+
/**
|
|
15880
|
+
* ```js
|
|
15881
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
15882
|
+
* const blockedUsers = await UserRepository.getAllBlockedUsers()
|
|
15883
|
+
* ```
|
|
15884
|
+
*
|
|
15885
|
+
* Returns all blocked users as a non-paginated list (limit 100) with TTL-based caching (5-minute window).
|
|
15886
|
+
* Within the TTL window, subsequent calls resolve instantly from the local store without any server call.
|
|
15887
|
+
* After the TTL expires, the next call triggers a fresh server fetch.
|
|
15888
|
+
*
|
|
15889
|
+
* @returns A promise that resolves to an array of blocked {@link Amity.User} objects
|
|
15890
|
+
*
|
|
15891
|
+
* @category Block API
|
|
15892
|
+
* @async
|
|
15893
|
+
*/
|
|
15894
|
+
const getAllBlockedUsers = async () => {
|
|
15895
|
+
const client = getActiveClient();
|
|
15896
|
+
client.log('user/getAllBlockedUsers');
|
|
15897
|
+
const engine = BlockedUserSyncEngine$1.getInstance();
|
|
15898
|
+
// Ensure data is fetched (no-op if cache is fresh)
|
|
15899
|
+
await engine.ensureFetched();
|
|
15900
|
+
// Read from the engine's bounded ID list — O(blocked users) not O(cache size)
|
|
15901
|
+
return engine.getCachedUsers();
|
|
15902
|
+
};
|
|
15903
|
+
/* end_public_function */
|
|
15904
|
+
|
|
15732
15905
|
/**
|
|
15733
15906
|
* ```js
|
|
15734
15907
|
* import { onUserUpdated } from '@amityco/ts-sdk-react-native'
|
|
@@ -16150,14 +16323,6 @@ class BlockedUserQueryStreamController extends QueryStreamController {
|
|
|
16150
16323
|
}
|
|
16151
16324
|
}
|
|
16152
16325
|
|
|
16153
|
-
function prepareBlockedUserPayload(response) {
|
|
16154
|
-
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
16155
|
-
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
16156
|
-
const followUser = users.find(user => user.userId === follow.from);
|
|
16157
|
-
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
16158
|
-
}), users: users.map(convertRawUserToInternalUser) });
|
|
16159
|
-
}
|
|
16160
|
-
|
|
16161
16326
|
const convertEventPayload = (eventHandler, sourceModelProp, destinationDomain) => (callback) => eventHandler(sourceModel => {
|
|
16162
16327
|
var _a;
|
|
16163
16328
|
if (!sourceModel) {
|
|
@@ -16544,6 +16709,7 @@ var index$q = /*#__PURE__*/Object.freeze({
|
|
|
16544
16709
|
flagUser: flagUser,
|
|
16545
16710
|
unflagUser: unflagUser,
|
|
16546
16711
|
isUserFlaggedByMe: isUserFlaggedByMe,
|
|
16712
|
+
getAllBlockedUsers: getAllBlockedUsers,
|
|
16547
16713
|
onUserUpdated: onUserUpdated,
|
|
16548
16714
|
onUserDeleted: onUserDeleted$2,
|
|
16549
16715
|
onUserFlagged: onUserFlagged,
|
|
@@ -18223,8 +18389,10 @@ const createLocalCommentEventSubscriber = (event, callback) => {
|
|
|
18223
18389
|
else {
|
|
18224
18390
|
const postCacheKey = ['post', 'get', comments[0].referenceId];
|
|
18225
18391
|
const postCache = (_d = pullFromCache(postCacheKey)) === null || _d === void 0 ? void 0 : _d.data;
|
|
18226
|
-
|
|
18227
|
-
|
|
18392
|
+
if (postCache) {
|
|
18393
|
+
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); }) });
|
|
18394
|
+
pushToCache(postCacheKey, updatedPost);
|
|
18395
|
+
}
|
|
18228
18396
|
}
|
|
18229
18397
|
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; });
|
|
18230
18398
|
queries === null || queries === void 0 ? void 0 : queries.map(({ key, data }) => upsertInCache(key, data, { cachedAt: -1 }));
|
|
@@ -23311,7 +23479,7 @@ const removeMembers = async (communityId, userIds) => {
|
|
|
23311
23479
|
*/
|
|
23312
23480
|
class CommunityMembersPaginationController extends PaginationController {
|
|
23313
23481
|
async getRequest(queryParams, token) {
|
|
23314
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
23482
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles: _excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
23315
23483
|
const options = token ? { token } : { limit };
|
|
23316
23484
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
23317
23485
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -23361,6 +23529,7 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
|
|
|
23361
23529
|
if (!collection)
|
|
23362
23530
|
return;
|
|
23363
23531
|
communityMembers.forEach(communityMember => {
|
|
23532
|
+
var _a;
|
|
23364
23533
|
const communityMemberCacheId = getResolver('communityUsers')({
|
|
23365
23534
|
communityId: this.query.communityId,
|
|
23366
23535
|
userId: communityMember.userId,
|
|
@@ -23369,6 +23538,13 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
|
|
|
23369
23538
|
collection.data = collection.data.filter(m => m !== communityMemberCacheId);
|
|
23370
23539
|
}
|
|
23371
23540
|
else if (!collection.data.includes(communityMemberCacheId)) {
|
|
23541
|
+
// Reactor-level exclusion: prevent excluded items from entering query stream
|
|
23542
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
23543
|
+
const memberRoles = communityMember.roles || [];
|
|
23544
|
+
if (memberRoles.some(role => this.query.excludingRoles.includes(role))) {
|
|
23545
|
+
return; // Skip — don't add to query stream
|
|
23546
|
+
}
|
|
23547
|
+
}
|
|
23372
23548
|
collection.data = [communityMemberCacheId, ...collection.data];
|
|
23373
23549
|
}
|
|
23374
23550
|
});
|
|
@@ -23856,6 +24032,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
23856
24032
|
});
|
|
23857
24033
|
}
|
|
23858
24034
|
applyFilter(data) {
|
|
24035
|
+
var _a;
|
|
23859
24036
|
let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
|
|
23860
24037
|
if (this.query.memberships) {
|
|
23861
24038
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -23863,6 +24040,9 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
23863
24040
|
return memberships.includes(communityMembership);
|
|
23864
24041
|
});
|
|
23865
24042
|
}
|
|
24043
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
24044
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
|
|
24045
|
+
}
|
|
23866
24046
|
if (this.query.includeDeleted === false) {
|
|
23867
24047
|
communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
|
|
23868
24048
|
}
|
|
@@ -23884,6 +24064,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
23884
24064
|
* @hidden
|
|
23885
24065
|
*/
|
|
23886
24066
|
const applyFilter = (data, params) => {
|
|
24067
|
+
var _a;
|
|
23887
24068
|
let communityMembers = filterByPropIntersection(data, 'roles', params.roles);
|
|
23888
24069
|
if (params.memberships) {
|
|
23889
24070
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -23891,6 +24072,9 @@ const applyFilter = (data, params) => {
|
|
|
23891
24072
|
return membership.includes(communityMembership);
|
|
23892
24073
|
});
|
|
23893
24074
|
}
|
|
24075
|
+
if ((_a = params.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
24076
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => params.excludingRoles.includes(role)));
|
|
24077
|
+
}
|
|
23894
24078
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
23895
24079
|
communityMembers = communityMembers.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
23896
24080
|
return communityMembers;
|
|
@@ -23944,7 +24128,7 @@ const getMembers = (params, callback, config) => {
|
|
|
23944
24128
|
*/
|
|
23945
24129
|
class SearchCommunityMembersPaginationController extends PaginationController {
|
|
23946
24130
|
async getRequest(queryParams, token) {
|
|
23947
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
24131
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
23948
24132
|
const options = token ? { token } : { limit };
|
|
23949
24133
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
23950
24134
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -24094,6 +24278,7 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
|
|
|
24094
24278
|
});
|
|
24095
24279
|
}
|
|
24096
24280
|
applyFilter(data) {
|
|
24281
|
+
var _a;
|
|
24097
24282
|
let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
|
|
24098
24283
|
if (this.query.memberships) {
|
|
24099
24284
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -24104,6 +24289,9 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
|
|
|
24104
24289
|
if (this.query.search) {
|
|
24105
24290
|
communityMembers = filterBySearchTerm(communityMembers, this.query.search);
|
|
24106
24291
|
}
|
|
24292
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
24293
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
|
|
24294
|
+
}
|
|
24107
24295
|
if (this.query.includeDeleted === false) {
|
|
24108
24296
|
communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
|
|
24109
24297
|
}
|