@amityco/ts-sdk 6.2.1-ca3e600.0 → 6.2.1-d2d529b.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 (22) hide show
  1. package/dist/communityRepository/communityModeration/api/banMembers.d.ts +16 -0
  2. package/dist/communityRepository/communityModeration/api/banMembers.d.ts.map +1 -0
  3. package/dist/communityRepository/communityModeration/api/index.d.ts +2 -0
  4. package/dist/communityRepository/communityModeration/api/index.d.ts.map +1 -1
  5. package/dist/communityRepository/communityModeration/api/test/banMembers.test.d.ts +2 -0
  6. package/dist/communityRepository/communityModeration/api/test/banMembers.test.d.ts.map +1 -0
  7. package/dist/communityRepository/communityModeration/api/test/unbanMembers.test.d.ts +2 -0
  8. package/dist/communityRepository/communityModeration/api/test/unbanMembers.test.d.ts.map +1 -0
  9. package/dist/communityRepository/communityModeration/api/unbanMembers.d.ts +16 -0
  10. package/dist/communityRepository/communityModeration/api/unbanMembers.d.ts.map +1 -0
  11. package/dist/core/query/filtering.d.ts.map +1 -1
  12. package/dist/index.cjs.js +81 -5
  13. package/dist/index.esm.js +81 -5
  14. package/dist/index.umd.js +4 -4
  15. package/package.json +1 -1
  16. package/src/communityRepository/communityModeration/api/banMembers.ts +50 -0
  17. package/src/communityRepository/communityModeration/api/index.ts +4 -0
  18. package/src/communityRepository/communityModeration/api/test/banMembers.test.ts +70 -0
  19. package/src/communityRepository/communityModeration/api/test/unbanMembers.test.ts +70 -0
  20. package/src/communityRepository/communityModeration/api/unbanMembers.ts +50 -0
  21. package/src/core/query/filtering.ts +4 -0
  22. package/src/core/query/tests/filtering.test.ts +6 -0
@@ -0,0 +1,16 @@
1
+ /**
2
+ * ```js
3
+ * import { CommunityRepository } from '@amityco/ts-sdk'
4
+ *
5
+ * await CommunityRepository.Moderation.banMembers('communityId', ['userId1', 'userId2'])
6
+ * ```
7
+ *
8
+ * @param communityId of {@link Amity.Community} from which the users should be banned
9
+ * @param userIds of the {@link Amity.User}'s to be banned
10
+ * @returns the updated {@link Amity.Membership}'s object
11
+ *
12
+ * @category Community API
13
+ * @async
14
+ * */
15
+ export declare const banMembers: (communityId: Amity.Community['communityId'], userIds: Amity.User['userId'][]) => Promise<Amity.Cached<Amity.Membership<'community'>[]>>;
16
+ //# sourceMappingURL=banMembers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banMembers.d.ts","sourceRoot":"","sources":["../../../../src/communityRepository/communityModeration/api/banMembers.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;KAaK;AACL,eAAO,MAAM,UAAU,gBACR,MAAM,SAAS,CAAC,aAAa,CAAC,WAClC,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,KAC9B,QAAQ,MAAM,MAAM,CAAC,MAAM,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAsBvD,CAAC"}
@@ -2,4 +2,6 @@ export * from './addMembers';
2
2
  export * from './removeMembers';
3
3
  export * from './addRoles';
4
4
  export * from './removeRoles';
