@amityco/ts-sdk 7.5.4-ec2fdd4.0 → 7.6.1-1a687cb5.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 (71) hide show
  1. package/dist/@types/core/payload.d.ts +1 -1
  2. package/dist/@types/core/payload.d.ts.map +1 -1
  3. package/dist/@types/domains/channel.d.ts +1 -0
  4. package/dist/@types/domains/channel.d.ts.map +1 -1
  5. package/dist/@types/domains/content.d.ts +8 -2
  6. package/dist/@types/domains/content.d.ts.map +1 -1
  7. package/dist/@types/domains/feed.d.ts +2 -1
  8. package/dist/@types/domains/feed.d.ts.map +1 -1
  9. package/dist/@types/domains/file.d.ts +3 -1
  10. package/dist/@types/domains/file.d.ts.map +1 -1
  11. package/dist/@types/domains/group.d.ts +2 -0
  12. package/dist/@types/domains/group.d.ts.map +1 -1
  13. package/dist/@types/domains/post.d.ts +3 -0
  14. package/dist/@types/domains/post.d.ts.map +1 -1
  15. package/dist/channelRepository/channelMembership/observers/getMembers/ChannelMemberLiveCollectionController.d.ts.map +1 -1
  16. package/dist/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberLiveCollectionController.d.ts.map +1 -1
  17. package/dist/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberQueryStreamController.d.ts +2 -2
  18. package/dist/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberQueryStreamController.d.ts.map +1 -1
  19. package/dist/communityRepository/api/getCommunity.d.ts +1 -1
  20. package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
  21. package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts +1 -1
  22. package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts.map +1 -1
  23. package/dist/feedRepository/api/queryGlobalFeed.d.ts.map +1 -1
  24. package/dist/fileRepository/api/index.d.ts +1 -0
  25. package/dist/fileRepository/api/index.d.ts.map +1 -1
  26. package/dist/fileRepository/api/uploadClip.d.ts +17 -0
  27. package/dist/fileRepository/api/uploadClip.d.ts.map +1 -0
  28. package/dist/index.cjs.js +145 -14
  29. package/dist/index.esm.js +145 -14
  30. package/dist/index.umd.js +3 -3
  31. package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
  32. package/dist/postRepository/api/createClipPost.d.ts +32 -0
  33. package/dist/postRepository/api/createClipPost.d.ts.map +1 -0
  34. package/dist/postRepository/api/index.d.ts +1 -0
  35. package/dist/postRepository/api/index.d.ts.map +1 -1
  36. package/dist/utils/linkedObject/channelLinkedObject.d.ts.map +1 -1
  37. package/dist/utils/linkedObject/channelMemberLinkedObject.d.ts +2 -0
  38. package/dist/utils/linkedObject/channelMemberLinkedObject.d.ts.map +1 -0
  39. package/dist/utils/linkedObject/index.d.ts +1 -0
  40. package/dist/utils/linkedObject/index.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/dist/utils/tests/dummy/community.d.ts +2 -0
  46. package/dist/utils/tests/dummy/community.d.ts.map +1 -1
  47. package/package.json +1 -1
  48. package/src/@types/core/payload.ts +1 -1
  49. package/src/@types/domains/channel.ts +1 -0
  50. package/src/@types/domains/content.ts +10 -0
  51. package/src/@types/domains/feed.ts +2 -1
  52. package/src/@types/domains/file.ts +5 -0
  53. package/src/@types/domains/group.ts +2 -0
  54. package/src/@types/domains/post.ts +4 -0
  55. package/src/channelRepository/channelMembership/observers/getMembers/ChannelMemberLiveCollectionController.ts +3 -1
  56. package/src/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberLiveCollectionController.ts +2 -1
  57. package/src/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberQueryStreamController.ts +2 -2
  58. package/src/communityRepository/api/getCommunity.ts +0 -9
  59. package/src/feedRepository/api/getCustomRankingGlobalFeed.ts +1 -1
  60. package/src/feedRepository/api/queryGlobalFeed.ts +3 -1
  61. package/src/fileRepository/api/index.ts +1 -0
  62. package/src/fileRepository/api/uploadClip.ts +71 -0
  63. package/src/postRepository/api/createClipPost.ts +62 -0
  64. package/src/postRepository/api/index.ts +2 -0
  65. package/src/postRepository/api/queryPosts.ts +1 -1
  66. package/src/postRepository/observers/getPosts/PostPaginationController.ts +1 -1
  67. package/src/utils/linkedObject/channelLinkedObject.ts +19 -0
  68. package/src/utils/linkedObject/channelMemberLinkedObject.ts +20 -0
  69. package/src/utils/linkedObject/index.ts +2 -0
  70. package/src/utils/linkedObject/postLinkedObject.ts +12 -1
  71. 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 | Amity.ContentDataStream | 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"}
