@amityco/ts-sdk 7.33.2-840ee4f3.0 → 7.33.2-a1958171.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.
Files changed (31) hide show
  1. package/dist/@types/domains/follow.d.ts +7 -0
  2. package/dist/@types/domains/follow.d.ts.map +1 -1
  3. package/dist/client/api/setupLoginSubscriptions.d.ts.map +1 -1
  4. package/dist/index.cjs.js +75 -207
  5. package/dist/index.esm.js +75 -207
  6. package/dist/index.umd.js +1 -1
  7. package/dist/userRepository/api/index.d.ts +0 -2
  8. package/dist/userRepository/api/index.d.ts.map +1 -1
  9. package/dist/userRepository/relationship/follow/observers/getFollowers/FollowerLiveCollectionController.d.ts.map +1 -1
  10. package/dist/userRepository/relationship/follow/observers/getFollowers/FollowerPaginationController.d.ts.map +1 -1
  11. package/dist/userRepository/relationship/follow/observers/getFollowers.d.ts +14 -1
  12. package/dist/userRepository/relationship/follow/observers/getFollowers.d.ts.map +1 -1
  13. package/dist/userRepository/relationship/follow/observers/getFollowings/FollowingLiveCollectionController.d.ts.map +1 -1
  14. package/dist/userRepository/relationship/follow/observers/getFollowings/FollowingPaginationController.d.ts.map +1 -1
  15. package/dist/userRepository/relationship/follow/observers/getFollowings.d.ts +14 -1
  16. package/dist/userRepository/relationship/follow/observers/getFollowings.d.ts.map +1 -1
  17. package/dist/userRepository/relationship/follow/observers/tests/getFollowsByUserIds.test.d.ts +2 -0
  18. package/dist/userRepository/relationship/follow/observers/tests/getFollowsByUserIds.test.d.ts.map +1 -0
  19. package/dist/utils/constants.d.ts +1 -0
  20. package/dist/utils/constants.d.ts.map +1 -1
  21. package/package.json +1 -1
  22. package/dist/userRepository/api/getAllFollowers.d.ts +0 -19
  23. package/dist/userRepository/api/getAllFollowers.d.ts.map +0 -1
  24. package/dist/userRepository/api/getAllFollowings.d.ts +0 -21
  25. package/dist/userRepository/api/getAllFollowings.d.ts.map +0 -1
  26. package/dist/userRepository/api/tests/integration/getAllFollowers.integration.test.d.ts +0 -2
  27. package/dist/userRepository/api/tests/integration/getAllFollowers.integration.test.d.ts.map +0 -1
  28. package/dist/userRepository/services/FollowUserSyncEngine/followUserSyncEngine.d.ts +0 -60
  29. package/dist/userRepository/services/FollowUserSyncEngine/followUserSyncEngine.d.ts.map +0 -1
  30. package/dist/userRepository/services/FollowUserSyncEngine/followUserSyncEngineOnLoginHandler.d.ts +0 -3
  31. package/dist/userRepository/services/FollowUserSyncEngine/followUserSyncEngineOnLoginHandler.d.ts.map +0 -1
