@amityco/ts-sdk 7.6.1-65b44ce1.0 → 7.6.1-b83cbdc.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/@types/domains/channel.d.ts +0 -2
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +0 -3
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/@types/domains/stream.d.ts +0 -4
- package/dist/@types/domains/stream.d.ts.map +1 -1
- package/dist/channelRepository/api/createChannel.d.ts +1 -3
- package/dist/channelRepository/api/createChannel.d.ts.map +1 -1
- package/dist/channelRepository/internalApi/getChannel.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
- package/dist/index.cjs.js +5335 -5499
- package/dist/index.esm.js +5603 -5767
- package/dist/index.umd.js +2 -2
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +0 -2
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts.map +1 -1
- package/dist/messageRepository/api/deleteMessage.d.ts.map +1 -1
- package/dist/messageRepository/observers/getMessages/MessageQueryStreamController.d.ts.map +1 -1
- package/dist/postRepository/api/createPost.d.ts.map +1 -1
- package/dist/postRepository/utils/payload.d.ts.map +1 -1
- package/dist/streamRepository/api/createStream.d.ts +1 -1
- package/dist/streamRepository/api/createStream.d.ts.map +1 -1
- package/dist/streamRepository/api/index.d.ts +0 -1
- package/dist/streamRepository/api/index.d.ts.map +1 -1
- package/dist/streamRepository/api/updateStream.d.ts +1 -4
- package/dist/streamRepository/api/updateStream.d.ts.map +1 -1
- package/dist/streamRepository/internalApi/getStream.d.ts +2 -2
- package/dist/streamRepository/internalApi/getStream.d.ts.map +1 -1
- package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
- package/dist/utils/linkedObject/streamLinkedObject.d.ts.map +1 -1
- package/dist/utils/postTypePredicate.d.ts +3 -5
- package/dist/utils/postTypePredicate.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/channel.ts +0 -3
- package/src/@types/domains/post.ts +0 -3
- package/src/@types/domains/stream.ts +0 -4
- package/src/channelRepository/api/createChannel.ts +9 -12
- package/src/channelRepository/internalApi/getChannel.ts +1 -0
- package/src/channelRepository/utils/constructChannelObject.ts +2 -2
- package/src/communityRepository/api/getCommunity.ts +0 -9
- package/src/messageRepository/api/deleteMessage.ts +0 -16
- package/src/messageRepository/observers/getMessages/MessageQueryStreamController.ts +0 -13
- package/src/postRepository/api/createPost.ts +2 -3
- package/src/postRepository/utils/payload.ts +1 -37
- package/src/streamRepository/api/createStream.ts +1 -4
- package/src/streamRepository/api/index.ts +0 -1
- package/src/streamRepository/api/updateStream.ts +1 -8
- package/src/streamRepository/internalApi/getStream.ts +3 -3
- package/src/streamRepository/observers/getStreams/GetStreamsLiveCollectionController.ts +1 -1
- package/src/utils/linkedObject/postLinkedObject.ts +2 -32
- package/src/utils/linkedObject/streamLinkedObject.ts +0 -2
- package/src/utils/postTypePredicate.ts +3 -26
- package/dist/streamRepository/api/editStream.d.ts +0 -18
- package/dist/streamRepository/api/editStream.d.ts.map +0 -1
- package/dist/streamRepository/internalApi/getLiveChat.d.ts +0 -16
- package/dist/streamRepository/internalApi/getLiveChat.d.ts.map +0 -1
- package/src/streamRepository/api/editStream.ts +0 -51
- package/src/streamRepository/internalApi/getLiveChat.ts +0 -59
|
@@ -21,8 +21,6 @@ export declare const getChannelMessagePreviewWithUser: (channel: Amity.StaticInt
|
|
|
21
21
|
messagePreviewId?: string | undefined;
|
|
22
22
|
isPublic?: boolean | undefined;
|
|
23
23
|
lastActivity: string;
|
|
24
|
-
attachedToPostId?: string | undefined;
|
|
25
|
-
attachedToVideoStreamId?: string | undefined;
|
|
26
24
|
} & Amity.Metadata & Amity.Taggable & Amity.CreatedAt & Amity.UpdatedAt & Amity.DeletedAt & {
|
|
27
25
|
isDeleted?: boolean | undefined;
|
|
28
26
|
} & Amity.Subscribable & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getChannelMessagePreviewWithUser.d.ts","sourceRoot":"","sources":["../../../src/messagePreview/utils/getChannelMessagePreviewWithUser.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gCAAgC,YAClC,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"getChannelMessagePreviewWithUser.d.ts","sourceRoot":"","sources":["../../../src/messagePreview/utils/getChannelMessagePreviewWithUser.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gCAAgC,YAClC,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAEpB,MAAM,cAAc,GAAG,IAAI;CAoB5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/deleteMessage.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa;gBACb,MAAM,OAAO,CAAC,WAAW,CAAC,GACpC,QAAQ,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"deleteMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/deleteMessage.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa;gBACb,MAAM,OAAO,CAAC,WAAW,CAAC,GACpC,QAAQ,MAAM,OAAO,CAAC;IAiBzB;;;;;;;;;;;;OAYG;8BAEU,MAAM,OAAO,CAAC,WAAW,CAAC,GACpC,MAAM,MAAM,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS;CAjBzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageQueryStreamController.d.ts","sourceRoot":"","sources":["../../../../src/messageRepository/observers/getMessages/MessageQueryStreamController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAIpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAG5E,qBAAa,4BAA6B,SAAQ,qBAAqB,CACrE,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,sBAAsB,CAC7B;IACC,OAAO,CAAC,YAAY,CAAqD;IAEzE,OAAO,CAAC,cAAc,CAEsB;IAE5C,OAAO,CAAC,oBAAoB,CAA8B;gBAGxD,KAAK,EAAE,KAAK,CAAC,sBAAsB,EACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,KAAK,IAAI,EAChE,cAAc,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,KAAK,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,EAC1F,oBAAoB,EAAE,2BAA2B;IAS7C,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc;IAWjD,mBAAmB,CACjB,QAAQ,EAAE,KAAK,CAAC,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAC1D,SAAS,EAAE,KAAK,CAAC,2BAA2B,EAC5C,OAAO,UAAQ;IAsBjB,OAAO,CAAC,MAAM,EAAE,MAAM,aACH,MAAM,eAAe;
|
|
1
|
+
{"version":3,"file":"MessageQueryStreamController.d.ts","sourceRoot":"","sources":["../../../../src/messageRepository/observers/getMessages/MessageQueryStreamController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAIpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAG5E,qBAAa,4BAA6B,SAAQ,qBAAqB,CACrE,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,sBAAsB,CAC7B;IACC,OAAO,CAAC,YAAY,CAAqD;IAEzE,OAAO,CAAC,cAAc,CAEsB;IAE5C,OAAO,CAAC,oBAAoB,CAA8B;gBAGxD,KAAK,EAAE,KAAK,CAAC,sBAAsB,EACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,KAAK,IAAI,EAChE,cAAc,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,KAAK,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,EAC1F,oBAAoB,EAAE,2BAA2B;IAS7C,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc;IAWjD,mBAAmB,CACjB,QAAQ,EAAE,KAAK,CAAC,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAC1D,SAAS,EAAE,KAAK,CAAC,2BAA2B,EAC5C,OAAO,UAAQ;IAsBjB,OAAO,CAAC,MAAM,EAAE,MAAM,aACH,MAAM,eAAe;IAmDxC,YAAY,CACV,gBAAgB,EAAE;QAChB,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC;QAC3E,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE;CAIN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/createPost.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU;;;;;;;gBAKgB,UAAU,CAAC,QAAQ,CAAC;;MAExD,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"createPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/createPost.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU;;;;;;;gBAKgB,UAAU,CAAC,QAAQ,CAAC;;MAExD,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CAwBlC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/postRepository/utils/payload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/postRepository/utils/payload.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,YAAa,MAAM,WAAW,KAAG,MAAM,oBAuCrE,CAAC;AAEF,eAAO,MAAM,gCAAgC,4CAI1C,MAAM,yBAAyB,KAAG,MAAM,kCAO1C,CAAC"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* @category Stream API
|
|
13
13
|
* @async
|
|
14
14
|
*/
|
|
15
|
-
export declare const createStream: (bundle: Pick<Amity.InternalStream, 'title' | 'thumbnailFileId' | 'description'
|
|
15
|
+
export declare const createStream: (bundle: Pick<Amity.InternalStream, 'title' | 'thumbnailFileId' | 'description'> & {
|
|
16
16
|
isSecure?: boolean;
|
|
17
17
|
}) => Promise<Amity.Cached<Amity.Stream>>;
|
|
18
18
|
//# sourceMappingURL=createStream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createStream.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/api/createStream.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,WACf,
|
|
1
|
+
{"version":3,"file":"createStream.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/api/createStream.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,WACf,KAAK,MAAM,cAAc,EAAE,OAAO,GAAG,iBAAiB,GAAG,aAAa,CAAC,GAAG;IAChF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,KACA,QAAQ,MAAM,MAAM,CAAC,MAAM,MAAM,CAAC,CAepC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @deprecated this function is deprecated,
|
|
3
|
-
* please use {@link Amity.StreamRepository.editStream} instead.
|
|
4
|
-
*
|
|
5
2
|
* ```js
|
|
6
3
|
* import { updateStream } from '@amityco/ts-sdk'
|
|
7
4
|
* const updated = await updateStream(streamId, { title: 'foobar' })
|
|
@@ -16,5 +13,5 @@
|
|
|
16
13
|
* @category Stream API
|
|
17
14
|
* @async
|
|
18
15
|
*/
|
|
19
|
-
export declare const updateStream: (streamId: Amity.Stream['streamId'], patch: Patch<Amity.Stream, 'title' | 'thumbnailFileId' | 'description' | 'metadata'
|
|
16
|
+
export declare const updateStream: (streamId: Amity.Stream['streamId'], patch: Patch<Amity.Stream, 'title' | 'thumbnailFileId' | 'description' | 'metadata'>) => Promise<Amity.Cached<Amity.Stream>>;
|
|
20
17
|
//# sourceMappingURL=updateStream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateStream.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/api/updateStream.ts"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"updateStream.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/api/updateStream.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,aACb,MAAM,MAAM,CAAC,UAAU,CAAC,SAC3B,MAAM,MAAM,MAAM,EAAE,OAAO,GAAG,iBAAiB,GAAG,aAAa,GAAG,UAAU,CAAC,KACnF,QAAQ,MAAM,MAAM,CAAC,MAAM,MAAM,CAAC,CAkBpC,CAAC"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @async
|
|
14
14
|
*/
|
|
15
15
|
export declare const getStream: {
|
|
16
|
-
(streamId: Amity.Stream['streamId']): Promise<Amity.Cached<Amity.
|
|
16
|
+
(streamId: Amity.Stream['streamId']): Promise<Amity.Cached<Amity.Stream>>;
|
|
17
17
|
/**
|
|
18
18
|
* ```js
|
|
19
19
|
* import { getStream } from '@amityco/ts-sdk'
|
|
@@ -27,6 +27,6 @@ export declare const getStream: {
|
|
|
27
27
|
*
|
|
28
28
|
* @category Stream API
|
|
29
29
|
*/
|
|
30
|
-
locally(streamId: Amity.Stream['streamId']): Amity.Cached<Amity.
|
|
30
|
+
locally(streamId: Amity.Stream['streamId']): Amity.Cached<Amity.Stream> | undefined;
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=getStream.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStream.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/internalApi/getStream.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS;eACV,MAAM,MAAM,CAAC,UAAU,CAAC,GACjC,QAAQ,MAAM,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"getStream.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/internalApi/getStream.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS;eACV,MAAM,MAAM,CAAC,UAAU,CAAC,GACjC,QAAQ,MAAM,MAAM,CAAC,MAAM,MAAM,CAAC,CAAC;IAoBtC;;;;;;;;;;;;OAYG;sBAES,MAAM,MAAM,CAAC,UAAU,CAAC,GACjC,MAAM,MAAM,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS;CAlBxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/postLinkedObject.ts"],"names":[],"mappings":"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/streamLinkedObject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"streamLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/streamLinkedObject.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,WAAY,MAAM,cAAc,KAAG,MAAM,MAmBvE,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export declare function isAmityImagePost(post
|
|
2
|
-
export declare function isAmityFilePost(post
|
|
3
|
-
export declare function isAmityVideoPost(post
|
|
4
|
-
export declare function isAmityLivestreamPost(post?: Amity.InternalPost): post is Amity.Post<'liveStream'>;
|
|
5
|
-
export declare function isAmityPollPost(post?: Amity.InternalPost): post is Amity.Post<'poll'>;
|
|
1
|
+
export declare function isAmityImagePost(post: Amity.InternalPost): post is Amity.Post<'image'>;
|
|
2
|
+
export declare function isAmityFilePost(post: Amity.InternalPost): post is Amity.Post<'file'>;
|
|
3
|
+
export declare function isAmityVideoPost(post: Amity.InternalPost): post is Amity.Post<'video'>;
|
|
6
4
|
//# 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,
|
|
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"}
|
package/package.json
CHANGED
|
@@ -73,7 +73,6 @@ declare global {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
type PostLinkObject = {
|
|
76
|
-
childrenPosts: Amity.Post[];
|
|
77
76
|
latestComments: (Amity.Comment | null)[];
|
|
78
77
|
creator: Amity.User | undefined;
|
|
79
78
|
analytics: {
|
|
@@ -83,8 +82,6 @@ declare global {
|
|
|
83
82
|
getVideoInfo: () => Amity.File<'video'> | undefined;
|
|
84
83
|
getVideoThumbnailInfo: () => Amity.File<'image'> | undefined;
|
|
85
84
|
getFileInfo: () => Amity.File<'file'> | undefined;
|
|
86
|
-
getPollInfo: () => Amity.Poll | undefined;
|
|
87
|
-
getLivestreamInfo: () => Amity.Stream | undefined;
|
|
88
85
|
};
|
|
89
86
|
|
|
90
87
|
type Post<T extends PostContentType = any> = Amity.InternalPost<T> & Amity.PostLinkObject;
|
|
@@ -73,9 +73,6 @@ declare global {
|
|
|
73
73
|
*/
|
|
74
74
|
targetId?: string; // communityId, userId, etc..
|
|
75
75
|
targetType?: string; // 'community', 'user', etc..
|
|
76
|
-
channelId?: string;
|
|
77
|
-
postId?: string;
|
|
78
|
-
channelEnabled?: boolean;
|
|
79
76
|
} & Amity.Metadata &
|
|
80
77
|
Amity.Timestamps &
|
|
81
78
|
Amity.SoftDelete;
|
|
@@ -84,7 +81,6 @@ declare global {
|
|
|
84
81
|
|
|
85
82
|
type StreamLinkedObject = {
|
|
86
83
|
moderation?: Amity.StreamModeration;
|
|
87
|
-
getLiveChat: () => Promise<Amity.Channel<'live'> | undefined>;
|
|
88
84
|
};
|
|
89
85
|
|
|
90
86
|
type Stream = Amity.InternalStream & Amity.StreamLinkedObject;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getActiveClient } from '~/client/api
|
|
1
|
+
import { getActiveClient } from '~/client/api';
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
|
|
5
|
-
import { prepareChannelPayload } from '../utils
|
|
6
|
-
import {
|
|
5
|
+
import { prepareChannelPayload } from '../utils';
|
|
6
|
+
import { constructChannelDynamicValue } from '../utils/constructChannelDynamicValue';
|
|
7
7
|
|
|
8
8
|
/* begin_public_function
|
|
9
9
|
id: channel.create
|
|
@@ -23,14 +23,11 @@ import { constructChannelObject } from '../utils/constructChannelObject';
|
|
|
23
23
|
* @async
|
|
24
24
|
*/
|
|
25
25
|
export const createChannel = async <T extends Amity.ChannelType>(
|
|
26
|
-
bundle: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
postId?: string;
|
|
32
|
-
} & Pick<Amity.Channel<T>, 'displayName' | 'avatarFileId' | 'tags' | 'metadata' | 'isPublic'>,
|
|
33
|
-
): Promise<Amity.Cached<Amity.Channel<T>>> => {
|
|
26
|
+
bundle: { type: T; userIds?: Amity.InternalUser['userId'][] } & Pick<
|
|
27
|
+
Amity.Channel<T>,
|
|
28
|
+
'displayName' | 'avatarFileId' | 'tags' | 'metadata' | 'isPublic'
|
|
29
|
+
>,
|
|
30
|
+
): Promise<Amity.Cached<Amity.InternalChannel>> => {
|
|
34
31
|
const client = getActiveClient();
|
|
35
32
|
client.log('user/createChannel', bundle);
|
|
36
33
|
|
|
@@ -56,7 +53,7 @@ export const createChannel = async <T extends Amity.ChannelType>(
|
|
|
56
53
|
|
|
57
54
|
const { channels } = data;
|
|
58
55
|
return {
|
|
59
|
-
data:
|
|
56
|
+
data: constructChannelDynamicValue(channels[0]),
|
|
60
57
|
cachedAt,
|
|
61
58
|
};
|
|
62
59
|
};
|
|
@@ -9,6 +9,7 @@ import { pushToTombstone } from '~/cache/api/pushToTombstone';
|
|
|
9
9
|
|
|
10
10
|
import { prepareChannelPayload } from '../utils';
|
|
11
11
|
import { prepareUnreadCountInfo } from '../utils/prepareUnreadCountInfo';
|
|
12
|
+
import { constructChannelDynamicValue } from '../utils/constructChannelDynamicValue';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* ```js
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getChannelMessagePreviewWithUser } from '~/messagePreview/utils';
|
|
2
2
|
import { constructChannelDynamicValue } from './constructChannelDynamicValue';
|
|
3
|
-
import {
|
|
3
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
4
4
|
|
|
5
5
|
export const constructChannelObject = (channel: Amity.StaticInternalChannel): Amity.Channel => {
|
|
6
6
|
/**
|
|
@@ -10,7 +10,7 @@ export const constructChannelObject = (channel: Amity.StaticInternalChannel): Am
|
|
|
10
10
|
* 3. [LinkedObject.channel] add markAsRead >> Amity.InternalChannel -> Amity.Channel
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
return
|
|
13
|
+
return LinkedObject.channel(
|
|
14
14
|
constructChannelDynamicValue(getChannelMessagePreviewWithUser(channel)),
|
|
15
15
|
);
|
|
16
16
|
};
|
|
@@ -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,22 +23,6 @@ export const deleteMessage = async (
|
|
|
23
23
|
const client = getActiveClient();
|
|
24
24
|
client.log('message/deleteMessage', messageId);
|
|
25
25
|
|
|
26
|
-
if (messageId.includes('LOCAL_')) {
|
|
27
|
-
const message = pullFromCache<Amity.InternalMessage>(['message', 'get', messageId])?.data;
|
|
28
|
-
if (!message) throw Error('messageId not found');
|
|
29
|
-
|
|
30
|
-
const deletedMessage = {
|
|
31
|
-
...message,
|
|
32
|
-
isDeleted: true,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
fireEvent('local.message.deleted', {
|
|
36
|
-
messages: [deletedMessage],
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
return LinkedObject.message(deletedMessage);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
26
|
// API-FIX: This endpoint has not been implemented yet.
|
|
43
27
|
const { data: deleted } = await client.http.delete<Amity.MessagePayload>(
|
|
44
28
|
`/api/v5/messages/${encodeURIComponent(messageId)}`,
|
|
@@ -116,19 +116,6 @@ export class MessageQueryStreamController extends QueryStreamController<
|
|
|
116
116
|
pushToCache(this.cacheKey, collection);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
if (action === 'onDelete' && payload.syncState === Amity.SyncState.Error) {
|
|
120
|
-
const collection = pullFromCache<Amity.MessageLiveCollectionCache>(this.cacheKey)?.data;
|
|
121
|
-
if (!collection) return;
|
|
122
|
-
|
|
123
|
-
if (collection.data.includes(payload.messageId)) {
|
|
124
|
-
const newCollectionData = collection.data.filter(
|
|
125
|
-
messageId => messageId !== payload.messageId,
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
pushToCache(this.cacheKey, { ...collection, data: newCollectionData });
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
119
|
this.notifyChange({ origin: Amity.LiveDataOrigin.EVENT, loading: false });
|
|
133
120
|
};
|
|
134
121
|
}
|
|
@@ -2,8 +2,8 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import { fireEvent } from '~/core/events';
|
|
5
|
+
import { prepareMembershipPayload } from '~/group/utils';
|
|
5
6
|
import { LinkedObject } from '~/utils/linkedObject';
|
|
6
|
-
import { preparePostPayload } from '../utils/payload';
|
|
7
7
|
|
|
8
8
|
/* begin_public_function
|
|
9
9
|
id: post.create.text_post, post.create.image_post, post.create.file_post, post.create.video_post, post.create.poll_post, post.create.livestream_post, post.create.custom_post
|
|
@@ -46,8 +46,7 @@ export const createPost = async <T extends Amity.PostContentType | string>(
|
|
|
46
46
|
|
|
47
47
|
fireEvent('post.created', payload);
|
|
48
48
|
|
|
49
|
-
const data =
|
|
50
|
-
|
|
49
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
51
50
|
const cachedAt = client.cache && Date.now();
|
|
52
51
|
|
|
53
52
|
if (client.cache) ingestInCache(data, { cachedAt });
|
|
@@ -1,28 +1,8 @@
|
|
|
1
1
|
import { addPostSetting } from '~/communityRepository/utils';
|
|
2
2
|
import { updateMembershipStatus } from '~/communityRepository/utils/communityWithMembership';
|
|
3
|
-
import { isAmityLivestreamPost } from '~/utils/postTypePredicate';
|
|
4
|
-
|
|
5
|
-
const updateStreamReferences = (
|
|
6
|
-
streams: Amity.RawStream[],
|
|
7
|
-
streamId: string | undefined,
|
|
8
|
-
postId: string,
|
|
9
|
-
) => {
|
|
10
|
-
if (!streamId) return streams;
|
|
11
|
-
|
|
12
|
-
return streams.map(stream =>
|
|
13
|
-
stream.streamId === streamId
|
|
14
|
-
? {
|
|
15
|
-
...stream,
|
|
16
|
-
referenceType: 'post',
|
|
17
|
-
referenceId: postId,
|
|
18
|
-
postId,
|
|
19
|
-
}
|
|
20
|
-
: stream,
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
3
|
|
|
24
4
|
export const preparePostPayload = (payload: Amity.PostPayload): Amity.ProcessedPostPayload => {
|
|
25
|
-
const { posts: postsData,
|
|
5
|
+
const { posts: postsData, ...postPayload } = payload;
|
|
26
6
|
|
|
27
7
|
// Unpack community payload by mapping payload field to postSetting value.
|
|
28
8
|
const communitiesWithPostSetting = addPostSetting({ communities: postPayload.communities });
|
|
@@ -44,34 +24,18 @@ export const preparePostPayload = (payload: Amity.PostPayload): Amity.ProcessedP
|
|
|
44
24
|
mappedCommunityUsers,
|
|
45
25
|
);
|
|
46
26
|
|
|
47
|
-
let mappedNewStream: Amity.RawStream[] = [];
|
|
48
|
-
|
|
49
27
|
// feed type
|
|
50
28
|
const posts = postsData.map(post => {
|
|
51
29
|
const feedType = postPayload.feeds.find(feed => feed.feedId === post.feedId)?.feedType;
|
|
52
|
-
const childPosts = payload.postChildren.filter(
|
|
53
|
-
children => children.parentPostId === post.postId,
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
if (childPosts.length > 0 && isAmityLivestreamPost(childPosts[0])) {
|
|
57
|
-
mappedNewStream = updateStreamReferences(
|
|
58
|
-
videoStreamings,
|
|
59
|
-
childPosts[0].data?.streamId,
|
|
60
|
-
post.postId,
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
30
|
|
|
64
31
|
return {
|
|
65
32
|
...post,
|
|
66
|
-
childPosts,
|
|
67
33
|
feedType,
|
|
68
34
|
};
|
|
69
35
|
});
|
|
70
36
|
|
|
71
37
|
return {
|
|
72
38
|
...postPayload,
|
|
73
|
-
postChildren,
|
|
74
|
-
videoStreamings: mappedNewStream,
|
|
75
39
|
posts,
|
|
76
40
|
communities: communityWithMembershipStatus,
|
|
77
41
|
communityUsers: mappedCommunityUsers,
|
|
@@ -21,10 +21,7 @@ import { LinkedObject } from '~/utils/linkedObject';
|
|
|
21
21
|
* @async
|
|
22
22
|
*/
|
|
23
23
|
export const createStream = async (
|
|
24
|
-
bundle: Pick<
|
|
25
|
-
Amity.InternalStream,
|
|
26
|
-
'title' | 'thumbnailFileId' | 'description' | 'channelEnabled'
|
|
27
|
-
> & {
|
|
24
|
+
bundle: Pick<Amity.InternalStream, 'title' | 'thumbnailFileId' | 'description'> & {
|
|
28
25
|
isSecure?: boolean;
|
|
29
26
|
},
|
|
30
27
|
): Promise<Amity.Cached<Amity.Stream>> => {
|
|
@@ -7,9 +7,6 @@ import { LinkedObject } from '~/utils/linkedObject';
|
|
|
7
7
|
id: stream.update
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
-
* @deprecated this function is deprecated,
|
|
11
|
-
* please use {@link Amity.StreamRepository.editStream} instead.
|
|
12
|
-
*
|
|
13
10
|
* ```js
|
|
14
11
|
* import { updateStream } from '@amityco/ts-sdk'
|
|
15
12
|
* const updated = await updateStream(streamId, { title: 'foobar' })
|
|
@@ -24,13 +21,9 @@ import { LinkedObject } from '~/utils/linkedObject';
|
|
|
24
21
|
* @category Stream API
|
|
25
22
|
* @async
|
|
26
23
|
*/
|
|
27
|
-
|
|
28
24
|
export const updateStream = async (
|
|
29
25
|
streamId: Amity.Stream['streamId'],
|
|
30
|
-
patch: Patch<
|
|
31
|
-
Amity.Stream,
|
|
32
|
-
'title' | 'thumbnailFileId' | 'description' | 'metadata' | 'channelEnabled'
|
|
33
|
-
>,
|
|
26
|
+
patch: Patch<Amity.Stream, 'title' | 'thumbnailFileId' | 'description' | 'metadata'>,
|
|
34
27
|
): Promise<Amity.Cached<Amity.Stream>> => {
|
|
35
28
|
const client = getActiveClient();
|
|
36
29
|
client.log('stream/updateStream', streamId, patch);
|
|
@@ -22,7 +22,7 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
22
22
|
*/
|
|
23
23
|
export const getStream = async (
|
|
24
24
|
streamId: Amity.Stream['streamId'],
|
|
25
|
-
): Promise<Amity.Cached<Amity.
|
|
25
|
+
): Promise<Amity.Cached<Amity.Stream>> => {
|
|
26
26
|
const client = getActiveClient();
|
|
27
27
|
client.log('stream/getStream', streamId);
|
|
28
28
|
|
|
@@ -57,13 +57,13 @@ export const getStream = async (
|
|
|
57
57
|
*/
|
|
58
58
|
getStream.locally = (
|
|
59
59
|
streamId: Amity.Stream['streamId'],
|
|
60
|
-
): Amity.Cached<Amity.
|
|
60
|
+
): Amity.Cached<Amity.Stream> | undefined => {
|
|
61
61
|
const client = getActiveClient();
|
|
62
62
|
client.log('stream/getStream', streamId);
|
|
63
63
|
|
|
64
64
|
if (!client.cache) return;
|
|
65
65
|
|
|
66
|
-
const cached = pullFromCache<Amity.
|
|
66
|
+
const cached = pullFromCache<Amity.Stream>(['stream', 'get', streamId]);
|
|
67
67
|
|
|
68
68
|
if (!cached) return;
|
|
69
69
|
|
|
@@ -102,7 +102,7 @@ export class GetStreamsLiveCollectionController extends LiveCollectionController
|
|
|
102
102
|
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
private applyFilter = (data: Amity.
|
|
105
|
+
private applyFilter = (data: Amity.InternalStream[]): Amity.InternalStream[] => {
|
|
106
106
|
let streams = filterByPropEquality(data, 'isDeleted', this.query.isDeleted);
|
|
107
107
|
|
|
108
108
|
streams = streams.sort(
|
|
@@ -2,23 +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 {
|
|
6
|
-
isAmityFilePost,
|
|
7
|
-
isAmityImagePost,
|
|
8
|
-
isAmityLivestreamPost,
|
|
9
|
-
isAmityPollPost,
|
|
10
|
-
isAmityVideoPost,
|
|
11
|
-
} from '../postTypePredicate';
|
|
12
|
-
import { streamLinkedObject } from './streamLinkedObject';
|
|
13
|
-
import { isNonNullable } from '..';
|
|
5
|
+
import { isAmityFilePost, isAmityImagePost, isAmityVideoPost } from '../postTypePredicate';
|
|
14
6
|
|
|
15
7
|
export const postLinkedObject = (post: Amity.InternalPost): Amity.Post => {
|
|
16
8
|
return {
|
|
17
9
|
...post,
|
|
18
|
-
|
|
19
|
-
.map(childPost => pullFromCache<Amity.InternalPost>(['post', 'get', childPost])?.data)
|
|
20
|
-
.filter(isNonNullable)
|
|
21
|
-
.map(postLinkedObject),
|
|
10
|
+
|
|
22
11
|
analytics: {
|
|
23
12
|
markAsViewed: () => {
|
|
24
13
|
const analyticsEngineInstance = AnalyticsEngine.getInstance();
|
|
@@ -75,24 +64,5 @@ export const postLinkedObject = (post: Amity.InternalPost): Amity.Post => {
|
|
|
75
64
|
? pullFromCache<Amity.File<'file'>>(['file', 'get', post?.data?.fileId])?.data
|
|
76
65
|
: undefined;
|
|
77
66
|
},
|
|
78
|
-
|
|
79
|
-
getLivestreamInfo(): Amity.Stream | undefined {
|
|
80
|
-
if (!isAmityLivestreamPost(post)) return;
|
|
81
|
-
const cache = pullFromCache<Amity.InternalStream>([
|
|
82
|
-
'stream',
|
|
83
|
-
'get',
|
|
84
|
-
post?.data?.streamId,
|
|
85
|
-
])?.data;
|
|
86
|
-
if (!cache) return;
|
|
87
|
-
|
|
88
|
-
return streamLinkedObject(cache);
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
getPollInfo(): Amity.Poll | undefined {
|
|
92
|
-
if (!isAmityPollPost(post)) return;
|
|
93
|
-
const cache = pullFromCache<Amity.Poll>(['poll', 'get', post?.data?.pollId])?.data;
|
|
94
|
-
if (!cache) return;
|
|
95
|
-
return cache;
|
|
96
|
-
},
|
|
97
67
|
};
|
|
98
68
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { pullFromCache } from '~/cache/api';
|
|
2
|
-
import { getLiveChat as _getLiveChat } from '~/streamRepository/internalApi/getLiveChat';
|
|
3
2
|
|
|
4
3
|
export const streamLinkedObject = (stream: Amity.InternalStream): Amity.Stream => {
|
|
5
4
|
return {
|
|
@@ -19,6 +18,5 @@ export const streamLinkedObject = (stream: Amity.InternalStream): Amity.Stream =
|
|
|
19
18
|
get user() {
|
|
20
19
|
return pullFromCache<Amity.User>(['user', 'get', stream.userId])?.data;
|
|
21
20
|
},
|
|
22
|
-
getLiveChat: () => _getLiveChat(stream),
|
|
23
21
|
};
|
|
24
22
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export function isAmityImagePost(post
|
|
1
|
+
export function isAmityImagePost(post: Amity.InternalPost): post is Amity.Post<'image'> {
|
|
2
2
|
return !!(
|
|
3
|
-
post &&
|
|
4
3
|
post.data &&
|
|
5
4
|
typeof post.data !== 'string' &&
|
|
6
5
|
'fileId' in post.data &&
|
|
@@ -8,9 +7,8 @@ export function isAmityImagePost(post?: Amity.InternalPost): post is Amity.Post<
|
|
|
8
7
|
);
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
export function isAmityFilePost(post
|
|
10
|
+
export function isAmityFilePost(post: Amity.InternalPost): post is Amity.Post<'file'> {
|
|
12
11
|
return !!(
|
|
13
|
-
post &&
|
|
14
12
|
post.data &&
|
|
15
13
|
typeof post.data !== 'string' &&
|
|
16
14
|
'fileId' in post.data &&
|
|
@@ -18,9 +16,8 @@ export function isAmityFilePost(post?: Amity.InternalPost): post is Amity.Post<'
|
|
|
18
16
|
);
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
export function isAmityVideoPost(post
|
|
19
|
+
export function isAmityVideoPost(post: Amity.InternalPost): post is Amity.Post<'video'> {
|
|
22
20
|
return !!(
|
|
23
|
-
post &&
|
|
24
21
|
post.data &&
|
|
25
22
|
typeof post.data !== 'string' &&
|
|
26
23
|
'videoFileId' in post.data &&
|
|
@@ -28,23 +25,3 @@ export function isAmityVideoPost(post?: Amity.InternalPost): post is Amity.Post<
|
|
|
28
25
|
post.dataType === 'video'
|
|
29
26
|
);
|
|
30
27
|
}
|
|
31
|
-
|
|
32
|
-
export function isAmityLivestreamPost(post?: Amity.InternalPost): post is Amity.Post<'liveStream'> {
|
|
33
|
-
return !!(
|
|
34
|
-
post &&
|
|
35
|
-
post.data &&
|
|
36
|
-
typeof post.data !== 'string' &&
|
|
37
|
-
'streamId' in post.data &&
|
|
38
|
-
post.dataType === 'liveStream'
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function isAmityPollPost(post?: Amity.InternalPost): post is Amity.Post<'poll'> {
|
|
43
|
-
return !!(
|
|
44
|
-
post &&
|
|
45
|
-
post.data &&
|
|
46
|
-
typeof post.data !== 'string' &&
|
|
47
|
-
'pollId' in post.data &&
|
|
48
|
-
post.dataType === 'poll'
|
|
49
|
-
);
|
|
50
|
-
}
|