@amityco/ts-sdk 7.5.4-2d34fd5f.0 → 7.5.4-3506dd3.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 (51) hide show
  1. package/dist/@types/domains/content.d.ts +2 -8
  2. package/dist/@types/domains/content.d.ts.map +1 -1
  3. package/dist/@types/domains/feed.d.ts +1 -2
  4. package/dist/@types/domains/feed.d.ts.map +1 -1
  5. package/dist/@types/domains/file.d.ts +1 -3
  6. package/dist/@types/domains/file.d.ts.map +1 -1
  7. package/dist/@types/domains/post.d.ts +0 -3
  8. package/dist/@types/domains/post.d.ts.map +1 -1
  9. package/dist/communityRepository/api/deleteCommunity.d.ts.map +1 -1
  10. package/dist/communityRepository/api/getCommunity.d.ts +2 -2
  11. package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
  12. package/dist/communityRepository/observers/getCommunity.d.ts.map +1 -1
  13. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts.map +1 -1
  14. package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts +1 -1
  15. package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts.map +1 -1
  16. package/dist/feedRepository/api/queryGlobalFeed.d.ts.map +1 -1
  17. package/dist/fileRepository/api/index.d.ts +0 -1
  18. package/dist/fileRepository/api/index.d.ts.map +1 -1
  19. package/dist/index.cjs.js +9 -121
  20. package/dist/index.esm.js +9 -121
  21. package/dist/index.umd.js +2 -2
  22. package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
  23. package/dist/postRepository/api/index.d.ts +0 -1
  24. package/dist/postRepository/api/index.d.ts.map +1 -1
  25. package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
  26. package/dist/utils/postTypePredicate.d.ts +0 -1
  27. package/dist/utils/postTypePredicate.d.ts.map +1 -1
  28. package/dist/utils/tests/dummy/comment.d.ts +1 -1
  29. package/package.json +1 -1
  30. package/src/@types/domains/content.ts +0 -10
  31. package/src/@types/domains/feed.ts +1 -2
  32. package/src/@types/domains/file.ts +0 -5
  33. package/src/@types/domains/post.ts +0 -4
  34. package/src/communityRepository/api/deleteCommunity.ts +1 -2
  35. package/src/communityRepository/api/getCommunity.ts +7 -5
  36. package/src/communityRepository/observers/getCommunity.ts +12 -24
  37. package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts +2 -1
  38. package/src/feedRepository/api/getCustomRankingGlobalFeed.ts +1 -1
  39. package/src/feedRepository/api/queryGlobalFeed.ts +1 -3
  40. package/src/fileRepository/api/index.ts +0 -1
  41. package/src/postRepository/api/index.ts +0 -2
  42. package/src/postRepository/api/queryPosts.ts +1 -1
  43. package/src/postRepository/observers/getPosts/PostPaginationController.ts +1 -1
  44. package/src/utils/linkedObject/postLinkedObject.ts +1 -12
  45. package/src/utils/postTypePredicate.ts +0 -10
  46. package/dist/fileRepository/api/uploadClip.d.ts +0 -17
  47. package/dist/fileRepository/api/uploadClip.d.ts.map +0 -1
  48. package/dist/postRepository/api/createClipPost.d.ts +0 -32
  49. package/dist/postRepository/api/createClipPost.d.ts.map +0 -1
  50. package/src/fileRepository/api/uploadClip.ts +0 -71
  51. package/src/postRepository/api/createClipPost.ts +0 -62
package/dist/index.esm.js CHANGED
@@ -18,7 +18,6 @@ const FileType = Object.freeze({
18
18
  FILE: 'file',
19
19
  IMAGE: 'image',
20
20
  VIDEO: 'video',
21
- CLIP: 'clip',
22
21
  });
23
22
  const VideoResolution = Object.freeze({
24
23
  '1080P': '1080p',
@@ -102,7 +101,6 @@ const PostContentType = Object.freeze({
102
101
  VIDEO: 'video',
103
102
  LIVESTREAM: 'liveStream',
104
103
  POLL: 'poll',
105
- CLIP: 'clip',
106
104
  });
107
105
 
108
106
  var InvitationTypeEnum;
@@ -22785,13 +22783,6 @@ function isAmityVideoPost(post) {
22785
22783
  'videoFileId' in post.data &&
22786
22784
  'thumbnailFileId' in post.data &&
22787
22785
  post.dataType === 'video');
22788
- }
22789
- function isAmityClipPost(post) {
22790
- return !!(post.data &&
22791
- typeof post.data !== 'string' &&
22792
- 'fileId' in post.data &&
22793
- 'thumbnailFileId' in post.data &&
22794
- post.dataType === 'clip');
22795
22786
  }
22796
22787
 
22797
22788
  const postLinkedObject = (post) => {
@@ -22846,12 +22837,6 @@ const postLinkedObject = (post) => {
22846
22837
  return isAmityFilePost(post)
22847
22838
  ? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
22848
22839
  : undefined;
22849
- },
22850
- getClipInfo() {
22851
- var _a, _b;
22852
- return isAmityClipPost(post)
22853
- ? (_b = pullFromCache(['file', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.fileId])) === null || _b === void 0 ? void 0 : _b.data
22854
- : undefined;
22855
22840
  } });