5
+ export * from './banMembers';
6
+ export * from './unbanMembers';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/communityRepository/communityModeration/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/communityRepository/communityModeration/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAEhC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAE9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=banMembers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banMembers.test.d.ts","sourceRoot":"","sources":["../../../../../src/communityRepository/communityModeration/api/test/banMembers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=unbanMembers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unbanMembers.test.d.ts","sourceRoot":"","sources":["../../../../../src/communityRepository/communityModeration/api/test/unbanMembers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * ```js
3
+ * import { CommunityRepository } from '@amityco/ts-sdk'
4
+ *
5
+ * await CommunityRepository.Moderation.unbanMembers('communityId', ['userId1', 'userId2'])
6
+ * ```
7
+ *
8
+ * @param communityId of {@link Amity.Community} from which the users should be unbanned
9
+ * @param userIds of the {@link Amity.User}'s to be unbanned
10
+ * @returns the updated {@link Amity.Membership}'s object
11
+ *
12
+ * @category Community API
13
+ * @async
14
+ * */
15
+ export declare const unbanMembers: (communityId: Amity.Community['communityId'], userIds: Amity.User['userId'][]) => Promise<Amity.Cached<Amity.Membership<'community'>[]>>;
16
+ //# sourceMappingURL=unbanMembers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unbanMembers.d.ts","sourceRoot":"","sources":["../../../../src/communityRepository/communityModeration/api/unbanMembers.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;KAaK;AACL,eAAO,MAAM,YAAY,gBACV,MAAM,SAAS,CAAC,aAAa,CAAC,WAClC,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,KAC9B,QAAQ,MAAM,MAAM,CAAC,MAAM,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAsBvD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"filtering.d.ts","sourceRoot":"","sources":["../../../src/core/query/filtering.ts"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,sEAGxB,GAAG,QAII,CAAC;AAEjB,eAAO,MAAM,qBAAqB,sEAG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;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,2DAE1B,MAAM,uBAAuB,CAAC,YAAY,CAAC,UAC/C,MAAM,UAAU,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,QA0BhD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,0DAErB,MAAM,kBAAkB,CAAC,WAAW,CAAC,QAyBjD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB;YAAwB,MAAM,IAAI,CAAC,QAAQ,CAAC;;gCAE7D,MAAM,QAanB,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -1218,6 +1218,10 @@ const filterByPostDataTypes = (collection, dataTypes) => {
1218
1218
  * @hidden
1219
1219
  */
