@amityco/ts-sdk 7.17.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 +55 -9
- package/dist/index.esm.js +55 -9
- package/dist/index.umd.js +3 -3
- package/dist/userRepository/api/getBlockedUsersList.d.ts +22 -0
- package/dist/userRepository/api/getBlockedUsersList.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/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -13051,7 +13051,7 @@ const getWatchSessionStorage = () => {
|
|
|
13051
13051
|
return storageInstance;
|
|
13052
13052
|
};
|
|
13053
13053
|
|
|
13054
|
-
const privateKey = "
|
|
13054
|
+
const privateKey = "MIIEpQIBAAKCAQEAwAEc/oZgYIvKSUG/C3mONYLR4ZPgAjMEX4bJ+xqqakUDRtqlNO+eZs2blQ1Ko0DBkqPExyQezvjibH5W2UZBV5RaBTlTcNVKTToMBEGesAfaEcM3qUyQHxdbFYZv6P4sb14dcwxTQ8usmaV8ooiR1Fcaso5ZWYcZ8Hb46FbQ7OoVumsBtPWwfZ4f003o5VCl6AIM6lcLv9UDLlFVYhE+PeXpRHtfWlGqxMvqC9oinlwhL6nWv6VjQXW4nhcib72dPBzfHT7k/PMKto2SxALYdb68ENiAGuJLWi3AUHSyYCJK2w7wIlWfJUAI0v26ub10IpExr6D5QuW2577jjP93iwIDAQABAoIBAFWfqXhwIIatkFY+9Z1+ZcbDQimgsmMIsUiQaX6Lk7e0cxOj6czDlxYtVtaPiNtow2pLkjNkjkCqiP7tEHnwdK9DvylZOTa2R15NJpK3WLcTqVIGhsn/FL5owfvFah6zSsmXZParZm5zY9NZE03ALZhOB9/cz0e3kf/EbpfeL2mW7MApyiUt5i09ycchroOpcWp73ipIxvgigtZyUGFmsQicWhUs28F0D7w4Qfk76yG3nqXeb+BAMhCaIaa/k/aAxhiZG/ygEQWQrcC8gfe+jyicMAQPDEVS9YuUMGsLjIjKuVLZzp2xirQnhc2i2zVNEIvG6soprPOBEMQugzrtX5ECgYEA3b7KAbBIbDl1e4ZSCWhHdHkiWVZHaopsR/LhqDDNhXjWjq3AesgV6k0j9EdziMn/HmmOso0bz99GTV3JZf4A9ztTLumJlkHbdVtlgOqSjrFLj12rH9KXTheyIhWSpUmm8+WB1xasFbqpvJaGo7F3pd2Fqj1XR4mp5BO7c/t7LJ0CgYEA3aouEzXQ9THRKYocdfY69EI1Il1t/d/RSqqd9BxEjxBgxkM13ZiYIn/R4WW/nCUrlmhxG44Aa2Gob4Ahfsui2xKTg/g/3Zk/rAxAEGkfOLGoenaJMD41fH4wUq3FRYwkvnaMb9Hd6f/TlBHslIRa2NN58bSBGJCyBP2b59+2+EcCgYEAixDVRXvV37GlYUOa/XVdosk5Zoe6oDGRuQm0xbNdoUBoZvDHDvme7ONWEiQha/8qtVsD+CyQ7awcPfb8kK9c0bBt+bTS6d4BkTcxkEkMgtrkBVR8Nqfu5jXsLH4VCv4G61zbMhZw8+ut+az5YX2yCN7Frj9sFlxapMRPQmzMEe0CgYEAumsAzM8ZqNv4mAK65Mnr0rhLj1cbxcKRdUYACOgtEFQpzxN/HZnTeFAe5nx3pI3uFlRHq3DFEYnT6dHMWaJQmAULYpVIwMi9L6gtyJ9fzoI6uqMtxRDMUqKdaSsTGOY/kJ6KhQ/unXi1K3XXjR+yd1+C0q+HUm1+CYxvrZYLfskCgYEArsEy+IQOiqniJ0NE2vVUF+UK/IRZaic9YKcpov5Ot7Vvzm/MnnW4N1ljVskocETBWMmPUvNSExVjPebi+rxd8fa5kY8BJScPTzMFbunZn/wjtGdcM10qdlVQ9doG61A/9P3ezFKCfS4AvF/H/59LcSx2Bh28fp3/efiVIOpVd4Y=";
|
|
13055
13055
|
/*
|
|
13056
13056
|
* The crypto algorithm used for importing key and signing string
|
|
13057
13057
|
*/
|
|
@@ -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
|
@@ -29143,7 +29143,7 @@ const getWatchSessionStorage = () => {
|
|
|
29143
29143
|
return storageInstance;
|
|
29144
29144
|
};
|
|
29145
29145
|
|
|
29146
|
-
const privateKey = "
|
|
29146
|
+
const privateKey = "MIIEpQIBAAKCAQEAwAEc/oZgYIvKSUG/C3mONYLR4ZPgAjMEX4bJ+xqqakUDRtqlNO+eZs2blQ1Ko0DBkqPExyQezvjibH5W2UZBV5RaBTlTcNVKTToMBEGesAfaEcM3qUyQHxdbFYZv6P4sb14dcwxTQ8usmaV8ooiR1Fcaso5ZWYcZ8Hb46FbQ7OoVumsBtPWwfZ4f003o5VCl6AIM6lcLv9UDLlFVYhE+PeXpRHtfWlGqxMvqC9oinlwhL6nWv6VjQXW4nhcib72dPBzfHT7k/PMKto2SxALYdb68ENiAGuJLWi3AUHSyYCJK2w7wIlWfJUAI0v26ub10IpExr6D5QuW2577jjP93iwIDAQABAoIBAFWfqXhwIIatkFY+9Z1+ZcbDQimgsmMIsUiQaX6Lk7e0cxOj6czDlxYtVtaPiNtow2pLkjNkjkCqiP7tEHnwdK9DvylZOTa2R15NJpK3WLcTqVIGhsn/FL5owfvFah6zSsmXZParZm5zY9NZE03ALZhOB9/cz0e3kf/EbpfeL2mW7MApyiUt5i09ycchroOpcWp73ipIxvgigtZyUGFmsQicWhUs28F0D7w4Qfk76yG3nqXeb+BAMhCaIaa/k/aAxhiZG/ygEQWQrcC8gfe+jyicMAQPDEVS9YuUMGsLjIjKuVLZzp2xirQnhc2i2zVNEIvG6soprPOBEMQugzrtX5ECgYEA3b7KAbBIbDl1e4ZSCWhHdHkiWVZHaopsR/LhqDDNhXjWjq3AesgV6k0j9EdziMn/HmmOso0bz99GTV3JZf4A9ztTLumJlkHbdVtlgOqSjrFLj12rH9KXTheyIhWSpUmm8+WB1xasFbqpvJaGo7F3pd2Fqj1XR4mp5BO7c/t7LJ0CgYEA3aouEzXQ9THRKYocdfY69EI1Il1t/d/RSqqd9BxEjxBgxkM13ZiYIn/R4WW/nCUrlmhxG44Aa2Gob4Ahfsui2xKTg/g/3Zk/rAxAEGkfOLGoenaJMD41fH4wUq3FRYwkvnaMb9Hd6f/TlBHslIRa2NN58bSBGJCyBP2b59+2+EcCgYEAixDVRXvV37GlYUOa/XVdosk5Zoe6oDGRuQm0xbNdoUBoZvDHDvme7ONWEiQha/8qtVsD+CyQ7awcPfb8kK9c0bBt+bTS6d4BkTcxkEkMgtrkBVR8Nqfu5jXsLH4VCv4G61zbMhZw8+ut+az5YX2yCN7Frj9sFlxapMRPQmzMEe0CgYEAumsAzM8ZqNv4mAK65Mnr0rhLj1cbxcKRdUYACOgtEFQpzxN/HZnTeFAe5nx3pI3uFlRHq3DFEYnT6dHMWaJQmAULYpVIwMi9L6gtyJ9fzoI6uqMtxRDMUqKdaSsTGOY/kJ6KhQ/unXi1K3XXjR+yd1+C0q+HUm1+CYxvrZYLfskCgYEArsEy+IQOiqniJ0NE2vVUF+UK/IRZaic9YKcpov5Ot7Vvzm/MnnW4N1ljVskocETBWMmPUvNSExVjPebi+rxd8fa5kY8BJScPTzMFbunZn/wjtGdcM10qdlVQ9doG61A/9P3ezFKCfS4AvF/H/59LcSx2Bh28fp3/efiVIOpVd4Y=";
|
|
29147
29147
|
/*
|
|
29148
29148
|
* The crypto algorithm used for importing key and signing string
|
|
29149
29149
|
*/
|
|
@@ -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,
|