22856
22841
  };
22857
22842
 
@@ -23832,7 +23817,7 @@ class PaginationController {
23832
23817
  */
23833
23818
  class JoinRequestsPaginationController extends PaginationController {
23834
23819
  async getRequest(queryParams, token) {
23835
- const { limit = 20, communityId } = queryParams, params = __rest(queryParams, ["limit", "communityId"]);
23820
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, communityId } = queryParams, params = __rest(queryParams, ["limit", "communityId"]);
23836
23821
  const options = token ? { token } : { limit };
23837
23822
  const { data: queryResponse } = await this.http.get(`/api/v4/communities/${communityId}/join`, {
23838
23823
  params: Object.assign(Object.assign({}, params), { options }),
@@ -29822,57 +29807,6 @@ const updateAltText = async (fileId, altText) => {
29822
29807
  };
29823
29808
  /* end_public_function */
29824
29809
 
29825
- /* begin_public_function
29826
- id: file.upload.clip
29827
- */
29828
- /**
29829
- * ```js
29830
- * import { FileRepository } from '@amityco/ts-sdk'
29831
- * const created = await FileRepository.uploadClip(formData)
29832
- * ```
29833
- *
29834
- * Creates an {@link Amity.File}
29835
- *
29836
- * @param formData The data necessary to create a new {@link Amity.File}
29837
- * @param onProgress The callback to track the upload progress
29838
- * @returns The newly created {@link Amity.File}
29839
- *
29840
- * @category File API
29841
- * @async
29842
- */
29843
- const uploadClip = async (formData, feedType, onProgress) => {
29844
- const client = getActiveClient();
29845
- client.log('file/uploadClip', formData);
29846
- const file = formData.get('files');
29847
- if (!file)
29848
- throw new Error('The formData object must have a `files` key.');
29849
- const accessType = GlobalFileAccessType$1.getInstance().getFileAccessType();
29850
- formData.append('accessType', accessType);
29851
- formData.append('preferredFilename', file.name);
29852
- if (feedType) {
29853
- formData.append('feedType', feedType);
29854
- }
29855
- const headers = 'getHeaders' in formData
29856
- ? formData.getHeaders()
29857
- : { 'content-type': 'multipart/form-data' };
29858
- const { data } = await client.upload.post('/api/v4/clips', formData, {
29859
- headers,
29860
- onUploadProgress({ loaded, total = 100 }) {
29861
- onProgress && onProgress(Math.round((loaded * 100) / total));
29862
- },
29863
- });
29864
- // API-FIX: payload should be serialized properly
29865
- // const { files } = data
29866
- const cachedAt = client.cache && Date.now();
29867
- if (client.cache)
29868
- ingestInCache({ files: data }, { cachedAt });
29869
- return {
29870
- data,
29871
- cachedAt,
29872
- };
29873
- };
29874
- /* end_public_function */
29875
-
29876
29810
  var index$k = /*#__PURE__*/Object.freeze({
29877
29811
  __proto__: null,
29878
29812
  getFile: getFile,
@@ -29881,8 +29815,7 @@ var index$k = /*#__PURE__*/Object.freeze({
29881
29815
  fileUrlWithSize: fileUrlWithSize,
29882
29816
  uploadVideo: uploadVideo,
29883
29817
  uploadImage: uploadImage,
29884
- updateAltText: updateAltText,
29885
- uploadClip: uploadClip
29818
+ updateAltText: updateAltText
29886
29819
  });
29887
29820
 
29888
29821
  /**
@@ -35767,7 +35700,7 @@ const getCommunity$1 = async (communityId, type, includeDiscoverablePrivateCommu
35767
35700
  }
35768
35701
  const { communities } = data;
35769
35702
  return {
35770
- data: communities.find(community => community.communityId === communityId),
35703
+ data: LinkedObject.community(communities.find(community => community.communityId === communityId)),
35771
35704
  cachedAt,
35772
35705
  };
35773
35706
  };
@@ -35793,7 +35726,7 @@ getCommunity$1.locally = (communityId) => {
35793
35726
  if (!cached)
35794
35727
  return;
35795
35728
  return {
35796
- data: cached.data,
35729
+ data: LinkedObject.community(cached.data),
35797
35730
  cachedAt: cached.cachedAt,
35798
35731
  };
35799
35732
  };
@@ -35829,7 +35762,7 @@ const deleteCommunity = async (communityId) => {
35829
35762
  files: [],
35830
35763
  users: [],
35831
35764
  });
35832
- return LinkedObject.community(deleted.data);
35765
+ return deleted.data;
35833
35766
  };
35834
35767
  /* end_public_function */
35835
35768
 
@@ -37339,11 +37272,7 @@ const getCommunity = (communityId, callback) => {
37339
37272
  onCommunityUserUnbanned,
37340
37273
  onCommunityUserChanged,
37341
37274
  convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
37342
- ], {
37343
- callbackDataSelector: (data) => {
37344
- return LinkedObject.community(data);
37345
- },
37346
- });
37275
+ ]);
37347
37276
  };
37348
37277
  /* end_public_function */
37349
37278
 
@@ -38482,14 +38411,14 @@ var index$a = /*#__PURE__*/Object.freeze({
38482
38411
  const queryGlobalFeed = async (query) => {
38483
38412
  const client = getActiveClient();
38484
38413
  client.log('feed/queryGlobalFeed', query);
38485
- const _a = query !== null && query !== void 0 ? query : {}, { queryToken, dataTypes, resolveParent } = _a, params = __rest(_a, ["queryToken", "dataTypes", "resolveParent"]);
38414
+ const _a = query !== null && query !== void 0 ? query : {}, { queryToken } = _a, params = __rest(_a, ["queryToken"]);
38486
38415
  const options = (() => {
38487
38416
  if (queryToken)
38488
38417
  return { token: queryToken };
38489
38418
  return undefined;
38490
38419
  })();
38491
38420
  const { data: queryPayload } = await client.http.get(`/api/v4/me/global-feeds`, {
38492
- params: Object.assign(Object.assign({}, params), { dataTypes, resolveParent: resolveParent !== null && resolveParent !== void 0 ? resolveParent : true, options }),
38421
+ params: Object.assign(Object.assign({}, params), { options }),
38493
38422
  });
38494
38423
  const { paging } = queryPayload, payload = __rest(queryPayload, ["paging"]);
38495
38424
  const data = prepareMembershipPayload(payload, 'communityUsers');
@@ -39075,46 +39004,6 @@ const isPostFlaggedByMe = async (postId) => {
39075
39004
  };
39076
39005
  /* end_public_function */
39077
39006
 
39078
- /* begin_public_function
39079
- id: post.create.clip_post
39080
- */
39081
- /**
39082
- * ```js
39083
- * import { PostRepository } from '@amityco/ts-sdk'
39084
- * const created = await PostRepository.createClipPost({
39085
- * targetType: 'user',
39086
- * targetId: 'foobar',
39087
- * dataType: 'clip',
39088
- * data: { text: 'hello world' },
39089
- * attachments: [{ type: 'clip', fileId: 'fileId123', displayMode: 'fill', isMuted: false }]
39090
- * }))
39091
- * ```
39092
- *
39093
- * Creates an {@link Amity.Post}
39094
- *
39095
- * @param bundle The data necessary to create a new {@link Amity.Post}
39096
- * @returns The newly created {@link Amity.Post}
39097
- *
39098
- * @category Post API
39099
- * @async
39100
- */
39101
- const createClipPost = async (bundle) => {
39102
- const client = getActiveClient();
39103
- client.log('post/createPost', bundle);
39104
- const { data: payload } = await client.http.post('/api/v4/posts', bundle);
39105
- fireEvent('post.created', payload);
39106
- const data = prepareMembershipPayload(payload, 'communityUsers');
39107
- const cachedAt = client.cache && Date.now();
39108
- if (client.cache)
39109
- ingestInCache(data, { cachedAt });
39110
- const { posts } = data;
39111
- return {
39112
- data: LinkedObject.post(posts[0]),
39113
- cachedAt,
39114
- };
39115
- };
39116
- /* end_public_function */
39117
-
39118
39007
  /* begin_public_function
39119
39008
  id: comment.get_by_ids
39120
39009
  */
@@ -40203,7 +40092,7 @@ class PostPaginationController extends PaginationController {
40203
40092
  type: params.sortBy || queryParams.limit ? 'pagination' : undefined,
40204
40093
  };
40205
40094
  const options = token ? Object.assign(Object.assign({}, baseOptions), { token }) : Object.assign(Object.assign({}, baseOptions), { limit });
40206
- const { data: queryResponse } = await this.http.get(`/api/v5/posts`, {
40095
+ const { data: queryResponse } = await this.http.get(`/api/v4/posts`, {
40207
40096
  params: Object.assign(Object.assign({}, params), { isDeleted: inferIsDeleted(includeDeleted),
40208
40097
  /*
40209
40098
  * when creating post like image, file, video BE will create 2 posts
@@ -41015,7 +40904,6 @@ var index$7 = /*#__PURE__*/Object.freeze({
41015
40904
  flagPost: flagPost,
41016
40905
  unflagPost: unflagPost,
41017
40906
  isPostFlaggedByMe: isPostFlaggedByMe,
41018
- createClipPost: createClipPost,
41019
40907
  onPostCreated: onPostCreated,
41020
40908
  onPostUpdated: onPostUpdated,
41021
40909
  onPostDeleted: onPostDeleted,