@@ -38,6 +38,13 @@ declare global {
38
38
  type QueryFollowers = {
39
39
  userId: Amity.InternalUser['userId'];
40
40
  status?: Exclude<Amity.FollowStatusType, 'none'>;
41
+ /**
42
+ * Only return the follows with these users (up to 100 ids), in one page.
43
+ * A user missing from the result has no relationship with the signed-in user.
44
+ * Only works on the signed-in user's own followers and followings lists.
45
+ * An empty array returns an empty list without a server call.
46
+ */
47
+ userIds?: Amity.InternalUser['userId'][];
41
48
  page?: Amity.PageRaw;
42
49
  };
43
50
  type FollowerLiveCollection = Amity.LiveCollectionParams<Omit<QueryFollowers, 'page'>>;
@@ -1 +1 @@
1
- {"version":3,"file":"follow.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/follow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,WAAW,oBAAoB;YAC7B,WAAW,gBAAgB;YAC3B,UAAU,eAAe;YACzB,UAAU,eAAe;YACzB,UAAU,eAAe;YACzB,UAAU,eAAe;YACzB,YAAY,iBAAiB;YAC7B,SAAS,cAAc;SACxB;QAED,KAAK,gBAAgB,GAAG,GAAG,oBAAoB,EAAE,CAAC;QAElD,WAAW,oBAAoB;YAC7B,GAAG,QAAQ;YACX,OAAO,YAAY;YACnB,QAAQ,aAAa;YACrB,OAAO,YAAY;YACnB,IAAI,SAAS;SACd;QAED,KAAK,gBAAgB,GAAG,GAAG,oB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AAC;QAEhB,KAAK,cAAc,GAAG;YACpB,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YACrC,MAAM,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;YACjD;;;;;eAKG;YACH,OAAO,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzC,IAAI,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC;SACtB,CAAC;QAEF,KAAK,sBAAsB,GAAG,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;QAEvF,KAAK,2BAA2B,GAAG,KAAK,CAAC,mBAAmB,CAC1D,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAC1B,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAC7B,CAAC;QAEF,KAAK,eAAe,GAAG,cAAc,CAAC;QAEtC,KAAK,uBAAuB,GAAG,sBAAsB,CAAC;QAEtD,KAAK,4BAA4B,GAAG,2BAA2B,CAAC;KACjE;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"setupLoginSubscriptions.d.ts","sourceRoot":"","sources":["../../../src/client/api/setupLoginSubscriptions.ts"],"names":[],"mappings":"AA2BA;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,YAAY,KAAG,MAAM,YAAY,EAoE5F,CAAC"}
1
+ {"version":3,"file":"setupLoginSubscriptions.d.ts","sourceRoot":"","sources":["../../../src/client/api/setupLoginSubscriptions.ts"],"names":[],"mappings":"AA0BA;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,YAAY,KAAG,MAAM,YAAY,EAmE5F,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -395,6 +395,8 @@ const API_ENDPOINTS = {
395
395
  // The review-queue route defaults to 10, not the SDK-wide page size, and caps at 100
396
396
  const COMMENT_REVIEW_QUEUE_DEFAULT_PAGINATION_SIZE = 10;
397
397
  const COMMENT_REVIEW_QUEUE_MAX_PAGINATION_SIZE = 100;
398
+ // The me/followers and me/following `userIds` filter takes up to 100 ids, answered in one page
399
+ const FOLLOW_USER_IDS_PAGINATION_LIMIT = 100;
398
400
 
399
401
  // cache constants
400
402
  const CACHE_KEY_GET = 'get';
@@ -7945,7 +7947,7 @@ function prepareBlockedUserPayload(response) {
7945
7947
  }
7946
7948
 
7947
7949
  const BLOCK_LIST_LIMIT$1 = 100;
7948
- const TTL_MS$2 = 5 * 60 * 1000; // 5 minutes
7950
+ const TTL_MS$1 = 5 * 60 * 1000; // 5 minutes
7949
7951
  /**
7950
7952
  * Session-scoped singleton engine that manages TTL-based fetching and caching
7951
7953
  * of blocked users. Provides a lazy `ensureFetched()` gate for the
@@ -7983,7 +7985,7 @@ class BlockedUserSyncEngine {
7983
7985
  isCacheExpired() {
7984
7986
  if (this.lastFetchedAt === null)
7985
7987
  return true;
7986
- return Date.now() - this.lastFetchedAt > TTL_MS$2;
7988
+ return Date.now() - this.lastFetchedAt > TTL_MS$1;
7987
7989
  }
7988
7990
  /**
7989
7991
  * Ensures the local store is populated with fresh blocked-user data.
@@ -8074,7 +8076,7 @@ function prepareBlockingUserPayload(response) {
8074
8076
  }
8075
8077
 
8076
8078
  const BLOCK_LIST_LIMIT = 100;
8077
- const TTL_MS$1 = 5 * 60 * 1000; // 5 minutes
8079
+ const TTL_MS = 5 * 60 * 1000; // 5 minutes
8078
8080
  /**
8079
8081
  * Session-scoped singleton engine that manages TTL-based fetching and caching
8080
8082
  * of blocking users (the "blocked-by" list — users who blocked the current
@@ -8113,7 +8115,7 @@ class BlockingUserSyncEngine {
8113
8115
  isCacheExpired() {
8114
8116
  if (this.lastFetchedAt === null)
8115
8117
  return true;
8116
- return Date.now() - this.lastFetchedAt > TTL_MS$1;
8118
+ return Date.now() - this.lastFetchedAt > TTL_MS;
8117
8119
  }
8118
8120
  /**
8119
8121
  * Ensures the local store is populated with fresh blocking-user data.
@@ -8208,138 +8210,6 @@ function prepareFollowStatusPayload(response) {
8208
8210
  return Object.assign(Object.assign({}, rest), { follows });
8209
8211
  }
8210
8212
 
8211
- const FOLLOW_LIST_LIMIT = 100;
8212
- const TTL_MS = 5 * 60 * 1000; // 5 minutes
8213
- const ENDPOINTS = {
8214
- followers: '/api/v4/me/followers',
8215
- followings: '/api/v4/me/following',
8216
- };
8217
- /**
8218
- * Session-scoped singleton engine that manages TTL-based fetching and caching
8219
- * of the current user's accepted followers or followings. Provides a lazy
8220
- * `ensureFetched()` gate for the `getAllFollowers()` / `getAllFollowings()` APIs.
8221
- *
8222
- * Key behaviours:
8223
- * - `onSessionEstablished()` is a no-op — fetch is lazy, triggered only by consumer call
8224
- * - `onSessionDestroyed()` resets `lastFetchedAt` to null (ensures fresh fetch on next session)
8225
- * - `ensureFetched()` fetches from server only when cache is expired or never fetched
8226
- * - `lastFetchedAt` is only updated on successful fetch
8227
- * - reads query the follow cache live, so follow / unfollow / remove-follower
8228
- * changes are reflected even within the TTL window
8229
- *
8230
- * @internal
8231
- */
8232
- class FollowUserSyncEngine {
8233
- constructor(direction) {
8234
- /** Epoch ms of last successful fetch. null = never fetched in this session. */
8235
- this.lastFetchedAt = null;
8236
- this.direction = direction;
8237
- }
8238
- /** No-op — fetch is lazy, triggered by consumer calling the API. */
8239
- // eslint-disable-next-line class-methods-use-this
8240
- onSessionEstablished() {
8241
- // intentionally empty
8242
- }
8243
- /** Resets state so the next session starts with a cold cache. */
8244
- onSessionDestroyed() {
8245
- this.lastFetchedAt = null;
8246
- }
8247
- /** No-op for this engine. */
8248
- // eslint-disable-next-line class-methods-use-this
8249
- onTokenExpired() {
8250
- // intentionally empty
8251
- }
8252
- isCacheExpired() {
8253
- if (this.lastFetchedAt === null)
8254
- return true;
8255
- return Date.now() - this.lastFetchedAt > TTL_MS;
8256
- }
8257
- /**
8258
- * Ensures the local store is populated with fresh follow data.
8259
- *
8260
- * - If the cache is still within the 5-minute TTL window: resolves immediately
8261
- * (no server call).
8262
- * - If the cache is expired (or never fetched): fetches the first page
8263
- * (limit 100) of accepted follows, persists the payload to the cache, and
8264
- * updates `lastFetchedAt`.
8265
- *
8266
- * On failure the error propagates to the caller and `lastFetchedAt` is NOT
8267
- * updated, so the next call will retry.
8268
- */
8269
- async ensureFetched() {
8270
- if (!this.isCacheExpired())
8271
- return;
8272
- const client = getActiveClient();
8273
- const { data } = await client.http.get(ENDPOINTS[this.direction], { params: { status: 'accepted', options: { limit: FOLLOW_LIST_LIMIT }, isDeleted: false } });
8274
- const cachedAt = client.cache && Date.now();
8275
- if (client.cache) {
8276
- ingestInCache(prepareFollowersPayload(data), { cachedAt });
8277
- }
8278
- // Only update timestamp on success — failure leaves it unchanged so the
8279
- // next call retries.
8280
- this.lastFetchedAt = Date.now();
8281
- }
8282
- /**
8283
- * Returns the followers / followings by querying the follow cache live.
8284
- *
8285
- * - filter `status === 'accepted'` and the current user on the matching side
8286
- * of the edge, other user not deleted
8287
- * - sort by `updatedAt` DESC
8288
- * - hard limit of 100 results
8289
- */
8290
- getCachedUsers() {
8291
- var _a;
8292
- const client = getActiveClient();
8293
- if (!client.cache)
8294
- return [];
8295
- const { userId } = client;
8296
- const isFollowers = this.direction === 'followers';
8297
- return ((_a = queryCache(['follow', 'get'])) !== null && _a !== void 0 ? _a : [])
8298
- .map(entry => entry.data)
8299
- .filter(follow => (follow === null || follow === void 0 ? void 0 : follow.status) === 'accepted' &&
8300
- (isFollowers ? follow.to === userId : follow.from === userId))
8301
- .sort((a, b) => { var _a, _b; return (((_a = a.updatedAt) !== null && _a !== void 0 ? _a : '') < ((_b = b.updatedAt) !== null && _b !== void 0 ? _b : '') ? 1 : -1); })
8302
- .map(follow => {
8303
- var _a;
8304
- return (_a = pullFromCache(['user', 'get', isFollowers ? follow.from : follow.to])) === null || _a === void 0 ? void 0 : _a.data;
8305
- })
8306
- .filter((user) => user != null && user.isDeleted !== true)
8307
- .slice(0, FOLLOW_LIST_LIMIT)
8308
- .map(userLinkedObject);
8309
- }
8310
- }
8311
- const instances = {};
8312
- var FollowUserSyncEngine$1 = {
8313
- getInstance: (direction) => {
8314
- if (!instances[direction])
8315
- instances[direction] = new FollowUserSyncEngine(direction);
8316
- return instances[direction];
8317
- },
8318
- };
8319
-
8320
- var followUserSyncEngineOnLoginHandler = () => {
8321
- const engines = [
8322
- FollowUserSyncEngine$1.getInstance('followers'),
8323
- FollowUserSyncEngine$1.getInstance('followings'),
8324
- ];
8325
- onSessionStateChange(state => {
8326
- engines.forEach(engine => {
8327
- if (state === "established" /* Amity.SessionStates.ESTABLISHED */) {
8328
- engine.onSessionEstablished();
8329
- }
8330
- else if (state === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
8331
- engine.onTokenExpired();
8332
- }
8333
- else {
8334
- engine.onSessionDestroyed();
8335
- }
8336
- });
8337
- });
8338
- return () => {
8339
- engines.forEach(engine => engine.onSessionDestroyed());
8340
- };
8341
- };
8342
-
8343
8213
  /**
8344
8214
  * Subscribes to a block MQTT event (`user.didBlock` / `user.didUnblock`),
8345
8215
  * ingests the carried `FollowersPayload` (follows + users) into the cache so
@@ -9063,7 +8933,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
9063
8933
  // NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
9064
8934
  // the channel because currently backend can't handle this, so every time a user is banned from
9065
8935
  // a channel or the channel is deleted the channel's unread count will not be reset to zero
9066
- onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler(), blockingUserSyncEngineOnLoginHandler(), followUserSyncEngineOnLoginHandler(), blockRealtimeOnLoginHandler(), resetAutoSubscriptionsOnLogout(), CursorController.clearOnLogout(), postCommentCountEngineOnLoginHandler(), channelActivityOnLoginHandler(), userFlagByMeOnLoginHandler());
8936
+ onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler(), blockingUserSyncEngineOnLoginHandler(), blockRealtimeOnLoginHandler(), resetAutoSubscriptionsOnLogout(), CursorController.clearOnLogout(), postCommentCountEngineOnLoginHandler(), channelActivityOnLoginHandler(), userFlagByMeOnLoginHandler());
9067
8937
  if (client.useLegacyUnreadCount) {
9068
8938
  subscriptions.push(readReceiptSyncEngineOnLoginHandler());
9069
8939
  }
@@ -11868,9 +11738,22 @@ class PaginationController {
11868
11738
 
11869
11739
  class FollowerPaginationController extends PaginationController {
11870
11740
  async getRequest(queryParams, token) {
11871
- const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, userId } = queryParams, params = __rest(queryParams, ["limit", "userId"]);
11872
- const options = token ? { token } : { limit };
11741
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, userId, userIds } = queryParams, params = __rest(queryParams, ["limit", "userId", "userIds"]);
11873
11742
  const client = getActiveClient();
11743
+ if (userIds) {
11744
+ // An empty filter matches nobody; sending no ids would return the whole list instead
11745
+ if (userIds.length === 0)
11746
+ return { follows: [], users: [], files: [], paging: {} };
11747
+ if (client.userId !== userId) {
11748
+ throw new ASCInvalidParameterError("userIds can only be used on the signed-in user's own followers list");
11749
+ }
11750
+ // core reads `limit` and `token` only as top-level params, never inside `options`
11751
+ const { data: queryResponse } = await this.http.get(`/api/v4/me/followers`, {
11752
+ params: Object.assign(Object.assign(Object.assign(Object.assign({}, params), { userIds, limit: FOLLOW_USER_IDS_PAGINATION_LIMIT }), (token && { token })), { isDeleted: false }),
11753
+ });
11754
+ return queryResponse;
11755
+ }
11756
+ const options = token ? { token } : { limit };
11874
11757
  const path = client.userId === userId ? `/api/v4/me/followers` : `/api/v4/users/${userId}/followers`;
11875
11758
  const { data: queryResponse } = await this.http.get(path, {
11876
11759
  params: Object.assign(Object.assign({}, params), { options, isDeleted: false }),
@@ -12154,6 +12037,11 @@ class FollowerLiveCollectionController extends LiveCollectionController {
12154
12037
  const fromUser = (_a = pullFromCache(['user', 'get', follower.from])) === null || _a === void 0 ? void 0 : _a.data;
12155
12038
  return (fromUser === null || fromUser === void 0 ? void 0 : fromUser.isDeleted) == null || (fromUser === null || fromUser === void 0 ? void 0 : fromUser.isDeleted) === false;
12156
12039
  });
12040
+ // With a userIds filter, keep realtime follows with other users out of the list
12041
+ if (this.query.userIds) {
12042
+ const userIds = new Set(this.query.userIds);
12043
+ followers = followers.filter(follower => userIds.has(follower.from));
12044
+ }
12157
12045
  return followers;
12158
12046
  }
12159
12047
  }
@@ -12173,7 +12061,20 @@ class FollowerLiveCollectionController extends LiveCollectionController {
12173
12061
  *
12174
12062
  * Observe all mutations on a list of {@link Amity.FollowStatus} followers for a given userId
12175
12063
  *
12176
- * @param userId the user
12064
+ * To check the relationship with specific users (e.g. the users on screen), pass the signed-in
12065
+ * user's `userId` and up to 100 `userIds`. The result only holds those users, in one page:
12066
+ *
12067
+ * ```js
12068
+ * getFollowers({ userId: client.userId, userIds: ['a', 'b', 'c'] }, ({ data }) => {
12069
+ * // users missing from `data` have no relationship
12070
+ * })
12071
+ * ```
12072
+ *
12073
+ * @param params.userId the user
12074
+ * @param params.status filter by follow status, defaults to all
12075
+ * @param params.userIds only return the followers with these users (up to 100 ids, in one page).
12076
+ * A user missing from the result has no relationship. Only allowed when `userId` is the
12077
+ * signed-in user, otherwise the callback gets an {@link ASCInvalidParameterError}.
12177
12078
  * @param callback the function to call when new data are available
12178
12079
  * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the messages
12179
12080
  *
@@ -12199,9 +12100,22 @@ const getFollowers = (params, callback, config) => {
12199
12100
 
12200
12101
  class FollowingPaginationController extends PaginationController {
12201
12102
  async getRequest(queryParams, token) {
12202
- const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, userId } = queryParams, params = __rest(queryParams, ["limit", "userId"]);
12203
- const options = token ? { token } : { limit };
12103
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, userId, userIds } = queryParams, params = __rest(queryParams, ["limit", "userId", "userIds"]);
12204
12104
  const client = getActiveClient();
12105
+ if (userIds) {
12106
+ // An empty filter matches nobody; sending no ids would return the whole list instead
12107
+ if (userIds.length === 0)
12108
+ return { follows: [], users: [], files: [], paging: {} };
12109
+ if (client.userId !== userId) {
12110
+ throw new ASCInvalidParameterError("userIds can only be used on the signed-in user's own following list");
12111
+ }
12112
+ // core reads `limit` and `token` only as top-level params, never inside `options`
12113
+ const { data: queryResponse } = await this.http.get(`/api/v4/me/following`, {
12114
+ params: Object.assign(Object.assign(Object.assign(Object.assign({}, params), { userIds, limit: FOLLOW_USER_IDS_PAGINATION_LIMIT }), (token && { token })), { isDeleted: false }),
12115
+ });
12116
+ return queryResponse;
12117
+ }
12118
+ const options = token ? { token } : { limit };
12205
12119
  const path = client.userId === userId ? `/api/v4/me/following` : `/api/v4/users/${userId}/following`;
12206
12120
  const { data: queryResponse } = await this.http.get(path, {
12207
12121
  params: Object.assign(Object.assign({}, params), { options, isDeleted: false }),
@@ -12361,6 +12275,11 @@ class FollowingLiveCollectionController extends LiveCollectionController {
12361
12275
  const toUser = (_a = pullFromCache(['user', 'get', following.to])) === null || _a === void 0 ? void 0 : _a.data;
12362
12276
  return (toUser === null || toUser === void 0 ? void 0 : toUser.isDeleted) == null || (toUser === null || toUser === void 0 ? void 0 : toUser.isDeleted) === false;
12363
12277
  });
12278
+ // With a userIds filter, keep realtime follows with other users out of the list
12279
+ if (this.query.userIds) {
12280
+ const userIds = new Set(this.query.userIds);
12281
+ followings = followings.filter(following => userIds.has(following.to));
12282
+ }
12364
12283
  return followings;
12365
12284
  }
12366
12285
  }
@@ -12380,7 +12299,20 @@ class FollowingLiveCollectionController extends LiveCollectionController {
12380
12299
  *
12381
12300
  * Observe all mutations on a list of {@link Amity.FollowStatus} followings for a given userId
12382
12301
  *
12383
- * @param userId the user
12302
+ * To check the relationship with specific users (e.g. the users on screen), pass the signed-in
12303
+ * user's `userId` and up to 100 `userIds`. The result only holds those users, in one page:
12304
+ *
12305
+ * ```js
12306
+ * getFollowings({ userId: client.userId, userIds: ['a', 'b', 'c'] }, ({ data }) => {
12307
+ * // users missing from `data` have no relationship
12308
+ * })
12309
+ * ```
12310
+ *
12311
+ * @param params.userId the user
12312
+ * @param params.status filter by follow status, defaults to all
12313
+ * @param params.userIds only return the followings with these users (up to 100 ids, in one page).
12314
+ * A user missing from the result has no relationship. Only allowed when `userId` is the
12315
+ * signed-in user, otherwise the callback gets an {@link ASCInvalidParameterError}.
12384
12316
  * @param callback the function to call when new data are available
12385
12317
  * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the messages
12386
12318
  *
@@ -16441,68 +16373,6 @@ const getAllBlockingUsers = async () => {
16441
16373
  };
16442
16374
  /* end_public_function */
16443
16375
 
16444
- /* begin_public_function
16445
- id: user.get_all_followers
16446
- */
16447
- /**
16448
- * ```js
16449
- * import { UserRepository } from '@amityco/ts-sdk'
16450
- * const followers = await UserRepository.getAllFollowers()
16451
- * ```
16452
- *
16453
- * Returns all users who follow the current user (accepted follows only) as a
16454
- * non-paginated list (limit 100) with TTL-based caching (5-minute window).
16455
- * Within the TTL window, subsequent calls resolve instantly from the local store
16456
- * without any server call. After the TTL expires, the next call triggers a fresh
16457
- * server fetch.
16458
- *
16459
- * @returns A promise that resolves to an array of follower {@link Amity.User} objects
16460
- *
16461
- * @category Follow API
16462
- * @async
16463
- */
16464
- const getAllFollowers = async () => {
16465
- const client = getActiveClient();
16466
- client.log('user/getAllFollowers');
16467
- const engine = FollowUserSyncEngine$1.getInstance('followers');
16468
- // Ensure data is fetched (no-op if cache is fresh)
16469
- await engine.ensureFetched();
16470
- return engine.getCachedUsers();
16471
- };
16472
- /* end_public_function */
16473
-
16474
- /* begin_public_function
16475
- id: user.get_all_followings
16476
- */
16477
- /**
16478
- * ```js
16479
- * import { UserRepository } from '@amityco/ts-sdk'
16480
- * const followings = await UserRepository.getAllFollowings()
16481
- * ```
16482
- *
16483
- * Returns all users the current user follows (accepted follows only) as a
16484
- * non-paginated list (limit 100) with TTL-based caching (5-minute window).
16485
- * Within the TTL window, subsequent calls resolve instantly from the local store
16486
- * without any server call. After the TTL expires, the next call triggers a fresh
16487
- * server fetch.
16488
- *
16489
- * The directional inverse of {@link getAllFollowers}.
16490
- *
16491
- * @returns A promise that resolves to an array of followed {@link Amity.User} objects
16492
- *
16493
- * @category Follow API
16494
- * @async
16495
- */
16496
- const getAllFollowings = async () => {
16497
- const client = getActiveClient();
16498
- client.log('user/getAllFollowings');
16499
- const engine = FollowUserSyncEngine$1.getInstance('followings');
16500
- // Ensure data is fetched (no-op if cache is fresh)
16501
- await engine.ensureFetched();
16502
- return engine.getCachedUsers();
16503
- };
16504
- /* end_public_function */
16505
-
16506
16376
  /**
16507
16377
  * ```js
16508
16378
  * import { onUserUpdated } from '@amityco/ts-sdk'
@@ -17605,8 +17475,6 @@ var index$r = /*#__PURE__*/Object.freeze({
17605
17475
  isUserFlaggedByMe: isUserFlaggedByMe,
17606
17476
  getAllBlockedUsers: getAllBlockedUsers,
17607
17477
  getAllBlockingUsers: getAllBlockingUsers,
17608
- getAllFollowers: getAllFollowers,
17609
- getAllFollowings: getAllFollowings,
17610
17478
  onUserUpdated: onUserUpdated,
17611
17479
  onUserDeleted: onUserDeleted$2,
17612
17480
  onUserFlagged: onUserFlagged,