@@ -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"}
@@ -1 +1 @@
1
- {"version":3,"file":"channelLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/channelLinkedObject.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,YAAa,MAAM,eAAe,KAAG,MAAM,OAI1E,CAAC"}
1
+ {"version":3,"file":"channelLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/channelLinkedObject.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,YAAa,MAAM,eAAe,KAAG,MAAM,OAqB1E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const channelMemberLinkedObject: (channelMember: Amity.Membership<'channel'>) => Amity.Membership<'channel'>;
2
+ //# sourceMappingURL=channelMemberLinkedObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channelMemberLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/channelMemberLinkedObject.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,kBACrB,MAAM,UAAU,CAAC,SAAS,CAAC,KACzC,MAAM,UAAU,CAAC,SAAS,CAc5B,CAAC"}
@@ -15,5 +15,6 @@ export declare const LinkedObject: {
15
15
  community: (community: Amity.InternalCommunity) => Amity.Community;
16
16
  invitation: (invitation: Amity.InternalInvitation) => Amity.Invitation;
17
17
  joinRequest: (joinRequest: Amity.InternalJoinRequest) => Amity.JoinRequest;
18
+ channelMember: (channelMember: Amity.Membership<"channel">) => Amity.Membership<"channel">;
18
19
  };
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;CAiBxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;CAkBxB,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 | Amity.ContentDataStream | 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: {
@@ -55,6 +55,8 @@ export declare const communityUserModel: {
55
55
  muteTimeout: string;
56
56
  lastActivity: string;
57
57
  userId: string;
58
+ userInternalId: string;
59
+ userPublicId: string;
58
60
  communityId: string;
59
61
  communityMembership: Amity.GroupMembership;
60
62
  createdAt: string;
@@ -1 +1 @@
1
- {"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../../../../src/utils/tests/dummy/community.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,SAajC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,SAoB/B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,SAI/B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAa5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,+BAAuD,CAAC;AAE5F,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAO5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,+BAAuD,CAAC;AAE5F,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAO5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,+BAAuD,CAAC;AAE5F,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAM5D,CAAC;AAEF,eAAO,MAAM,qBAAqB,+BAAuD,CAAC;AAE1F,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAK5D,CAAC;AAEF,eAAO,MAAM,mBAAmB,+BAAuD,CAAC;AAExF,eAAO,MAAM,qBAAqB;;;;;;;CAOjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,gBAOpC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;CAUtC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;CAU3C,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;GAG9B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;CAuBzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;CAuBzB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAqBlC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;CAqBvC,CAAC"}
1
+ {"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../../../../src/utils/tests/dummy/community.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,SAajC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,SAoB/B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,SAI/B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAa5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,+BAAuD,CAAC;AAE5F,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAO5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,+BAAuD,CAAC;AAE5F,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAO5D,CAAC;AAEF,eAAO,MAAM,uBAAuB,+BAAuD,CAAC;AAE5F,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAM5D,CAAC;AAEF,eAAO,MAAM,qBAAqB,+BAAuD,CAAC;AAE1F,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAK5D,CAAC;AAEF,eAAO,MAAM,mBAAmB,+BAAuD,CAAC;AAExF,eAAO,MAAM,qBAAqB;;;;;;;CAOjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,gBAOpC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;CAUtC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;CAU3C,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;GAG9B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;CAuBzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;CAuBzB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAqBlC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;CAqBvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.5.4-ec2fdd4.0",
3
+ "version": "7.6.1-1a687cb5.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",
@@ -78,7 +78,7 @@ declare global {
78
78
  metadata: Amity.MetadataFor<T>;
79
79
  };
80
80
  accessType: Amity.FileAccessType;
81
- } & (T extends 'video' ? Amity.VideoFileExtraPayload : unknown) &
81
+ } & (T extends 'video' | 'clip' ? Amity.VideoFileExtraPayload : unknown) &
82
82
  Amity.Timestamps &
83
83
  Amity.SoftDelete;
84
84
 
@@ -93,6 +93,7 @@ declare global {
93
93
  type Channel<T extends ChannelType = any> = InternalChannel<T> & {
94
94
  messagePreview?: Amity.MessagePreview | null;
95
95
  markAsRead: () => Promise<boolean>;
96
+ previewMembers: Amity.Membership<'channel'>[];
96
97
  };
97
98
 
98
99
  type QueryChannels = {
@@ -32,6 +32,7 @@ declare global {
32
32
  | 'poll'
33
33
  | 'json'
34
34
  | 'liveStream'
35
+ | 'clip'
35
36
  | string;
36
37
 
37
38
  type ContentFeedType = ValueOf<typeof ContentFeedType>;
@@ -62,6 +63,13 @@ declare global {
62
63
  };
63
64
  };
64
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
+
65
73
  type ContentDataPoll = {
66
74
  pollId: Amity.Poll['pollId'];
67
75
  };
@@ -82,6 +90,8 @@ declare global {
82
90
  ? ContentDataPoll
83
91
  : T extends 'liveStream'
84
92
  ? ContentDataStream
93
+ : T extends 'clip'
94
+ ? ContentDataClip
85
95
  : T extends 'json'
86
96
  ? Record<string, unknown>
87
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>;
@@ -15,6 +15,8 @@ declare global {
15
15
 
16
16
  type Member<T extends Amity.GroupType> = {
17
17
  userId: Amity.InternalUser['userId'];
18
+ userInternalId: Amity.InternalUser['userInternalId'];
19
+ userPublicId: Amity.InternalUser['userPublicId'];
18
20
  } & (T extends 'channel'
19
21
  ? {
20
22
  channelId: Amity.Channel['channelId'];
@@ -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 {
@@ -82,10 +83,13 @@ declare global {
82
83
  getVideoInfo: () => Amity.File<'video'> | undefined;
83
84
  getVideoThumbnailInfo: () => Amity.File<'image'> | undefined;
84
85
  getFileInfo: () => Amity.File<'file'> | undefined;
86
+ getClipInfo: () => Amity.File<'clip'> | undefined;
85
87
  };
86
88
 
87
89
  type Post<T extends PostContentType = any> = Amity.InternalPost<T> & Amity.PostLinkObject;
88
90
 
91
+ type ClipDisplayMode = 'fill' | 'fit';
92
+
89
93
  type QueryPosts = {
90
94
  targetId: string;
91
95
  targetType: Amity.InternalPost['targetType'];
@@ -23,6 +23,7 @@ import {
23
23
  } from '~/core/query';
24
24
  import { prepareChannelPayload } from '~/channelRepository/utils';
25
25
  import { onUserDeleted } from '~/channelRepository/events/onUserDeleted';
26
+ import { LinkedObject } from '~/utils/linkedObject';
26
27
 
27
28
  export class ChannelMemberLiveCollectionController extends LiveCollectionController<
28
29
  'channelUser',
@@ -100,7 +101,8 @@ export class ChannelMemberLiveCollectionController extends LiveCollectionControl
100
101
  collection.data
101
102
  .map(id => pullFromCache<Amity.Membership<'channel'>>(['channelUsers', 'get', id])!)
102
103
  .filter(Boolean)
103
- .map(({ data }) => data) ?? [],
104
+ .map(({ data }) => data)
105
+ .map(LinkedObject.channelMember) ?? [],
104
106
  );
105
107
 
106
108
  if (!this.shouldNotify(data) && origin === 'event') return;
@@ -17,6 +17,7 @@ import {
17
17
  import { filterByPropIntersection, filterBySearchTerm } from '~/core/query';
18
18
  import { prepareChannelPayload } from '~/channelRepository/utils';
19
19
  import { onUserDeleted } from '~/channelRepository/events/onUserDeleted';
20
+ import { LinkedObject } from '~/utils/linkedObject';
20
21
 
21
22
  export class SearchChannelMemberLiveCollectionController extends LiveCollectionController<
22
23
  'channelUser',
@@ -94,7 +95,7 @@ export class SearchChannelMemberLiveCollectionController extends LiveCollectionC
94
95
  collection.data
95
96
  .map(id => pullFromCache<Amity.Membership<'channel'>>(['channelUsers', 'get', id])!)
96
97
  .filter(Boolean)
97
- .map(({ data }) => data) ?? [],
98
+ .map(({ data }) => LinkedObject.channelMember(data) ?? []),
98
99
  );
99
100
 
100
101
  if (!this.shouldNotify(data) && origin === 'event') return;
@@ -72,7 +72,7 @@ export class SearchChannelMemberQueryStreamController extends QueryStreamControl
72
72
  }
73
73
 
74
74
  reactor(action: string) {
75
- return (channel: Amity.InternalChannel, channelMember: Amity.Membership<'channel'>) => {
75
+ return (channel: Amity.StaticInternalChannel, channelMember: Amity.Membership<'channel'>) => {
76
76
  if (this.query.channelId !== channelMember.channelId) return;
77
77
 
78
78
  const collection = pullFromCache<Amity.ChannelMembersLiveCollectionCache>(
@@ -100,7 +100,7 @@ export class SearchChannelMemberQueryStreamController extends QueryStreamControl
100
100
  createSubscriber: {
101
101
  fn: (
102
102
  reactor: (
103
- channel: Amity.InternalChannel,
103
+ channel: Amity.StaticInternalChannel,
104
104
  channelMember: Amity.Membership<'channel'>,
105
105
  ) => void,
106
106
  ) => Amity.Unsubscriber;
@@ -5,7 +5,6 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
5
5
 
6
6
  import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
7
7
  import { prepareCommunityPayload } from '../utils';
8
- import { LinkedObject } from '~/utils/linkedObject';
9
8
 
10
9
  /**
11
10
  * ```js
@@ -23,8 +22,6 @@ import { LinkedObject } from '~/utils/linkedObject';
23
22
  */
24
23
  export const getCommunity = async (
25
24
  communityId: Amity.Community['communityId'],
26
- type?: Amity.JoinRequestType,
27
- includeDiscoverablePrivateCommunity?: boolean,
28
25
  ): Promise<Amity.Cached<Amity.InternalCommunity>> => {
29
26
  const client = getActiveClient();
30
27
  client.log('community/getCommunity', communityId);
@@ -32,12 +29,6 @@ export const getCommunity = async (
32
29
  // API-FIX: endpoint should not be /list, parameters should be querystring.
33
30
  const { data: payload } = await client.http.get<Amity.CommunityPayload>(
34
31
  `/api/v3/communities/${communityId}`,
35
- {
36
- params: {
37
- type: 'communityJoinRequest',
38
- includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
39
- },
40
- },
41
32
  );
42
33
 
43
34
  const data = prepareCommunityPayload(payload);
@@ -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';
@@ -0,0 +1,71 @@
1
+ import { getActiveClient } from '~/client/api/activeClient';
2
+ import { ingestInCache } from '~/cache/api/ingestInCache';
3
+ import GlobalFileAccessType from '~/client/utils/GlobalFileAccessType';
4
+
5
+ /* begin_public_function
6
+ id: file.upload.clip
7
+ */
8
+ /**
9
+ * ```js
10
+ * import { FileRepository } from '@amityco/ts-sdk'
11
+ * const created = await FileRepository.uploadClip(formData)
12
+ * ```
13
+ *
14
+ * Creates an {@link Amity.File}
15
+ *
16
+ * @param formData The data necessary to create a new {@link Amity.File}
17
+ * @param onProgress The callback to track the upload progress
18
+ * @returns The newly created {@link Amity.File}
19
+ *
20
+ * @category File API
21
+ * @async
22
+ */
23
+ export const uploadClip = async (
24
+ formData: FormData,
25
+ feedType?: Amity.ContentFeedType,
26
+ onProgress?: (percent: number) => void,
27
+ ): Promise<Amity.Cached<Amity.File<'clip'>[]>> => {
28
+ const client = getActiveClient();
29
+ client.log('file/uploadClip', formData);
30
+
31
+ const file = formData.get('files');
32
+
33
+ if (!file) throw new Error('The formData object must have a `files` key.');
34
+
35
+ const accessType = GlobalFileAccessType.getInstance().getFileAccessType();
36
+ formData.append('accessType', accessType);
37
+
38
+ formData.append('preferredFilename', (file as File).name);
39
+
40
+ if (feedType) {
41
+ formData.append('feedType', feedType);
42
+ }
43
+
44
+ const headers =
45
+ 'getHeaders' in formData
46
+ ? (formData as any).getHeaders()
47
+ : { 'content-type': 'multipart/form-data' };
48
+
49
+ const { data } = await client.upload.post<Amity.CreateFilePayload<'clip'>>(
50
+ '/api/v4/clips',
51
+ formData,
52
+ {
53
+ headers,
54
+ onUploadProgress({ loaded, total = 100 }) {
55
+ onProgress && onProgress(Math.round((loaded * 100) / total));
56
+ },
57
+ },
58
+ );
59
+
60
+ // API-FIX: payload should be serialized properly
61
+ // const { files } = data
62
+
63
+ const cachedAt = client.cache && Date.now();
64
+ if (client.cache) ingestInCache({ files: data }, { cachedAt });
65
+
66
+ return {
67
+ data,
68
+ cachedAt,
69
+ };
70
+ };
71
+ /* end_public_function */
@@ -0,0 +1,62 @@
1
+ import { getActiveClient } from '~/client/api/activeClient';
2
+
3
+ import { ingestInCache } from '~/cache/api/ingestInCache';
4
+ import { fireEvent } from '~/core/events';
5
+ import { prepareMembershipPayload } from '~/group/utils';
6
+ import { LinkedObject } from '~/utils/linkedObject';
7
+
8
+ /* begin_public_function
9
+ id: post.create.clip_post
10
+ */
11
+ /**
12
+ * ```js
13
+ * import { PostRepository } from '@amityco/ts-sdk'
14
+ * const created = await PostRepository.createClipPost({
15
+ * targetType: 'user',
16
+ * targetId: 'foobar',
17
+ * dataType: 'clip',
18
+ * data: { text: 'hello world' },
19
+ * attachments: [{ type: 'clip', fileId: 'fileId123', displayMode: 'fill', isMuted: false }]
20
+ * }))
21
+ * ```
22
+ *
23
+ * Creates an {@link Amity.Post}
24
+ *
25
+ * @param bundle The data necessary to create a new {@link Amity.Post}
26
+ * @returns The newly created {@link Amity.Post}
27
+ *
28
+ * @category Post API
29
+ * @async
30
+ */
31
+ export const createClipPost = async <T extends Amity.PostContentType | string>(
32
+ bundle: Pick<Amity.Post<T>, 'targetType' | 'targetId'> &
33
+ Partial<Pick<Amity.Post<T>, 'metadata' | 'mentionees' | 'tags'>> & {
34
+ data: { [k: string]: any };
35
+ attachments: {
36
+ type: T;
37
+ fileId: Amity.File['fileId'];
38
+ displayMode?: Amity.ClipDisplayMode;
39
+ isMuted?: boolean;
40
+ }[];
41
+ },
42
+ ): Promise<Amity.Cached<Amity.Post>> => {
43
+ const client = getActiveClient();
44
+ client.log('post/createPost', bundle);
45
+
46
+ const { data: payload } = await client.http.post<Amity.PostPayload>('/api/v4/posts', bundle);
47
+
48
+ fireEvent('post.created', payload);
49
+
50
+ const data = prepareMembershipPayload(payload, 'communityUsers');
51
+ const cachedAt = client.cache && Date.now();
52
+
53
+ if (client.cache) ingestInCache(data, { cachedAt });
54
+
55
+ const { posts } = data;
56
+
57
+ return {
58
+ data: LinkedObject.post(posts[0]),
59
+ cachedAt,
60
+ };
61
+ };
62
+ /* end_public_function */
@@ -13,3 +13,5 @@ export * from './declinePost';
13
13
  export * from './flagPost';
14
14
  export * from './unflagPost';
15
15
  export * from './isPostFlaggedByMe';
16
+
17
+ export * from './createClipPost';
@@ -43,7 +43,7 @@ export const queryPosts = async (
43
43
  // API-FIX: parameters should be querystring. (1)
44
44
  // API-FIX: backend should answer Amity.Response (2)
45
45
  // const { data } = await client.http.get<Amity.Response<Amity.PagedResponse<Amity.PostPayload>>>(
46
- const { data } = await client.http.get<Amity.PostPayload & Amity.Pagination>(`/api/v4/posts`, {
46
+ const { data } = await client.http.get<Amity.PostPayload & Amity.Pagination>(`/api/v5/posts`, {
47
47
  params: {
48
48
  ...params,
49
49
  isDeleted: inferIsDeleted(includeDeleted),
@@ -23,7 +23,7 @@ export class PostPaginationController extends PaginationController<
23
23
  const options = token ? { ...baseOptions, token } : { ...baseOptions, limit };
24
24
 
25
25
  const { data: queryResponse } = await this.http.get<Amity.PostPayload & Amity.Pagination>(
26
- `/api/v4/posts`,
26
+ `/api/v5/posts`,
27
27
  {
28
28
  params: {
29
29
  ...params,
@@ -1,8 +1,27 @@
1
1
  import { markAsRead } from '~/channelRepository/internalApi/markAsRead';
2
2
  import { shallowClone } from '../shallowClone';
3
+ import { queryCache } from '~/cache/api';
4
+ import { channelMemberLinkedObject } from './channelMemberLinkedObject';
3
5
 
4
6
  export const channelLinkedObject = (channel: Amity.InternalChannel): Amity.Channel => {
7
+ let previewMembers: Amity.Membership<'channel'>[] = [];
8
+
9
+ if (channel.type === 'conversation') {
10
+ const channelUsers = queryCache<Amity.Membership<'channel'>>(['channelUsers', 'get']);
11
+ if (channelUsers && channelUsers?.length > 0) {
12
+ previewMembers = (
13
+ channelUsers?.filter(({ data }) => data.channelId === channel.channelId) ?? []
14
+ )
15
+ // sort in ascending order by userInternalId
16
+ .sort((a, b) => a.data.userInternalId.localeCompare(b.data.userInternalId))
17
+ // Select only first 4 members
18
+ .slice(0, 4)
19
+ .map(({ data }) => channelMemberLinkedObject(data));
20
+ }
21
+ }
22
+
5
23
  return shallowClone(channel, {
6
24
  markAsRead: () => markAsRead(channel.channelInternalId),
25
+ previewMembers,
7
26
  });
8
27
  };
@@ -0,0 +1,20 @@
1
+ import { pullFromCache } from '~/cache/api/pullFromCache';
2
+ import { userLinkedObject } from './userLinkedObject';
3
+
4
+ export const channelMemberLinkedObject = (
5
+ channelMember: Amity.Membership<'channel'>,
6
+ ): Amity.Membership<'channel'> => {
7
+ const getUser = (): Amity.User | undefined => {
8
+ const cacheKey = ['user', 'get', channelMember.userId];
9
+ const internalUser = pullFromCache<Amity.InternalUser>(cacheKey)?.data;
10
+
11
+ return internalUser ? userLinkedObject(internalUser) : undefined;
12
+ };
13
+
14
+ return {
15
+ ...channelMember,
16
+ get user() {
17
+ return getUser();
18
+ },
19
+ };
20
+ };
@@ -14,6 +14,7 @@ import { notificationTrayLinkedObject } from './notificationTrayLinkedObject';
14
14
  import { communityLinkedObject } from './communityLinkedObject';
15
15
  import { invitationLinkedObject } from './invitationLinkedObject';
16
16
  import { joinRequestLinkedObject } from './joinRequestLinkedObject';
17
+ import { channelMemberLinkedObject } from './channelMemberLinkedObject';
17
18
 
18
19
  export const LinkedObject = {
19
20
  ad: adLinkedObject,
@@ -32,4 +33,5 @@ export const LinkedObject = {
32
33
  community: communityLinkedObject,
33
34
  invitation: invitationLinkedObject,
34
35
  joinRequest: joinRequestLinkedObject,
36
+ channelMember: channelMemberLinkedObject,
35
37
  };
@@ -2,7 +2,12 @@ import { pullFromCache } from '~/cache/api';
2
2
  import { commentLinkedObject } from '~/utils/linkedObject/commentLinkedObject';
3
3
  import AnalyticsEngine from '../../analytic/service/analytic/AnalyticsEngine';
4
4
  import { userLinkedObject } from './userLinkedObject';
5
- import { isAmityFilePost, isAmityImagePost, isAmityVideoPost } from '../postTypePredicate';
5
+ import {
6
+ isAmityClipPost,
7
+ isAmityFilePost,
8
+ isAmityImagePost,
9
+ isAmityVideoPost,
10
+ } from '../postTypePredicate';
6
11
 
7
12
  export const postLinkedObject = (post: Amity.InternalPost): Amity.Post => {
8
13
  return {
@@ -64,5 +69,11 @@ export const postLinkedObject = (post: Amity.InternalPost): Amity.Post => {
64
69
  ? pullFromCache<Amity.File<'file'>>(['file', 'get', post?.data?.fileId])?.data
65
70
  : undefined;
66
71
  },
72
+
73
+ getClipInfo(): Amity.File<'clip'> | undefined {
74
+ return isAmityClipPost(post)
75
+ ? pullFromCache<Amity.File<'clip'>>(['file', 'get', post?.data?.fileId])?.data
76
+ : undefined;
77
+ },
67
78
  };
68
79
  };