@amityco/ts-sdk 7.16.1-edd3d58.0 → 7.17.1-2db1f64.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/index.cjs.js CHANGED
@@ -257,8 +257,8 @@ exports.AnalyticsSourceTypeEnum = void 0;
257
257
 
258
258
  function getVersion() {
259
259
  try {
260
- // the string ''v7.16.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
261
- return 'v7.16.0-cjs';
260
+ // the string ''v7.17.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
261
+ return 'v7.17.0-cjs';
262
262
  }
263
263
  catch (error) {
264
264
  return '__dev__';
@@ -15562,6 +15562,59 @@ const isUserFlaggedByMe = async (userId) => {
15562
15562
  };
15563
15563
  /* end_public_function */
15564
15564
 
15565
+ function prepareBlockedUserPayload(response) {
15566
+ const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
15567
+ return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
15568
+ const followUser = users.find(user => user.userId === follow.from);
15569
+ return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
15570
+ }), users: users.map(convertRawUserToInternalUser) });
15571
+ }
15572
+
15573
+ const BLOCK_LIST_DEFAULT_PAGE_LIMIT = 100;
15574
+ /* begin_public_function
15575
+ id: user.get_blocked_users_list
15576
+ */
15577
+ /**
15578
+ * ```js
15579
+ * import { UserRepository } from '@amityco/ts-sdk'
15580
+ * const blockedUsers = await UserRepository.getBlockedUsersList()
15581
+ * // or with a limit on total results:
15582
+ * const blockedUsers = await UserRepository.getBlockedUsersList({ limit: 3 })
15583
+ * ```
15584
+ *
15585
+ * Fetches blocked {@link Amity.User} objects without requiring manual pagination.
15586
+ * Intended for UI interception to filter content from blocked users.
15587
+ *
15588
+ * @param params Optional parameters
15589
+ * @param params.limit Maximum total number of blocked users to return (max: 100). Fetches all if not specified.
15590
+ * @returns Array of blocked {@link Amity.User} objects
15591
+ *
15592
+ * @category Block API
15593
+ * @async
15594
+ */
15595
+ const getBlockedUsersList = async (params) => {
15596
+ const client = getActiveClient();
15597
+ client.log('user/getBlockedUsersList');
15598
+ const maxResults = (params === null || params === void 0 ? void 0 : params.limit) !== undefined ? Math.min(params.limit, BLOCK_LIST_DEFAULT_PAGE_LIMIT) : undefined;
15599
+ const allUsers = [];
15600
+ let token;
15601
+ do {
15602
+ const remaining = maxResults !== undefined ? maxResults - allUsers.length : BLOCK_LIST_DEFAULT_PAGE_LIMIT;
15603
+ const options = token ? { token } : { limit: remaining };
15604
+ // eslint-disable-next-line no-await-in-loop
15605
+ const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options, isDeleted: false } });
15606
+ const cachedAt = client.cache && Date.now();
15607
+ const payload = prepareBlockedUserPayload(data);
15608
+ if (client.cache) {
15609
+ ingestInCache(payload, { cachedAt });
15610
+ }
15611
+ allUsers.push(...payload.users);
15612
+ token = data.paging.next;
15613
+ } while (token && (maxResults === undefined || allUsers.length < maxResults));
15614
+ return allUsers.map(userLinkedObject);
15615
+ };
15616
+ /* end_public_function */
15617
+
15565
15618
  /**
15566
15619
  * ```js
15567
15620
  * import { onUserUpdated } from '@amityco/ts-sdk'
@@ -15983,14 +16036,6 @@ class BlockedUserQueryStreamController extends QueryStreamController {
15983
16036
  }
15984
16037
  }
15985
16038
 
15986
- function prepareBlockedUserPayload(response) {
15987
- const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
15988
- return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
15989
- const followUser = users.find(user => user.userId === follow.from);
15990
- return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
15991
- }), users: users.map(convertRawUserToInternalUser) });
15992
- }
15993
-
15994
16039
  const convertEventPayload = (eventHandler, sourceModelProp, destinationDomain) => (callback) => eventHandler(sourceModel => {
15995
16040
  var _a;
15996
16041
  if (!sourceModel) {
@@ -16377,6 +16422,7 @@ var index$q = /*#__PURE__*/Object.freeze({
16377
16422
  flagUser: flagUser,
16378
16423
  unflagUser: unflagUser,
16379
16424
  isUserFlaggedByMe: isUserFlaggedByMe,
16425
+ getBlockedUsersList: getBlockedUsersList,
16380
16426
  onUserUpdated: onUserUpdated,
16381
16427
  onUserDeleted: onUserDeleted$2,
16382
16428
  onUserFlagged: onUserFlagged,
package/dist/index.esm.js CHANGED
@@ -242,8 +242,8 @@ var AnalyticsSourceTypeEnum;
242
242
 
243
243
  function getVersion() {
244
244
  try {
245
- // the string ''v7.16.0-esm'' should be replaced by actual value by @rollup/plugin-replace
246
- return 'v7.16.0-esm';
245
+ // the string ''v7.17.0-esm'' should be replaced by actual value by @rollup/plugin-replace
246
+ return 'v7.17.0-esm';
247
247
  }
248
248
  catch (error) {
249
249
  return '__dev__';
@@ -31654,6 +31654,59 @@ const isUserFlaggedByMe = async (userId) => {
31654
31654
  };
31655
31655
  /* end_public_function */
31656
31656
 
31657
+ function prepareBlockedUserPayload(response) {
31658
+ const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
31659
+ return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
31660
+ const followUser = users.find(user => user.userId === follow.from);
31661
+ return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
31662
+ }), users: users.map(convertRawUserToInternalUser) });
31663
+ }
31664
+
31665
+ const BLOCK_LIST_DEFAULT_PAGE_LIMIT = 100;
31666
+ /* begin_public_function
31667
+ id: user.get_blocked_users_list
31668
+ */
31669
+ /**
31670
+ * ```js
31671
+ * import { UserRepository } from '@amityco/ts-sdk'
31672
+ * const blockedUsers = await UserRepository.getBlockedUsersList()
31673
+ * // or with a limit on total results:
31674
+ * const blockedUsers = await UserRepository.getBlockedUsersList({ limit: 3 })
31675
+ * ```
31676
+ *
31677
+ * Fetches blocked {@link Amity.User} objects without requiring manual pagination.
31678
+ * Intended for UI interception to filter content from blocked users.
31679
+ *
31680
+ * @param params Optional parameters
31681
+ * @param params.limit Maximum total number of blocked users to return (max: 100). Fetches all if not specified.
31682
+ * @returns Array of blocked {@link Amity.User} objects
31683
+ *
31684
+ * @category Block API
31685
+ * @async
31686
+ */
31687
+ const getBlockedUsersList = async (params) => {
31688
+ const client = getActiveClient();
31689
+ client.log('user/getBlockedUsersList');
31690
+ const maxResults = (params === null || params === void 0 ? void 0 : params.limit) !== undefined ? Math.min(params.limit, BLOCK_LIST_DEFAULT_PAGE_LIMIT) : undefined;
31691
+ const allUsers = [];
31692
+ let token;
31693
+ do {
31694
+ const remaining = maxResults !== undefined ? maxResults - allUsers.length : BLOCK_LIST_DEFAULT_PAGE_LIMIT;
31695
+ const options = token ? { token } : { limit: remaining };
31696
+ // eslint-disable-next-line no-await-in-loop
31697
+ const { data } = await client.http.get('/api/v4/me/user-blocks', { params: { options, isDeleted: false } });
31698
+ const cachedAt = client.cache && Date.now();
31699
+ const payload = prepareBlockedUserPayload(data);
31700
+ if (client.cache) {
31701
+ ingestInCache(payload, { cachedAt });
31702
+ }
31703
+ allUsers.push(...payload.users);
31704
+ token = data.paging.next;
31705
+ } while (token && (maxResults === undefined || allUsers.length < maxResults));
31706
+ return allUsers.map(userLinkedObject);
31707
+ };
31708
+ /* end_public_function */
31709
+
31657
31710
  /**
31658
31711
  * ```js
31659
31712
  * import { onUserUpdated } from '@amityco/ts-sdk'
@@ -32075,14 +32128,6 @@ class BlockedUserQueryStreamController extends QueryStreamController {
32075
32128
  }
32076
32129
  }
32077
32130
 
32078
- function prepareBlockedUserPayload(response) {
32079
- const { users, follows } = response, rest = __rest(response, ["users", "follows"]);
32080
- return Object.assign(Object.assign({}, rest), { follows: follows.map(follow => {
32081
- const followUser = users.find(user => user.userId === follow.from);
32082
- return Object.assign(Object.assign({}, follow), { user: convertRawUserToInternalUser(followUser) });
32083
- }), users: users.map(convertRawUserToInternalUser) });
32084
- }
32085
-
32086
32131
  const convertEventPayload = (eventHandler, sourceModelProp, destinationDomain) => (callback) => eventHandler(sourceModel => {
32087
32132
  var _a;
32088
32133
  if (!sourceModel) {
@@ -32469,6 +32514,7 @@ var index$q = /*#__PURE__*/Object.freeze({
32469
32514
  flagUser: flagUser,
32470
32515
  unflagUser: unflagUser,
32471
32516
  isUserFlaggedByMe: isUserFlaggedByMe,
32517
+ getBlockedUsersList: getBlockedUsersList,
32472
32518
  onUserUpdated: onUserUpdated,
32473
32519
  onUserDeleted: onUserDeleted$2,
32474
32520
  onUserFlagged: onUserFlagged,