@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.esm.js
CHANGED
|
@@ -101,7 +101,7 @@ var ContentFlagReasonEnum;
|
|
|
101
101
|
ContentFlagReasonEnum["SelfHarmOrSuicide"] = "Self-harm or suicide";
|
|
102
102
|
ContentFlagReasonEnum["ViolenceOrThreateningContent"] = "Violence or threatening content";
|
|
103
103
|
ContentFlagReasonEnum["SellingRestrictedItems"] = "Selling and promoting restricted items";
|
|
104
|
-
ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual
|
|
104
|
+
ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual content or nudity";
|
|
105
105
|
ContentFlagReasonEnum["SpamOrScams"] = "Spam or scams";
|
|
106
106
|
ContentFlagReasonEnum["FalseInformation"] = "False information or misinformation";
|
|
107
107
|
ContentFlagReasonEnum["Others"] = "Others";
|
|
@@ -244,8 +244,8 @@ var AnalyticsSourceTypeEnum;
|
|
|
244
244
|
|
|
245
245
|
function getVersion() {
|
|
246
246
|
try {
|
|
247
|
-
// the string ''v7.
|
|
248
|
-
return 'v7.
|
|
247
|
+
// the string ''v7.18.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
248
|
+
return 'v7.18.0-esm';
|
|
249
249
|
}
|
|
250
250
|
catch (error) {
|
|
251
251
|
return '__dev__';
|
|
@@ -1847,13 +1847,13 @@ class NetworkActivitiesWatcher {
|
|
|
1847
1847
|
this._listener.clear();
|
|
1848
1848
|
}
|
|
1849
1849
|
}
|
|
1850
|
-
let instance$
|
|
1850
|
+
let instance$9;
|
|
1851
1851
|
var NetworkActivitiesWatcher$1 = {
|
|
1852
1852
|
getInstance: () => {
|
|
1853
|
-
if (!instance$
|
|
1854
|
-
instance$
|
|
1853
|
+
if (!instance$9) {
|
|
1854
|
+
instance$9 = new NetworkActivitiesWatcher();
|
|
1855
1855
|
}
|
|
1856
|
-
return instance$
|
|
1856
|
+
return instance$9;
|
|
1857
1857
|
},
|
|
1858
1858
|
};
|
|
1859
1859
|
|
|
@@ -21012,6 +21012,8 @@ const ingestInCache = (payload = {}, options, replace = true) => {
|
|
|
21012
21012
|
const resolver = getResolver(type);
|
|
21013
21013
|
if (!resolver)
|
|
21014
21014
|
return;
|
|
21015
|
+
if (!models)
|
|
21016
|
+
return;
|
|
21015
21017
|
models.forEach(model => {
|
|
21016
21018
|
(replace ? pushToCache : upsertInCache)([type, 'get', resolver(model)], model, options);
|
|
21017
21019
|
});
|
|
@@ -23062,13 +23064,13 @@ class SessionWatcher {
|
|
|
23062
23064
|
this._listener.clear();
|
|
23063
23065
|
}
|
|
23064
23066
|
}
|
|
23065
|
-
let instance$
|
|
23067
|
+
let instance$8;
|
|
23066
23068
|
var SessionWatcher$1 = {
|
|
23067
23069
|
getInstance: () => {
|
|
23068
|
-
if (!instance$
|
|
23069
|
-
instance$
|
|
23070
|
+
if (!instance$8) {
|
|
23071
|
+
instance$8 = new SessionWatcher();
|
|
23070
23072
|
}
|
|
23071
|
-
return instance$
|
|
23073
|
+
return instance$8;
|
|
23072
23074
|
},
|
|
23073
23075
|
};
|
|
23074
23076
|
|
|
@@ -24130,13 +24132,13 @@ class AnalyticsEngine {
|
|
|
24130
24132
|
this._eventCapturer.resetAllBuckets();
|
|
24131
24133
|
}
|
|
24132
24134
|
}
|
|
24133
|
-
let instance$
|
|
24135
|
+
let instance$7;
|
|
24134
24136
|
var AnalyticsEngine$1 = {
|
|
24135
24137
|
getInstance: () => {
|
|
24136
|
-
if (!instance$
|
|
24137
|
-
instance$
|
|
24138
|
+
if (!instance$7) {
|
|
24139
|
+
instance$7 = new AnalyticsEngine();
|
|
24138
24140
|
}
|
|
24139
|
-
return instance$
|
|
24141
|
+
return instance$7;
|
|
24140
24142
|
},
|
|
24141
24143
|
};
|
|
24142
24144
|
|
|
@@ -24364,12 +24366,12 @@ class MessageReadReceiptSyncEngine {
|
|
|
24364
24366
|
}
|
|
24365
24367
|
}
|
|
24366
24368
|
}
|
|
24367
|
-
let instance$
|
|
24369
|
+
let instance$6 = null;
|
|
24368
24370
|
var ReadReceiptSyncEngine = {
|
|
24369
24371
|
getInstance: () => {
|
|
24370
|
-
if (!instance$
|
|
24371
|
-
instance$
|
|
24372
|
-
return instance$
|
|
24372
|
+
if (!instance$6)
|
|
24373
|
+
instance$6 = new MessageReadReceiptSyncEngine();
|
|
24374
|
+
return instance$6;
|
|
24373
24375
|
},
|
|
24374
24376
|
};
|
|
24375
24377
|
|
|
@@ -24623,12 +24625,12 @@ class LegacyMessageReadReceiptSyncEngine {
|
|
|
24623
24625
|
}
|
|
24624
24626
|
}
|
|
24625
24627
|
}
|
|
24626
|
-
let instance$
|
|
24628
|
+
let instance$5 = null;
|
|
24627
24629
|
var LegacyReadReceiptSyncEngine = {
|
|
24628
24630
|
getInstance: () => {
|
|
24629
|
-
if (!instance$
|
|
24630
|
-
instance$
|
|
24631
|
-
return instance$
|
|
24631
|
+
if (!instance$5)
|
|
24632
|
+
instance$5 = new LegacyMessageReadReceiptSyncEngine();
|
|
24633
|
+
return instance$5;
|
|
24632
24634
|
},
|
|
24633
24635
|
};
|
|
24634
24636
|
|
|
@@ -24904,12 +24906,12 @@ class ObjectResolverEngine {
|
|
|
24904
24906
|
this.stopResolver();
|
|
24905
24907
|
}
|
|
24906
24908
|
}
|
|
24907
|
-
let instance$
|
|
24909
|
+
let instance$4 = null;
|
|
24908
24910
|
var ObjectResolverEngine$1 = {
|
|
24909
24911
|
getInstance: () => {
|
|
24910
|
-
if (!instance$
|
|
24911
|
-
instance$
|
|
24912
|
-
return instance$
|
|
24912
|
+
if (!instance$4)
|
|
24913
|
+
instance$4 = new ObjectResolverEngine();
|
|
24914
|
+
return instance$4;
|
|
24913
24915
|
},
|
|
24914
24916
|
};
|
|
24915
24917
|
|
|
@@ -25059,13 +25061,13 @@ class LiveReactionSyncEngine {
|
|
|
25059
25061
|
this.stopReactionsSync();
|
|
25060
25062
|
}
|
|
25061
25063
|
}
|
|
25062
|
-
let instance$
|
|
25064
|
+
let instance$3;
|
|
25063
25065
|
var ReactionSyncEngine = {
|
|
25064
25066
|
getInstance: () => {
|
|
25065
|
-
if (!instance$
|
|
25066
|
-
instance$
|
|
25067
|
+
if (!instance$3) {
|
|
25068
|
+
instance$3 = new LiveReactionSyncEngine();
|
|
25067
25069
|
}
|
|
25068
|
-
return instance$
|
|
25070
|
+
return instance$3;
|
|
25069
25071
|
},
|
|
25070
25072
|
};
|
|
25071
25073
|
|
|
@@ -25087,6 +25089,148 @@ var reactionSyncEngineOnLoginHandler = () => {
|
|
|
25087
25089
|
};
|
|
25088
25090
|
};
|
|
25089
25091
|
|
|
25092
|
+
function prepareBlockedUserPayload(response) {
|
|
25093
|
+
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
25094
|
+
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
25095
|
+
const followUser = users.find(user => user.userId === follow.from);
|
|
25096
|
+
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
25097
|
+
}), users: users.map(convertRawUserToInternalUser) });
|
|
25098
|
+
}
|
|
25099
|
+
|
|
25100
|
+
const BLOCK_LIST_LIMIT = 100;
|
|
25101
|
+
const TTL_MS = 5 * 60 * 1000; // 5 minutes
|
|
25102
|
+
/**
|
|
25103
|
+
* Session-scoped singleton engine that manages TTL-based fetching and caching
|
|
25104
|
+
* of blocked users. Provides a lazy `ensureFetched()` gate for the
|
|
25105
|
+
* `getAllBlockedUsers()` API.
|
|
25106
|
+
*
|
|
25107
|
+
* Key behaviours:
|
|
25108
|
+
* - `establish()` is a no-op — fetch is lazy, triggered only by consumer call
|
|
25109
|
+
* - `destroy()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
|
|
25110
|
+
* - `ensureFetched()` fetches from server only when cache is expired or never fetched
|
|
25111
|
+
* - `lastFetchedAt` is only updated on successful fetch
|
|
25112
|
+
* - `blockedUserIds` is kept in sync with each successful fetch
|
|
25113
|
+
*
|
|
25114
|
+
* @internal
|
|
25115
|
+
*/
|
|
25116
|
+
class BlockedUserSyncEngine {
|
|
25117
|
+
constructor() {
|
|
25118
|
+
/** Epoch ms of last successful fetch. null = never fetched in this session. */
|
|
25119
|
+
this.lastFetchedAt = null;
|
|
25120
|
+
/** Ordered list of userId strings from the most recent successful fetch. */
|
|
25121
|
+
this.blockedUserIds = [];
|
|
25122
|
+
}
|
|
25123
|
+
// ---------------------------------------------------------------------------
|
|
25124
|
+
// SessionComponent lifecycle
|
|
25125
|
+
// ---------------------------------------------------------------------------
|
|
25126
|
+
/** No-op — fetch is lazy, triggered by consumer calling getAllBlockedUsers(). */
|
|
25127
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25128
|
+
onSessionEstablished() {
|
|
25129
|
+
// intentionally empty
|
|
25130
|
+
}
|
|
25131
|
+
/** Resets state so the next session starts with a cold cache. */
|
|
25132
|
+
onSessionDestroyed() {
|
|
25133
|
+
this.lastFetchedAt = null;
|
|
25134
|
+
this.blockedUserIds = [];
|
|
25135
|
+
}
|
|
25136
|
+
/** No-op for this engine. */
|
|
25137
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25138
|
+
onTokenExpired() {
|
|
25139
|
+
// intentionally empty
|
|
25140
|
+
}
|
|
25141
|
+
// ---------------------------------------------------------------------------
|
|
25142
|
+
// Cache helpers
|
|
25143
|
+
// ---------------------------------------------------------------------------
|
|
25144
|
+
isCacheExpired() {
|
|
25145
|
+
if (this.lastFetchedAt === null)
|
|
25146
|
+
return true;
|
|
25147
|
+
return Date.now() - this.lastFetchedAt > TTL_MS;
|
|
25148
|
+
}
|
|
25149
|
+
// ---------------------------------------------------------------------------
|
|
25150
|
+
// Core fetch gate
|
|
25151
|
+
// ---------------------------------------------------------------------------
|
|
25152
|
+
/**
|
|
25153
|
+
* Ensures the local store is populated with fresh blocked-user data.
|
|
25154
|
+
*
|
|
25155
|
+
* - If the cache is still within the 5-minute TTL window: resolves immediately
|
|
25156
|
+
* (no server call).
|
|
25157
|
+
* - If the cache is expired (or never fetched): fetches from the server,
|
|
25158
|
+
* persists the payload to the cache, and updates `lastFetchedAt`.
|
|
25159
|
+
*
|
|
25160
|
+
* On failure the error propagates to the caller and `lastFetchedAt` is NOT
|
|
25161
|
+
* updated, so the next call will retry.
|
|
25162
|
+
*/
|
|
25163
|
+
async ensureFetched() {
|
|
25164
|
+
if (!this.isCacheExpired())
|
|
25165
|
+
return;
|
|
25166
|
+
const client = getActiveClient();
|
|
25167
|
+
const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options: { limit: BLOCK_LIST_LIMIT }, isDeleted: false } });
|
|
25168
|
+
const cachedAt = client.cache && Date.now();
|
|
25169
|
+
const payload = prepareBlockedUserPayload(data);
|
|
25170
|
+
if (client.cache) {
|
|
25171
|
+
ingestInCache(payload, { cachedAt });
|
|
25172
|
+
}
|
|
25173
|
+
// Keep the ordered list of blocked user IDs for getCachedUsers()
|
|
25174
|
+
this.blockedUserIds = payload.users.map(u => u.userId);
|
|
25175
|
+
// Only update timestamp on success — failure leaves it unchanged so the
|
|
25176
|
+
// next call retries.
|
|
25177
|
+
this.lastFetchedAt = Date.now();
|
|
25178
|
+
}
|
|
25179
|
+
// ---------------------------------------------------------------------------
|
|
25180
|
+
// Local store read
|
|
25181
|
+
// ---------------------------------------------------------------------------
|
|
25182
|
+
/**
|
|
25183
|
+
* Returns blocked {@link Amity.InternalUser} objects from the in-memory cache.
|
|
25184
|
+
*
|
|
25185
|
+
* Applies the spec-mandated filter:
|
|
25186
|
+
* - Only users whose `isDeleted` is false or null
|
|
25187
|
+
* - Hard limit of 100 results
|
|
25188
|
+
*
|
|
25189
|
+
* This always reads the latest local state, so changes made by `blockUser()`
|
|
25190
|
+
* and `unblockUser()` are reflected even within the TTL window.
|
|
25191
|
+
*/
|
|
25192
|
+
getCachedUsers() {
|
|
25193
|
+
const client = getActiveClient();
|
|
25194
|
+
if (!client.cache) {
|
|
25195
|
+
// No cache available — fall back to the in-memory list from the last fetch
|
|
25196
|
+
return [];
|
|
25197
|
+
}
|
|
25198
|
+
return this.blockedUserIds
|
|
25199
|
+
.map(id => { var _a; return (_a = pullFromCache(['user', 'get', id])) === null || _a === void 0 ? void 0 : _a.data; })
|
|
25200
|
+
.filter((user) => user != null && user.isDeleted !== true)
|
|
25201
|
+
.slice(0, BLOCK_LIST_LIMIT);
|
|
25202
|
+
}
|
|
25203
|
+
}
|
|
25204
|
+
// ---------------------------------------------------------------------------
|
|
25205
|
+
// Module-level singleton
|
|
25206
|
+
// ---------------------------------------------------------------------------
|
|
25207
|
+
let instance$2 = null;
|
|
25208
|
+
var BlockedUserSyncEngine$1 = {
|
|
25209
|
+
getInstance: () => {
|
|
25210
|
+
if (!instance$2)
|
|
25211
|
+
instance$2 = new BlockedUserSyncEngine();
|
|
25212
|
+
return instance$2;
|
|
25213
|
+
},
|
|
25214
|
+
};
|
|
25215
|
+
|
|
25216
|
+
var blockedUserSyncEngineOnLoginHandler = () => {
|
|
25217
|
+
const blockedUserSyncEngine = BlockedUserSyncEngine$1.getInstance();
|
|
25218
|
+
onSessionStateChange(state => {
|
|
25219
|
+
if (state === "established" /* Amity.SessionStates.ESTABLISHED */) {
|
|
25220
|
+
blockedUserSyncEngine.onSessionEstablished();
|
|
25221
|
+
}
|
|
25222
|
+
else if (state === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
|
|
25223
|
+
blockedUserSyncEngine.onTokenExpired();
|
|
25224
|
+
}
|
|
25225
|
+
else {
|
|
25226
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
25227
|
+
}
|
|
25228
|
+
});
|
|
25229
|
+
return () => {
|
|
25230
|
+
blockedUserSyncEngine.onSessionDestroyed();
|
|
25231
|
+
};
|
|
25232
|
+
};
|
|
25233
|
+
|
|
25090
25234
|
const EVENTS = [
|
|
25091
25235
|
'disconnected',
|
|
25092
25236
|
'error',
|
|
@@ -25252,7 +25396,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
|
|
|
25252
25396
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
25253
25397
|
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
25254
25398
|
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
25255
|
-
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler());
|
|
25399
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler());
|
|
25256
25400
|
if (client.useLegacyUnreadCount) {
|
|
25257
25401
|
subscriptions.push(readReceiptSyncEngineOnLoginHandler());
|
|
25258
25402
|
}
|
|
@@ -29291,7 +29435,7 @@ const getWatchSessionStorage = () => {
|
|
|
29291
29435
|
return storageInstance;
|
|
29292
29436
|
};
|
|
29293
29437
|
|
|
29294
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
29438
|
+
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-----";
|
|
29295
29439
|
/*
|
|
29296
29440
|
* The crypto algorithm used for importing key and signing string
|
|
29297
29441
|
*/
|
|
@@ -31802,6 +31946,35 @@ const isUserFlaggedByMe = async (userId) => {
|
|
|
31802
31946
|
};
|
|
31803
31947
|
/* end_public_function */
|
|
31804
31948
|
|
|
31949
|
+
/* begin_public_function
|
|
31950
|
+
id: user.get_all_blocked_users
|
|
31951
|
+
*/
|
|
31952
|
+
/**
|
|
31953
|
+
* ```js
|
|
31954
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
31955
|
+
* const blockedUsers = await UserRepository.getAllBlockedUsers()
|
|
31956
|
+
* ```
|
|
31957
|
+
*
|
|
31958
|
+
* Returns all blocked users as a non-paginated list (limit 100) with TTL-based caching (5-minute window).
|
|
31959
|
+
* Within the TTL window, subsequent calls resolve instantly from the local store without any server call.
|
|
31960
|
+
* After the TTL expires, the next call triggers a fresh server fetch.
|
|
31961
|
+
*
|
|
31962
|
+
* @returns A promise that resolves to an array of blocked {@link Amity.User} objects
|
|
31963
|
+
*
|
|
31964
|
+
* @category Block API
|
|
31965
|
+
* @async
|
|
31966
|
+
*/
|
|
31967
|
+
const getAllBlockedUsers = async () => {
|
|
31968
|
+
const client = getActiveClient();
|
|
31969
|
+
client.log('user/getAllBlockedUsers');
|
|
31970
|
+
const engine = BlockedUserSyncEngine$1.getInstance();
|
|
31971
|
+
// Ensure data is fetched (no-op if cache is fresh)
|
|
31972
|
+
await engine.ensureFetched();
|
|
31973
|
+
// Read from the engine's bounded ID list — O(blocked users) not O(cache size)
|
|
31974
|
+
return engine.getCachedUsers();
|
|
31975
|
+
};
|
|
31976
|
+
/* end_public_function */
|
|
31977
|
+
|
|
31805
31978
|
/**
|
|
31806
31979
|
* ```js
|
|
31807
31980
|
* import { onUserUpdated } from '@amityco/ts-sdk-react-native'
|
|
@@ -32223,14 +32396,6 @@ class BlockedUserQueryStreamController extends QueryStreamController {
|
|
|
32223
32396
|
}
|
|
32224
32397
|
}
|
|
32225
32398
|
|
|
32226
|
-
function prepareBlockedUserPayload(response) {
|
|
32227
|
-
const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
|
|
32228
|
-
return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
|
|
32229
|
-
const followUser = users.find(user => user.userId === follow.from);
|
|
32230
|
-
return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
|
|
32231
|
-
}), users: users.map(convertRawUserToInternalUser) });
|
|
32232
|
-
}
|
|
32233
|
-
|
|
32234
32399
|
const convertEventPayload = (eventHandler, sourceModelProp, destinationDomain) => (callback) => eventHandler(sourceModel => {
|
|
32235
32400
|
var _a;
|
|
32236
32401
|
if (!sourceModel) {
|
|
@@ -32617,6 +32782,7 @@ var index$q = /*#__PURE__*/Object.freeze({
|
|
|
32617
32782
|
flagUser: flagUser,
|
|
32618
32783
|
unflagUser: unflagUser,
|
|
32619
32784
|
isUserFlaggedByMe: isUserFlaggedByMe,
|
|
32785
|
+
getAllBlockedUsers: getAllBlockedUsers,
|
|
32620
32786
|
onUserUpdated: onUserUpdated,
|
|
32621
32787
|
onUserDeleted: onUserDeleted$2,
|
|
32622
32788
|
onUserFlagged: onUserFlagged,
|
|
@@ -34296,8 +34462,10 @@ const createLocalCommentEventSubscriber = (event, callback) => {
|
|
|
34296
34462
|
else {
|
|
34297
34463
|
const postCacheKey = ['post', 'get', comments[0].referenceId];
|
|
34298
34464
|
const postCache = (_d = pullFromCache(postCacheKey)) === null || _d === void 0 ? void 0 : _d.data;
|
|
34299
|
-
|
|
34300
|
-
|
|
34465
|
+
if (postCache) {
|
|
34466
|
+
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); }) });
|
|
34467
|
+
pushToCache(postCacheKey, updatedPost);
|
|
34468
|
+
}
|
|
34301
34469
|
}
|
|
34302
34470
|
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; });
|
|
34303
34471
|
queries === null || queries === void 0 ? void 0 : queries.map(({ key, data }) => upsertInCache(key, data, { cachedAt: -1 }));
|
|
@@ -39384,7 +39552,7 @@ const removeMembers = async (communityId, userIds) => {
|
|
|
39384
39552
|
*/
|
|
39385
39553
|
class CommunityMembersPaginationController extends PaginationController {
|
|
39386
39554
|
async getRequest(queryParams, token) {
|
|
39387
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
39555
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles: _excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
39388
39556
|
const options = token ? { token } : { limit };
|
|
39389
39557
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
39390
39558
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -39434,6 +39602,7 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
|
|
|
39434
39602
|
if (!collection)
|
|
39435
39603
|
return;
|
|
39436
39604
|
communityMembers.forEach(communityMember => {
|
|
39605
|
+
var _a;
|
|
39437
39606
|
const communityMemberCacheId = getResolver('communityUsers')({
|
|
39438
39607
|
communityId: this.query.communityId,
|
|
39439
39608
|
userId: communityMember.userId,
|
|
@@ -39442,6 +39611,13 @@ class CommunityMembersQueryStreamController extends QueryStreamController {
|
|
|
39442
39611
|
collection.data = collection.data.filter(m => m !== communityMemberCacheId);
|
|
39443
39612
|
}
|
|
39444
39613
|
else if (!collection.data.includes(communityMemberCacheId)) {
|
|
39614
|
+
// Reactor-level exclusion: prevent excluded items from entering query stream
|
|
39615
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
39616
|
+
const memberRoles = communityMember.roles || [];
|
|
39617
|
+
if (memberRoles.some(role => this.query.excludingRoles.includes(role))) {
|
|
39618
|
+
return; // Skip — don't add to query stream
|
|
39619
|
+
}
|
|
39620
|
+
}
|
|
39445
39621
|
collection.data = [communityMemberCacheId, ...collection.data];
|
|
39446
39622
|
}
|
|
39447
39623
|
});
|
|
@@ -39929,6 +40105,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
39929
40105
|
});
|
|
39930
40106
|
}
|
|
39931
40107
|
applyFilter(data) {
|
|
40108
|
+
var _a;
|
|
39932
40109
|
let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
|
|
39933
40110
|
if (this.query.memberships) {
|
|
39934
40111
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -39936,6 +40113,9 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
39936
40113
|
return memberships.includes(communityMembership);
|
|
39937
40114
|
});
|
|
39938
40115
|
}
|
|
40116
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
40117
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
|
|
40118
|
+
}
|
|
39939
40119
|
if (this.query.includeDeleted === false) {
|
|
39940
40120
|
communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
|
|
39941
40121
|
}
|
|
@@ -39957,6 +40137,7 @@ class CommunityMembersLiveCollectionController extends LiveCollectionController
|
|
|
39957
40137
|
* @hidden
|
|
39958
40138
|
*/
|
|
39959
40139
|
const applyFilter = (data, params) => {
|
|
40140
|
+
var _a;
|
|
39960
40141
|
let communityMembers = filterByPropIntersection(data, 'roles', params.roles);
|
|
39961
40142
|
if (params.memberships) {
|
|
39962
40143
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -39964,6 +40145,9 @@ const applyFilter = (data, params) => {
|
|
|
39964
40145
|
return membership.includes(communityMembership);
|
|
39965
40146
|
});
|
|
39966
40147
|
}
|
|
40148
|
+
if ((_a = params.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
40149
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => params.excludingRoles.includes(role)));
|
|
40150
|
+
}
|
|
39967
40151
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
39968
40152
|
communityMembers = communityMembers.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
39969
40153
|
return communityMembers;
|
|
@@ -40017,7 +40201,7 @@ const getMembers = (params, callback, config) => {
|
|
|
40017
40201
|
*/
|
|
40018
40202
|
class SearchCommunityMembersPaginationController extends PaginationController {
|
|
40019
40203
|
async getRequest(queryParams, token) {
|
|
40020
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted"]);
|
|
40204
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, excludingRoles } = queryParams, params = __rest(queryParams, ["limit", "includeDeleted", "excludingRoles"]);
|
|
40021
40205
|
const options = token ? { token } : { limit };
|
|
40022
40206
|
const isDeleted = includeDeleted === false ? false : undefined;
|
|
40023
40207
|
const { data: queryResponse } = await this.http.get(`/api/v3/communities/${params.communityId}/users`, {
|
|
@@ -40167,6 +40351,7 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
|
|
|
40167
40351
|
});
|
|
40168
40352
|
}
|
|
40169
40353
|
applyFilter(data) {
|
|
40354
|
+
var _a;
|
|
40170
40355
|
let communityMembers = filterByPropIntersection(data, 'roles', this.query.roles);
|
|
40171
40356
|
if (this.query.memberships) {
|
|
40172
40357
|
communityMembers = communityMembers.filter(({ communityMembership }) => {
|
|
@@ -40177,6 +40362,9 @@ class SearchCommunityMembersLiveCollectionController extends LiveCollectionContr
|
|
|
40177
40362
|
if (this.query.search) {
|
|
40178
40363
|
communityMembers = filterBySearchTerm(communityMembers, this.query.search);
|
|
40179
40364
|
}
|
|
40365
|
+
if ((_a = this.query.excludingRoles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
40366
|
+
communityMembers = communityMembers.filter(item => !(item.roles || []).some(role => this.query.excludingRoles.includes(role)));
|
|
40367
|
+
}
|
|
40180
40368
|
if (this.query.includeDeleted === false) {
|
|
40181
40369
|
communityMembers = communityMembers.filter(({ user }) => (user === null || user === void 0 ? void 0 : user.isDeleted) !== true);
|
|
40182
40370
|
}
|