@amityco/ts-sdk 7.5.3-d6ee46d.0 → 7.5.4-2d34fd5f.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 (75) hide show
  1. package/dist/@types/domains/content.d.ts +11 -2
  2. package/dist/@types/domains/content.d.ts.map +1 -1
  3. package/dist/@types/domains/feed.d.ts +2 -1
  4. package/dist/@types/domains/feed.d.ts.map +1 -1
  5. package/dist/@types/domains/file.d.ts +3 -1
  6. package/dist/@types/domains/file.d.ts.map +1 -1
  7. package/dist/@types/domains/pinnedPost.d.ts +1 -1
  8. package/dist/@types/domains/pinnedPost.d.ts.map +1 -1
  9. package/dist/@types/domains/post.d.ts +21 -1
  10. package/dist/@types/domains/post.d.ts.map +1 -1
  11. package/dist/@types/index.d.ts +2 -0
  12. package/dist/@types/index.d.ts.map +1 -1
  13. package/dist/client/api/enableUnreadCount.d.ts.map +1 -1
  14. package/dist/client/api/login.d.ts.map +1 -1
  15. package/dist/client/utils/markerSyncEngine.d.ts +1 -1
  16. package/dist/client/utils/markerSyncEngine.d.ts.map +1 -1
  17. package/dist/communityRepository/api/deleteCommunity.d.ts.map +1 -1
  18. package/dist/communityRepository/api/getCommunity.d.ts +2 -2
  19. package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
  20. package/dist/communityRepository/observers/getCommunity.d.ts.map +1 -1
  21. package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts.map +1 -1
  22. package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts +1 -1
  23. package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts.map +1 -1
  24. package/dist/feedRepository/api/queryGlobalFeed.d.ts.map +1 -1
  25. package/dist/fileRepository/api/index.d.ts +1 -0
  26. package/dist/fileRepository/api/index.d.ts.map +1 -1
  27. package/dist/fileRepository/api/uploadClip.d.ts +17 -0
  28. package/dist/fileRepository/api/uploadClip.d.ts.map +1 -0
  29. package/dist/index.cjs.js +433 -432
  30. package/dist/index.esm.js +400 -399
  31. package/dist/index.umd.js +2 -2
  32. package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
  33. package/dist/postRepository/api/createClipPost.d.ts +32 -0
  34. package/dist/postRepository/api/createClipPost.d.ts.map +1 -0
  35. package/dist/postRepository/api/getPost.d.ts +2 -2
  36. package/dist/postRepository/api/getPost.d.ts.map +1 -1
  37. package/dist/postRepository/api/index.d.ts +1 -0
  38. package/dist/postRepository/api/index.d.ts.map +1 -1
  39. package/dist/userRepository/observers/getBlockedUsers.d.ts +4 -4
  40. package/dist/userRepository/observers/getBlockedUsers.d.ts.map +1 -1
  41. package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
  42. package/dist/utils/postTypePredicate.d.ts +1 -0
  43. package/dist/utils/postTypePredicate.d.ts.map +1 -1
  44. package/dist/utils/tests/dummy/comment.d.ts +1 -1
  45. package/package.json +1 -1
  46. package/src/@types/domains/content.ts +25 -1
  47. package/src/@types/domains/feed.ts +2 -1
  48. package/src/@types/domains/file.ts +5 -0
  49. package/src/@types/domains/pinnedPost.ts +1 -1
  50. package/src/@types/domains/post.ts +29 -8
  51. package/src/@types/index.ts +2 -0
  52. package/src/client/api/enableUnreadCount.ts +0 -22
  53. package/src/client/api/login.ts +0 -4
  54. package/src/client/utils/markerSyncEngine.ts +3 -24
  55. package/src/commentRepository/api/createComment.ts +1 -1
  56. package/src/commentRepository/api/deleteComment.ts +1 -1
  57. package/src/communityRepository/api/deleteCommunity.ts +2 -1
  58. package/src/communityRepository/api/getCommunity.ts +5 -7
  59. package/src/communityRepository/observers/getCommunity.ts +24 -12
  60. package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts +1 -2
  61. package/src/feedRepository/api/getCustomRankingGlobalFeed.ts +1 -1
  62. package/src/feedRepository/api/queryGlobalFeed.ts +3 -1
  63. package/src/fileRepository/api/index.ts +1 -0
  64. package/src/fileRepository/api/uploadClip.ts +71 -0
  65. package/src/postRepository/api/createClipPost.ts +62 -0
  66. package/src/postRepository/api/getPost.ts +6 -4
  67. package/src/postRepository/api/index.ts +2 -0
  68. package/src/postRepository/api/queryPosts.ts +1 -1
  69. package/src/postRepository/observers/getPost.ts +2 -2
  70. package/src/postRepository/observers/getPosts/PostPaginationController.ts +1 -1
  71. package/src/reactionRepository/api/addReaction.ts +1 -1
  72. package/src/userRepository/observers/getBlockedUsers.ts +4 -4
  73. package/src/utils/linkedObject/postLinkedObject.ts +12 -1
  74. package/src/utils/linkedObject/streamLinkedObject.ts +1 -1
  75. package/src/utils/postTypePredicate.ts +10 -0