1220
1220
  const filterBySearchTerm = (collection, searchTerm) => {
1221
+ /*
1222
+ * Search term should match regardless of the case.
1223
+ * Hence, the flag "i", is passed to the created regex
1224
+ */
1221
1225
  const containsMatcher = new RegExp(searchTerm, 'i');
1222
1226
  return collection.filter(m => {
1223
1227
  var _a;
@@ -27516,7 +27520,7 @@ const removeRole = async (channelId, roleId, userIds) => {
27516
27520
  * @category Channel API
27517
27521
  * @async
27518
27522
  * */
27519
- const banMembers = async (channelId, userIds) => {
27523
+ const banMembers$1 = async (channelId, userIds) => {
27520
27524
  const client = getActiveClient();
27521
27525
  client.log('channel/banMembers', { userIds, channelId });
27522
27526
  const { data: payload } = await client.http.put(`/api/v3/channels/${channelId}/users/ban`, {
@@ -27551,7 +27555,7 @@ const banMembers = async (channelId, userIds) => {
27551
27555
  * @category Channel API
27552
27556
  * @async
27553
27557
  * */
27554
- const unbanMembers = async (channelId, userIds) => {
27558
+ const unbanMembers$1 = async (channelId, userIds) => {
27555
27559
  const client = getActiveClient();
27556
27560
  client.log('channel/unbanMembers', { userIds, channelId });
27557
27561
  const { data: payload } = await client.http.put(`/api/v3/channels/${encodeURIComponent(channelId)}/users/unban`, {
@@ -27573,8 +27577,8 @@ var index$c = /*#__PURE__*/Object.freeze({
27573
27577
  __proto__: null,
27574
27578
  addRole: addRole,
27575
27579
  removeRole: removeRole,
27576
- banMembers: banMembers,
27577
- unbanMembers: unbanMembers
27580
+ banMembers: banMembers$1,
27581
+ unbanMembers: unbanMembers$1
27578
27582
  });
27579
27583
 
27580
27584
  var index$b = /*#__PURE__*/Object.freeze({
@@ -29934,12 +29938,84 @@ const removeRoles = async (communityId, roleIds, userIds) => {
29934
29938
  };
29935
29939
  /* end_public_function */
29936
29940
 
29941
+ /* begin_public_function
29942
+ id: community.moderation.ban_members
29943
+ */
29944
+ /**
29945
+ * ```js
29946
+ * import { CommunityRepository } from '@amityco/ts-sdk'
29947
+ *
29948
+ * await CommunityRepository.Moderation.banMembers('communityId', ['userId1', 'userId2'])
29949
+ * ```
29950
+ *
29951
+ * @param communityId of {@link Amity.Community} from which the users should be banned
29952
+ * @param userIds of the {@link Amity.User}'s to be banned
29953
+ * @returns the updated {@link Amity.Membership}'s object
29954
+ *
29955
+ * @category Community API
29956
+ * @async
29957
+ * */
29958
+ const banMembers = async (communityId, userIds) => {
29959
+ const client = getActiveClient();
29960
+ client.log('community/banMembers', { userIds, communityId });
29961
+ const { data: payload } = await client.http.put(`/api/v3/communities/${communityId}/users/ban`, {
29962
+ userIds,
29963
+ });
29964
+ const data = prepareMembershipPayload(payload, 'communityUsers');
29965
+ const cachedAt = client.cache && Date.now();
29966
+ if (client.cache)
29967
+ ingestInCache(data, { cachedAt });
29968
+ const { communityUsers } = data;
29969
+ return {
29970
+ data: communityUsers.filter(u => userIds.includes(u.userId)),
29971
+ cachedAt,
29972
+ };
29973
+ };
29974
+ /* end_public_function */
29975
+
29976
+ /* begin_public_function
29977
+ id: community.moderation.unban_members
29978
+ */
29979
+ /**
29980
+ * ```js
29981
+ * import { CommunityRepository } from '@amityco/ts-sdk'
29982
+ *
29983
+ * await CommunityRepository.Moderation.unbanMembers('communityId', ['userId1', 'userId2'])
29984
+ * ```
29985
+ *
29986
+ * @param communityId of {@link Amity.Community} from which the users should be unbanned
29987
+ * @param userIds of the {@link Amity.User}'s to be unbanned
29988
+ * @returns the updated {@link Amity.Membership}'s object
29989
+ *
29990
+ * @category Community API
29991
+ * @async
29992
+ * */
29993
+ const unbanMembers = async (communityId, userIds) => {
29994
+ const client = getActiveClient();
29995
+ client.log('community/unbanMembers', { userIds, communityId });
29996
+ const { data: payload } = await client.http.put(`/api/v3/communities/${communityId}/users/unban`, {
29997
+ userIds,
29998
+ });
29999
+ const data = prepareMembershipPayload(payload, 'communityUsers');
30000
+ const cachedAt = client.cache && Date.now();
30001
+ if (client.cache)
30002
+ ingestInCache(data, { cachedAt });
30003
+ const { communityUsers } = data;
30004
+ return {
30005
+ data: communityUsers.filter(u => userIds.includes(u.userId)),
30006
+ cachedAt,
30007
+ };
30008
+ };
30009
+ /* end_public_function */
30010
+
29937
30011
  var index$8 = /*#__PURE__*/Object.freeze({
29938
30012
  __proto__: null,
29939
30013
  addMembers: addMembers,
29940
30014
  removeMembers: removeMembers,
29941
30015
  addRoles: addRoles,
29942
- removeRoles: removeRoles
30016
+ removeRoles: removeRoles,
30017
+ banMembers: banMembers,
30018
+ unbanMembers: unbanMembers
29943
30019
  });
29944
30020
 
29945
30021
  /**
package/dist/index.esm.js CHANGED
@@ -1204,6 +1204,10 @@ const filterByPostDataTypes = (collection, dataTypes) => {
1204
1204
  * @hidden
1205
1205
  */
1206
1206
  const filterBySearchTerm = (collection, searchTerm) => {
1207
+ /*
1208
+ * Search term should match regardless of the case.
1209
+ * Hence, the flag "i", is passed to the created regex
1210
+ */
1207
1211
  const containsMatcher = new RegExp(searchTerm, 'i');
1208
1212
  return collection.filter(m => {
1209
1213
  var _a;
@@ -27502,7 +27506,7 @@ const removeRole = async (channelId, roleId, userIds) => {
27502
27506
  * @category Channel API
27503
27507
  * @async
27504
27508
  * */
27505
- const banMembers = async (channelId, userIds) => {
27509
+ const banMembers$1 = async (channelId, userIds) => {
27506
27510
  const client = getActiveClient();
27507
27511
  client.log('channel/banMembers', { userIds, channelId });
27508
27512
  const { data: payload } = await client.http.put(`/api/v3/channels/${channelId}/users/ban`, {
@@ -27537,7 +27541,7 @@ const banMembers = async (channelId, userIds) => {
27537
27541
  * @category Channel API
27538
27542
  * @async
27539
27543
  * */
27540
- const unbanMembers = async (channelId, userIds) => {
27544
+ const unbanMembers$1 = async (channelId, userIds) => {
27541
27545
  const client = getActiveClient();
27542
27546
  client.log('channel/unbanMembers', { userIds, channelId });
27543
27547
  const { data: payload } = await client.http.put(`/api/v3/channels/${encodeURIComponent(channelId)}/users/unban`, {
@@ -27559,8 +27563,8 @@ var index$c = /*#__PURE__*/Object.freeze({
27559
27563
  __proto__: null,
27560
27564
  addRole: addRole,
27561
27565
  removeRole: removeRole,
27562
- banMembers: banMembers,
27563
- unbanMembers: unbanMembers
27566
+ banMembers: banMembers$1,
27567
+ unbanMembers: unbanMembers$1
27564
27568
  });
27565
27569
 
27566
27570
  var index$b = /*#__PURE__*/Object.freeze({
@@ -29920,12 +29924,84 @@ const removeRoles = async (communityId, roleIds, userIds) => {
29920
29924
  };
29921
29925
  /* end_public_function */
29922
29926
 
29927
+ /* begin_public_function
29928
+ id: community.moderation.ban_members
29929
+ */
29930
+ /**
29931
+ * ```js
29932
+ * import { CommunityRepository } from '@amityco/ts-sdk'
29933
+ *
29934
+ * await CommunityRepository.Moderation.banMembers('communityId', ['userId1', 'userId2'])
29935
+ * ```
29936
+ *
29937
+ * @param communityId of {@link Amity.Community} from which the users should be banned
29938
+ * @param userIds of the {@link Amity.User}'s to be banned
29939
+ * @returns the updated {@link Amity.Membership}'s object
29940
+ *
29941
+ * @category Community API
29942
+ * @async
29943
+ * */
29944
+ const banMembers = async (communityId, userIds) => {
29945
+ const client = getActiveClient();
29946
+ client.log('community/banMembers', { userIds, communityId });
29947
+ const { data: payload } = await client.http.put(`/api/v3/communities/${communityId}/users/ban`, {
29948
+ userIds,
29949
+ });
29950
+ const data = prepareMembershipPayload(payload, 'communityUsers');
29951
+ const cachedAt = client.cache && Date.now();
29952
+ if (client.cache)
29953
+ ingestInCache(data, { cachedAt });
29954
+ const { communityUsers } = data;
29955
+ return {
29956
+ data: communityUsers.filter(u => userIds.includes(u.userId)),
29957
+ cachedAt,
29958
+ };
29959
+ };
29960
+ /* end_public_function */
29961
+
29962
+ /* begin_public_function
29963
+ id: community.moderation.unban_members
29964
+ */
29965
+ /**
29966
+ * ```js
29967
+ * import { CommunityRepository } from '@amityco/ts-sdk'
29968
+ *
29969
+ * await CommunityRepository.Moderation.unbanMembers('communityId', ['userId1', 'userId2'])
29970
+ * ```
29971
+ *
29972
+ * @param communityId of {@link Amity.Community} from which the users should be unbanned
29973
+ * @param userIds of the {@link Amity.User}'s to be unbanned
29974
+ * @returns the updated {@link Amity.Membership}'s object
29975
+ *
29976
+ * @category Community API
29977
+ * @async
29978
+ * */
29979
+ const unbanMembers = async (communityId, userIds) => {
29980
+ const client = getActiveClient();
29981
+ client.log('community/unbanMembers', { userIds, communityId });
29982
+ const { data: payload } = await client.http.put(`/api/v3/communities/${communityId}/users/unban`, {
29983
+ userIds,
29984
+ });
29985
+ const data = prepareMembershipPayload(payload, 'communityUsers');
29986
+ const cachedAt = client.cache && Date.now();
29987
+ if (client.cache)
29988
+ ingestInCache(data, { cachedAt });
29989
+ const { communityUsers } = data;
29990
+ return {
29991
+ data: communityUsers.filter(u => userIds.includes(u.userId)),
29992
+ cachedAt,
29993
+ };
29994
+ };
29995
+ /* end_public_function */
29996
+
29923
29997
  var index$8 = /*#__PURE__*/Object.freeze({
29924
29998
  __proto__: null,
29925
29999
  addMembers: addMembers,
29926
30000
  removeMembers: removeMembers,
29927
30001
  addRoles: addRoles,
29928
- removeRoles: removeRoles
30002
+ removeRoles: removeRoles,
30003
+ banMembers: banMembers,
30004
+ unbanMembers: unbanMembers
29929
30005
  });
29930
30006
 
29931
30007
  /**