@@ -3,7 +3,7 @@ export declare const getSubChannelMessagePreviewWithUser: (subChannel: Amity.Sub
3
3
  user: Amity.InternalUser | undefined;
4
4
  messagePreviewId: string;
5
5
  subChannelName: string;
6
- data?: string | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataPoll | Record<string, unknown> | undefined;
6
+ data?: string | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataPoll | Amity.ContentDataStream | Amity.ContentDataClip | Record<string, unknown> | undefined;
7
7
  dataType?: any;
8
8
  channelId: string;
9
9
  subChannelId: string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * ```js
3
+ * import { PostRepository } from '@amityco/ts-sdk'
4
+ * const created = await PostRepository.createClipPost({
5
+ * targetType: 'user',
6
+ * targetId: 'foobar',
7
+ * dataType: 'clip',
8
+ * data: { text: 'hello world' },
9
+ * attachments: [{ type: 'clip', fileId: 'fileId123', displayMode: 'fill', isMuted: false }]
10
+ * }))
11
+ * ```
12
+ *
13
+ * Creates an {@link Amity.Post}
14
+ *
15
+ * @param bundle The data necessary to create a new {@link Amity.Post}
16
+ * @returns The newly created {@link Amity.Post}
17
+ *
18
+ * @category Post API
19
+ * @async
20
+ */
21
+ export declare const createClipPost: <T extends string>(bundle: Pick<Amity.Post<T>, "targetType" | "targetId"> & Partial<Pick<Amity.Post<T>, "metadata" | "tags" | "mentionees">> & {
22
+ data: {
23
+ [k: string]: any;
24
+ };
25
+ attachments: {
26
+ type: T;
27
+ fileId: Amity.File['fileId'];
28
+ displayMode?: Amity.ClipDisplayMode | undefined;
29
+ isMuted?: boolean | undefined;
30
+ }[];
31
+ }) => Promise<Amity.Cached<Amity.Post>>;
32
+ //# sourceMappingURL=createClipPost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createClipPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/createClipPost.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc;;;;;;gBAMX,UAAU,CAAC,QAAQ,CAAC;;;;MAKjC,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CAmBlC,CAAC"}
@@ -13,7 +13,7 @@
13
13
  * @async
14
14
  */
15
15
  export declare const getPost: {
16
- (postId: Amity.Post['postId']): Promise<Amity.Cached<Amity.Post>>;
16
+ (postId: Amity.Post['postId']): Promise<Amity.Cached<Amity.InternalPost>>;
17
17
  /**
18
18
  * ```js
19
19
  * import { getPost } from '@amityco/ts-sdk'
@@ -27,6 +27,6 @@ export declare const getPost: {
27
27
  *
28
28
  * @category Post API
29
29
  */
30
- locally(postId: Amity.Post['postId']): Amity.Cached<Amity.Post> | undefined;
30
+ locally(postId: Amity.Post['postId']): Amity.Cached<Amity.InternalPost> | undefined;
31
31
  };
32
32
  //# sourceMappingURL=getPost.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/getPost.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,OAAO;aAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;IAqC9F;;;;;;;;;;;;OAYG;oBACwB,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;CAfrF,CAAC"}
1
+ {"version":3,"file":"getPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/getPost.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,OAAO;aACV,MAAM,IAAI,CAAC,QAAQ,CAAC,GAC3B,QAAQ,MAAM,MAAM,CAAC,MAAM,YAAY,CAAC,CAAC;IAqC5C;;;;;;;;;;;;OAYG;oBACwB,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,MAAM,CAAC,MAAM,YAAY,CAAC,GAAG,SAAS;CAf7F,CAAC"}
@@ -9,4 +9,5 @@ export * from './declinePost';
9
9
  export * from './flagPost';
10
10
  export * from './unflagPost';
11
11
  export * from './isPostFlaggedByMe';
12
+ export * from './createClipPost';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,kBAAkB,CAAC"}
@@ -4,14 +4,14 @@
4
4
  * const unblockedUser = await UserRepository.blockUser('userId')
5
5
  * ```
6
6
  *
7
- * Blocks a {@link Amity.InternalUser}
7
+ * Blocks a {@link Amity.User}
8
8
  *
9
- * @param params The params to get blocked {@link Amity.InternalUser}s
10
- * @param callback to recieve updates on unblocked {@link Amity.InternalUser}s
9
+ * @param params The params to get blocked {@link Amity.User}s
10
+ * @param callback to recieve updates on unblocked {@link Amity.User}s
11
11
  * @returns {@link Amity.Unsubscriber} to unsubscribe from collection
12
12
  *
13
13
  * @category Post API
14
14
  * @async
15
15
  */
16
- export declare const getBlockedUsers: (params: Amity.BlockedUsersLiveCollection, callback: Amity.LiveCollectionCallback<Amity.InternalUser>, config?: Amity.LiveCollectionConfig) => Amity.Unsubscriber;
16
+ export declare const getBlockedUsers: (params: Amity.BlockedUsersLiveCollection, callback: Amity.LiveCollectionCallback<Amity.User>, config?: Amity.LiveCollectionConfig) => Amity.Unsubscriber;
17
17
  //# sourceMappingURL=getBlockedUsers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getBlockedUsers.d.ts","sourceRoot":"","sources":["../../../src/userRepository/observers/getBlockedUsers.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,0BAA0B,YAC9B,MAAM,sBAAsB,CAAC,MAAM,YAAY,CAAC,WACjD,MAAM,oBAAoB,KAClC,MAAM,YAsBR,CAAC"}
1
+ {"version":3,"file":"getBlockedUsers.d.ts","sourceRoot":"","sources":["../../../src/userRepository/observers/getBlockedUsers.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,0BAA0B,YAC9B,MAAM,sBAAsB,CAAC,MAAM,IAAI,CAAC,WACzC,MAAM,oBAAoB,KAClC,MAAM,YAsBR,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"postLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/postLinkedObject.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,SAAU,MAAM,YAAY,KAAG,MAAM,IA6DjE,CAAC"}
1
+ {"version":3,"file":"postLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/postLinkedObject.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,gBAAgB,SAAU,MAAM,YAAY,KAAG,MAAM,IAmEjE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export declare function isAmityImagePost(post: Amity.InternalPost): post is Amity.Post<'image'>;
2
2
  export declare function isAmityFilePost(post: Amity.InternalPost): post is Amity.Post<'file'>;
3
3
  export declare function isAmityVideoPost(post: Amity.InternalPost): post is Amity.Post<'video'>;
4
+ export declare function isAmityClipPost(post: Amity.InternalPost): post is Amity.Post<'clip'>;
4
5
  //# sourceMappingURL=postTypePredicate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"postTypePredicate.d.ts","sourceRoot":"","sources":["../../src/utils/postTypePredicate.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAOtF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAOpF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAQtF"}
1
+ {"version":3,"file":"postTypePredicate.d.ts","sourceRoot":"","sources":["../../src/utils/postTypePredicate.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAOtF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAOpF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAQtF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAQpF"}
@@ -23,7 +23,7 @@ export declare const generateComment: (params?: Partial<Amity.InternalComment>)
23
23
  referenceType: Amity.CommentReferenceType;
24
24
  dataType?: any;
25
25
  dataTypes?: any[] | undefined;
26
- data?: string | Record<string, unknown> | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataPoll | undefined;
26
+ data?: string | Record<string, unknown> | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataPoll | Amity.ContentDataStream | Amity.ContentDataClip | undefined;
27
27
  metadata?: Record<string, any> | undefined;
28
28
  flagCount: number;
29
29
  hashFlag: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.5.3-d6ee46d.0",
3
+ "version": "7.5.4-2d34fd5f.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",
@@ -24,7 +24,16 @@ declare global {
24
24
  | Exclude<`${ContentFlagReasonEnum}`, `${ContentFlagReasonEnum.Others}`>
25
25
  | (string & {});
26
26
 
27
- type ContentType = 'text' | 'image' | 'file' | 'video' | 'poll' | 'json' | string;
27
+ type ContentType =
28
+ | 'text'
29
+ | 'image'
30
+ | 'file'
31
+ | 'video'
32
+ | 'poll'
33
+ | 'json'
34
+ | 'liveStream'
35
+ | 'clip'
36
+ | string;
28
37
 
29
38
  type ContentFeedType = ValueOf<typeof ContentFeedType>;
30
39
 
@@ -54,10 +63,21 @@ declare global {
54
63
  };
55
64
  };
56
65
 
66
+ type ContentDataClip = {
67
+ thumbnailFileId: Amity.File<'image'>['fileId'];
68
+ fileId: Amity.File<'clip'>['fileId'];
69
+ isMuted?: boolean;
70
+ displayMode?: Amity.ClipDisplayMode;
71
+ };
72
+
57
73
  type ContentDataPoll = {
58
74
  pollId: Amity.Poll['pollId'];
59
75
  };
60
76
 
77
+ type ContentDataStream = {
78
+ streamId: Amity.Stream['streamId'];
79
+ };
80
+
61
81
  type ContentData<T extends ContentType> = T extends 'text'
62
82
  ? ContentDataText
63
83
  : T extends 'file'
@@ -68,6 +88,10 @@ declare global {
68
88
  ? ContentDataVideo
69
89
  : T extends 'poll'
70
90
  ? ContentDataPoll
91
+ : T extends 'liveStream'
92
+ ? ContentDataStream
93
+ : T extends 'clip'
94
+ ? ContentDataClip
71
95
  : T extends 'json'
72
96
  ? Record<string, unknown>
73
97
  : T extends string
@@ -11,8 +11,9 @@ declare global {
11
11
  } & Amity.Timestamps;
12
12
 
13
13
  type QueryGlobalFeed = {
14
- dataType?: 'video' | 'image' | 'file' | 'liveStream';
14
+ dataTypes?: ('video' | 'image' | 'file' | 'liveStream' | 'clip')[];
15
15
  queryToken?: string;
16
+ resolveParent?: boolean;
16
17
  };
17
18
  }
18
19
  }
@@ -2,6 +2,7 @@ export const FileType = Object.freeze({
2
2
  FILE: 'file',
3
3
  IMAGE: 'image',
4
4
  VIDEO: 'video',
5
+ CLIP: 'clip',
5
6
  });
6
7
 
7
8
  export const VideoResolution = Object.freeze({
@@ -55,12 +56,16 @@ declare global {
55
56
 
56
57
  type VideoMetadata = Record<string, never>;
57
58
 
59
+ type ClipMetadata = Record<string, never>;
60
+
58
61
  type MetadataFor<T extends FileType> = T extends 'file'
59
62
  ? FileMetadata
60
63
  : T extends 'image'
61
64
  ? ImageMetadata
62
65
  : T extends 'video'
63
66
  ? VideoMetadata
67
+ : T extends 'clip'
68
+ ? ClipMetadata
64
69
  : never;
65
70
 
66
71
  type File<T extends FileType = any> = Amity.FilePayload<T>;
@@ -32,6 +32,6 @@ declare global {
32
32
  pinnedAt: Date;
33
33
  };
34
34
 
35
- type GlobalPinnedPostLiveCollection = Amity.LiveCollectionParams<Record<string, never>>;
35
+ type GlobalPinnedPostLiveCollection = Amity.LiveCollectionParams<{}>;
36
36
  }
37
37
  }
@@ -5,6 +5,7 @@ export const PostContentType = Object.freeze({
5
5
  VIDEO: 'video',
6
6
  LIVESTREAM: 'liveStream',
7
7
  POLL: 'poll',
8
+ CLIP: 'clip',
8
9
  });
9
10
 
10
11
  declare global {
@@ -40,15 +41,32 @@ declare global {
40
41
  hasFlaggedChildren: false;
41
42
  hasFlaggedComment: false;
42
43
  editedAt: Amity.timestamp;
44
+ // Amity.Metadata
45
+ metadata?: Record<string, any>;
46
+ // Amity.Flaggable
47
+ flagCount: number;
48
+ hashFlag: {
49
+ bits: number;
50
+ hashes: number;
51
+ hash: string;
52
+ } | null;
53
+ // Amity.Taggable
54
+ tags?: string[];
55
+ // Amity.Timestamps
56
+ createdAt: Amity.timestamp;
57
+ updatedAt?: Amity.timestamp;
58
+ // Amity.SoftDelete
59
+ isDeleted?: boolean;
60
+ // Amity.Subscribable
61
+ path: string;
62
+ // Amity.AnalyticPostData
63
+ impression: number;
64
+ reach: number;
65
+ // Amity.Reactable
66
+ reactionsCount: number;
67
+ reactions: Record<string, number>;
68
+ myReactions?: string[];
43
69
  } & Amity.Content<T> &
44
- Amity.Metadata &
45
- Amity.Flaggable &
46
- Amity.Reactable &
47
- Amity.Taggable &
48
- Amity.Timestamps &
49
- Amity.SoftDelete &
50
- Amity.Subscribable &
51
- Amity.AnalyticPostData &
52
70
  Amity.Mentionable<'user'>;
53
71
 
54
72
  type InternalPost<T extends PostContentType = any> = RawPost<T> & {
@@ -65,10 +83,13 @@ declare global {
65
83
  getVideoInfo: () => Amity.File<'video'> | undefined;
66
84
  getVideoThumbnailInfo: () => Amity.File<'image'> | undefined;
67
85
  getFileInfo: () => Amity.File<'file'> | undefined;
86
+ getClipInfo: () => Amity.File<'clip'> | undefined;
68
87
  };
69
88
 
70
89
  type Post<T extends PostContentType = any> = Amity.InternalPost<T> & Amity.PostLinkObject;
71
90
 
91
+ type ClipDisplayMode = 'fill' | 'fit';
92
+
72
93
  type QueryPosts = {
73
94
  targetId: string;
74
95
  targetType: Amity.InternalPost['targetType'];
@@ -41,3 +41,5 @@ export * from './domains/notification';
41
41
  export * from './domains/client';
42
42
  export * from './domains/invitation';
43
43
  export * from './domains/joinRequest';
44
+ export * from './domains/pin';
45
+ export * from './domains/pinnedPost';
@@ -1,25 +1,3 @@
1
- import { ASCError } from '~/core/errors';
2
- import { getActiveClient } from './activeClient';
3
-
4
1
  export const enableUnreadCount = () => {
5
- const client = getActiveClient();
6
-
7
- client.log('client/api/isUnreadCountEnabled', client.isUnreadCountEnabled);
8
-
9
- if (!client) {
10
- throw new ASCError(
11
- 'There is no active client',
12
- Amity.ClientError.UNKNOWN_ERROR,
13
- Amity.ErrorLevel.FATAL,
14
- );
15
- }
16
-
17
- if (client.isUnreadCountEnabled) return false;
18
-
19
- client.isUnreadCountEnabled = true;
20
- client.useLegacyUnreadCount = false;
21
-
22
- client.emitter.emit('unreadCountEnabled', true);
23
-
24
2
  return true;
25
3
  };
@@ -26,7 +26,6 @@ import { onTokenTerminated } from '../events/onTokenTerminated';
26
26
  import { setClientToken } from '../utils/setClientToken';
27
27
  import { removeChannelMarkerCache } from '../utils/removeChannelMarkerCache';
28
28
  import { initializeMessagePreviewSetting } from '../utils/messagePreviewEngine';
29
- import { startMarkerSync } from '../utils/markerSyncEngine';
30
29
  import { ASCError } from '~/core/errors';
31
30
  import SessionWatcher from '../utils/SessionWatcher';
32
31
 
@@ -207,9 +206,6 @@ export const login = async (
207
206
  if (client.useLegacyUnreadCount) {
208
207
  subscriptions.push(readReceiptSyncEngineOnLoginHandler());
209
208
  } else subscriptions.push(legacyReadReceiptSyncEngineOnLoginHandler());
210
-
211
- const markerSyncUnsubscriber = await startMarkerSync();
212
- subscriptions.push(markerSyncUnsubscriber);
213
209
  }
214
210
 
215
211
  return true;
@@ -14,7 +14,6 @@ import { onSubChannelDeleted } from '~/subChannelRepository/events/onSubChannelD
14
14
  import { isUnreadCountSupport } from '~/subChannelRepository/utils';
15
15
 
16
16
  import { markerSync } from '../api/markerSync';
17
- import { enableUnreadCount } from '../api/enableUnreadCount';
18
17
 
19
18
  import { onOnline } from './onOnline';
20
19
  import { onUserFeedMarkerUpdated } from '~/marker/events/onUserFeedMarkerUpdated';
@@ -27,7 +26,7 @@ let isSyncRunning = false;
27
26
  let disposers: (() => void)[] = [];
28
27
  let isWaitingForResponse = false;
29
28
 
30
- let isConsistentMode = true;
29
+ const isConsistentMode = true;
31
30
  let deviceLastSyncAt: Date | null = null;
32
31
 
33
32
  const getDeviceLastSyncAt = () => {
@@ -178,17 +177,7 @@ const unRegisterEventListeners = () => {
178
177
  disposers = [];
179
178
  };
180
179
 
181
- export const startMarkerSync = async () => {
182
- await fetchDeviceLastSyncAt();
183
- pushMarkerSyncEvent(Amity.MarkerSyncEvent.START_SYNCING);
184
-
185
- isConsistentMode = true;
186
- isSyncRunning = true;
187
-
188
- registerEventListeners();
189
-
190
- return unRegisterEventListeners;
191
- };
180
+ export const startMarkerSync = async () => Promise.resolve();
192
181
 
193
182
  /**
194
183
  ```js
@@ -201,17 +190,7 @@ export const startMarkerSync = async () => {
201
190
  *
202
191
  * @category Marker API
203
192
  */
204
- export const startUnreadSync = async () => {
205
- await fetchDeviceLastSyncAt();
206
- pushMarkerSyncEvent(Amity.MarkerSyncEvent.START_SYNCING);
207
-
208
- enableUnreadCount();
209
-
210
- isConsistentMode = false;
211
- isSyncRunning = true;
212
-
213
- registerEventListeners();
214
- };
193
+ export const startUnreadSync = async () => Promise.resolve();
215
194
 
216
195
  /**
217
196
  ```js
@@ -51,7 +51,7 @@ export const createComment = async (
51
51
  if (client.cache) ingestInCache(data, { cachedAt });
52
52
 
53
53
  if (['post', 'content'].includes(bundle.referenceType)) {
54
- const post = pullFromCache<Amity.Post>(['post', 'get', bundle.referenceId])?.data;
54
+ const post = pullFromCache<Amity.InternalPost>(['post', 'get', bundle.referenceId])?.data;
55
55
 
56
56
  if (post) {
57
57
  post.commentsCount += 1;
@@ -62,7 +62,7 @@ export const deleteComment = async (
62
62
  users: [],
63
63
  });
64
64
  } else {
65
- const post = pullFromCache<Amity.Post>(['post', 'get', comment.data.referenceId])?.data;
65
+ const post = pullFromCache<Amity.InternalPost>(['post', 'get', comment.data.referenceId])?.data;
66
66
 
67
67
  if (post) {
68
68
  let removeCount: number;
@@ -2,6 +2,7 @@ import { getActiveClient } from '~/client/api';
2
2
 
3
3
  import { fireEvent } from '~/core/events';
4
4
  import { getCommunity } from './getCommunity';
5
+ import { LinkedObject } from '~/utils/linkedObject';
5
6
 
6
7
  /* begin_public_function
7
8
  id: community.delete
@@ -40,6 +41,6 @@ export const deleteCommunity = async (
40
41
  users: [],
41
42
  });
42
43
 
43
- return deleted.data;
44
+ return LinkedObject.community(deleted.data);
44
45
  };
45
46
  /* end_public_function */
@@ -25,7 +25,7 @@ export const getCommunity = async (
25
25
  communityId: Amity.Community['communityId'],
26
26
  type?: Amity.JoinRequestType,
27
27
  includeDiscoverablePrivateCommunity?: boolean,
28
- ): Promise<Amity.Cached<Amity.Community>> => {
28
+ ): Promise<Amity.Cached<Amity.InternalCommunity>> => {
29
29
  const client = getActiveClient();
30
30
  client.log('community/getCommunity', communityId);
31
31
 
@@ -51,9 +51,7 @@ export const getCommunity = async (
51
51
  const { communities } = data;
52
52
 
53
53
  return {
54
- data: LinkedObject.community(
55
- communities.find(community => community.communityId === communityId)!,
56
- ),
54
+ data: communities.find(community => community.communityId === communityId)!,
57
55
  cachedAt,
58
56
  };
59
57
  };
@@ -73,18 +71,18 @@ export const getCommunity = async (
73
71
  */
74
72
  getCommunity.locally = (
75
73
  communityId: Amity.Community['communityId'],
76
- ): Amity.Cached<Amity.Community> | undefined => {
74
+ ): Amity.Cached<Amity.InternalCommunity> | undefined => {
77
75
  const client = getActiveClient();
78
76
  client.log('community/getCommunity.locally', communityId);
79
77
 
80
78
  if (!client.cache) return;
81
79
 
82
- const cached = pullFromCache<Amity.Community>(['community', 'get', communityId]);
80
+ const cached = pullFromCache<Amity.InternalCommunity>(['community', 'get', communityId]);
83
81
 
84
82
  if (!cached) return;
85
83
 
86
84
  return {
87
- data: LinkedObject.community(cached.data),
85
+ data: cached.data,
88
86
  cachedAt: cached.cachedAt,
89
87
  };
90
88
  };
@@ -12,6 +12,7 @@ import {
12
12
  onLocalCommunityJoin,
13
13
  } from '../communityMembership/events';
14
14
  import { convertEventPayload } from '~/utils/event';
15
+ import { LinkedObject } from '~/utils/linkedObject';
15
16
 
16
17
  /* begin_public_function
17
18
  id: community.get
@@ -39,17 +40,28 @@ export const getCommunity = (
39
40
  communityId: Amity.Community['communityId'],
40
41
  callback: Amity.LiveObjectCallback<Amity.Community>,
41
42
  ): Amity.Unsubscriber => {
42
- return liveObject(communityId, callback, 'communityId', _getCommunity, [
43
- onCommunityUpdated,
44
- onCommunityDeleted,
45
- onCommunityJoined,
46
- onCommunityLeft,
47
- onLocalCommunityJoined,
48
- onLocalCommunityLeft,
49
- onCommunityUserBanned,
50
- onCommunityUserUnbanned,
51
- onCommunityUserChanged,
52
- convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
53
- ]);
43
+ return liveObject(
44
+ communityId,
45
+ callback,
46
+ 'communityId',
47
+ _getCommunity,
48
+ [
49
+ onCommunityUpdated,
50
+ onCommunityDeleted,
51
+ onCommunityJoined,
52
+ onCommunityLeft,
53
+ onLocalCommunityJoined,
54
+ onLocalCommunityLeft,
55
+ onCommunityUserBanned,
56
+ onCommunityUserUnbanned,
57
+ onCommunityUserChanged,
58
+ convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
59
+ ],
60
+ {
61
+ callbackDataSelector: (data: Amity.InternalCommunity) => {
62
+ return LinkedObject.community(data);
63
+ },
64
+ },
65
+ );
54
66
  };
55
67
  /* end_public_function */
@@ -1,5 +1,4 @@
1
1
  import { PaginationController } from '~/core/liveCollection/PaginationController';
2
- import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
3
2
 
4
3
  /**
5
4
  * TODO: handle cache receive cache option, and cache policy
@@ -10,7 +9,7 @@ export class JoinRequestsPaginationController extends PaginationController<
10
9
  Amity.JoinRequestLiveCollection
11
10
  > {
12
11
  async getRequest(queryParams: Amity.JoinRequestLiveCollection, token: string | undefined) {
13
- const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, communityId, ...params } = queryParams;
12
+ const { limit = 20, communityId, ...params } = queryParams;
14
13
  const options = token ? { token } : { limit };
15
14
 
16
15
  const { data: queryResponse } = await this.http.get<
@@ -23,7 +23,7 @@ import { LinkedObject } from '~/utils/linkedObject';
23
23
  * @async
24
24
  * */
25
25
  export const getCustomRankingGlobalFeed = async (query?: {
26
- dataTypes?: ('video' | 'image' | 'file' | 'liveStream')[];
26
+ dataTypes?: ('video' | 'image' | 'file' | 'liveStream' | 'clip')[];
27
27
  limit?: number;
28
28
  queryToken?: string;
29
29
  }): Promise<
@@ -32,7 +32,7 @@ export const queryGlobalFeed = async (
32
32
  const client = getActiveClient();
33
33
  client.log('feed/queryGlobalFeed', query);
34
34
 
35
- const { queryToken, ...params } = query ?? {};
35
+ const { queryToken, dataTypes, resolveParent, ...params } = query ?? {};
36
36
 
37
37
  const options = (() => {
38
38
  if (queryToken) return { token: queryToken };
@@ -44,6 +44,8 @@ export const queryGlobalFeed = async (
44
44
  {
45
45
  params: {
46
46
  ...params,
47
+ dataTypes,
48
+ resolveParent: resolveParent ?? true,
47
49
  options,
48
50
  },
49
51
  },
@@ -5,3 +5,4 @@ export * from './fileUrlWithSize';
5
5
  export * from './uploadVideo';
6
6
  export * from './uploadImage';
7
7
  export * from './updateAltText';
8
+ export * from './uploadClip';