@amityco/ts-sdk 7.6.1-b83cbdc.0 → 7.6.1-c97e594b.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 +2 -0
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +3 -0
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/@types/domains/stream.d.ts +4 -0
- package/dist/@types/domains/stream.d.ts.map +1 -1
- package/dist/channelRepository/api/createChannel.d.ts +3 -1
- 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 +5726 -5562
- package/dist/index.esm.js +5718 -5554
- package/dist/index.umd.js +2 -2
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +2 -0
- 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/editStream.d.ts +18 -0
- package/dist/streamRepository/api/editStream.d.ts.map +1 -0
- package/dist/streamRepository/api/index.d.ts +1 -0
- package/dist/streamRepository/api/index.d.ts.map +1 -1
- package/dist/streamRepository/api/updateStream.d.ts +4 -1
- package/dist/streamRepository/api/updateStream.d.ts.map +1 -1
- package/dist/streamRepository/internalApi/getLiveChat.d.ts +16 -0
- package/dist/streamRepository/internalApi/getLiveChat.d.ts.map +1 -0
- 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 +5 -3
- package/dist/utils/postTypePredicate.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/channel.ts +3 -0
- package/src/@types/domains/post.ts +4 -0
- package/src/@types/domains/stream.ts +4 -0
- package/src/channelRepository/api/createChannel.ts +12 -9
- package/src/channelRepository/internalApi/getChannel.ts +0 -1
- package/src/channelRepository/utils/constructChannelObject.ts +2 -2
- package/src/communityRepository/api/getCommunity.ts +9 -0
- package/src/messageRepository/api/deleteMessage.ts +16 -0
- package/src/messageRepository/observers/getMessages/MessageQueryStreamController.ts +13 -0
- package/src/postRepository/api/createPost.ts +3 -2
- package/src/postRepository/utils/payload.ts +37 -1
- package/src/streamRepository/api/createStream.ts +4 -1
- package/src/streamRepository/api/editStream.ts +51 -0
- package/src/streamRepository/api/index.ts +1 -0
- package/src/streamRepository/api/updateStream.ts +8 -1
- package/src/streamRepository/internalApi/getLiveChat.ts +59 -0
- package/src/streamRepository/internalApi/getStream.ts +3 -3
- package/src/streamRepository/observers/getStreams/GetStreamsLiveCollectionController.ts +1 -1
- package/src/utils/linkedObject/postLinkedObject.ts +32 -2
- package/src/utils/linkedObject/streamLinkedObject.ts +2 -0
- package/src/utils/postTypePredicate.ts +26 -3
|
@@ -21,6 +21,8 @@ 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;
|
|
24
26
|
} & Amity.Metadata & Amity.Taggable & Amity.CreatedAt & Amity.UpdatedAt & Amity.DeletedAt & {
|
|
25
27
|
isDeleted?: boolean | undefined;
|
|
26
28
|
} & 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;IAiCzB;;;;;;;;;;;;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;IAgExC,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,CAyBlC,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":"AAuBA,eAAO,MAAM,kBAAkB,YAAa,MAAM,WAAW,KAAG,MAAM,oBAuDrE,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' | 'channelEnabled'> & {
|
|
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,KACN,MAAM,cAAc,EACpB,OAAO,GAAG,iBAAiB,GAAG,aAAa,GAAG,gBAAgB,CAC/D,GAAG;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,KACA,QAAQ,MAAM,MAAM,CAAC,MAAM,MAAM,CAAC,CAepC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* ```js
|
|
4
|
+
* import { StreamRepository } from '@amityco/ts-sdk'
|
|
5
|
+
* const updated = await StreamRepository.editStream(streamId, { title: 'foobar' })
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Updates an {@link Amity.Stream}
|
|
9
|
+
*
|
|
10
|
+
* @param streamId The ID of the {@link Amity.Stream} to edit
|
|
11
|
+
* @param patch The patch data to apply
|
|
12
|
+
* @returns the updated {@link Amity.Stream} object
|
|
13
|
+
*
|
|
14
|
+
* @category Stream API
|
|
15
|
+
* @async
|
|
16
|
+
*/
|
|
17
|
+
export declare const editStream: (streamId: Amity.Stream['streamId'], patch: Patch<Amity.Stream, 'title' | 'thumbnailFileId' | 'description' | 'metadata' | 'channelEnabled'>) => Promise<Amity.Cached<Amity.Stream>>;
|
|
18
|
+
//# sourceMappingURL=editStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editStream.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/api/editStream.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,UAAU,aACX,MAAM,MAAM,CAAC,UAAU,CAAC,SAC3B,MACL,MAAM,MAAM,EACZ,OAAO,GAAG,iBAAiB,GAAG,aAAa,GAAG,UAAU,GAAG,gBAAgB,CAC5E,KACA,QAAQ,MAAM,MAAM,CAAC,MAAM,MAAM,CAAC,CAkBpC,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;AAChC,cAAc,cAAc,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @deprecated this function is deprecated,
|
|
3
|
+
* please use {@link Amity.StreamRepository.editStream} instead.
|
|
4
|
+
*
|
|
2
5
|
* ```js
|
|
3
6
|
* import { updateStream } from '@amityco/ts-sdk'
|
|
4
7
|
* const updated = await updateStream(streamId, { title: 'foobar' })
|
|
@@ -13,5 +16,5 @@
|
|
|
13
16
|
* @category Stream API
|
|
14
17
|
* @async
|
|
15
18
|
*/
|
|
16
|
-
export declare const updateStream: (streamId: Amity.Stream['streamId'], patch: Patch<Amity.Stream, 'title' | 'thumbnailFileId' | 'description' | 'metadata'>) => Promise<Amity.Cached<Amity.Stream>>;
|
|
19
|
+
export declare const updateStream: (streamId: Amity.Stream['streamId'], patch: Patch<Amity.Stream, 'title' | 'thumbnailFileId' | 'description' | 'metadata' | 'channelEnabled'>) => Promise<Amity.Cached<Amity.Stream>>;
|
|
17
20
|
//# 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;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,YAAY,aACb,MAAM,MAAM,CAAC,UAAU,CAAC,SAC3B,MACL,MAAM,MAAM,EACZ,OAAO,GAAG,iBAAiB,GAAG,aAAa,GAAG,UAAU,GAAG,gBAAgB,CAC5E,KACA,QAAQ,MAAM,MAAM,CAAC,MAAM,MAAM,CAAC,CAkBpC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { getStream } from '@amityco/ts-sdk'
|
|
4
|
+
* const stream = await getStream('foobar')
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* Fetches a {@link Amity.Channel} object linked with a current stream
|
|
8
|
+
*
|
|
9
|
+
* @param stream {@link Amity.Stream} that has linked live channel
|
|
10
|
+
* @returns the associated {@link Amity.Channel<'live'>} object
|
|
11
|
+
*
|
|
12
|
+
* @category Stream API
|
|
13
|
+
* @async
|
|
14
|
+
*/
|
|
15
|
+
export declare const getLiveChat: (stream: Amity.InternalStream) => Promise<Amity.Channel<'live'> | undefined>;
|
|
16
|
+
//# sourceMappingURL=getLiveChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLiveChat.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/internalApi/getLiveChat.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,WAAW,WACd,MAAM,cAAc,KAC3B,QAAQ,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,CAkC3C,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.InternalStream>>;
|
|
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.InternalStream> | 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,cAAc,CAAC,CAAC;IAoB9C;;;;;;;;;;;;OAYG;sBAES,MAAM,MAAM,CAAC,UAAU,CAAC,GACjC,MAAM,MAAM,CAAC,MAAM,cAAc,CAAC,GAAG,SAAS;CAlBhD,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":"AAcA,eAAO,MAAM,gBAAgB,SAAU,MAAM,YAAY,KAAG,MAAM,IAmFjE,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":"AAGA,eAAO,MAAM,kBAAkB,WAAY,MAAM,cAAc,KAAG,MAAM,MAoBvE,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export declare function isAmityImagePost(post
|
|
2
|
-
export declare function isAmityFilePost(post
|
|
3
|
-
export declare function isAmityVideoPost(post
|
|
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'>;
|
|
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'>;
|
|
4
6
|
//# 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,
|
|
1
|
+
{"version":3,"file":"postTypePredicate.d.ts","sourceRoot":"","sources":["../../src/utils/postTypePredicate.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAQvF;AAED,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAQrF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CASvF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAQjG;AAED,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAQrF"}
|
package/package.json
CHANGED
|
@@ -70,9 +70,11 @@ declare global {
|
|
|
70
70
|
|
|
71
71
|
type InternalPost<T extends PostContentType = any> = RawPost<T> & {
|
|
72
72
|
feedType?: 'reviewing' | 'published';
|
|
73
|
+
// childPosts?: Amity.RawPost[];
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
type PostLinkObject = {
|
|
77
|
+
childrenPosts: Amity.Post[];
|
|
76
78
|
latestComments: (Amity.Comment | null)[];
|
|
77
79
|
creator: Amity.User | undefined;
|
|
78
80
|
analytics: {
|
|
@@ -82,6 +84,8 @@ declare global {
|
|
|
82
84
|
getVideoInfo: () => Amity.File<'video'> | undefined;
|
|
83
85
|
getVideoThumbnailInfo: () => Amity.File<'image'> | undefined;
|
|
84
86
|
getFileInfo: () => Amity.File<'file'> | undefined;
|
|
87
|
+
getPollInfo: () => Amity.Poll | undefined;
|
|
88
|
+
getLivestreamInfo: () => Amity.Stream | undefined;
|
|
85
89
|
};
|
|
86
90
|
|
|
87
91
|
type Post<T extends PostContentType = any> = Amity.InternalPost<T> & Amity.PostLinkObject;
|
|
@@ -73,6 +73,9 @@ 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;
|
|
76
79
|
} & Amity.Metadata &
|
|
77
80
|
Amity.Timestamps &
|
|
78
81
|
Amity.SoftDelete;
|
|
@@ -81,6 +84,7 @@ declare global {
|
|
|
81
84
|
|
|
82
85
|
type StreamLinkedObject = {
|
|
83
86
|
moderation?: Amity.StreamModeration;
|
|
87
|
+
getLiveChat: () => Promise<Amity.Channel<'live'> | undefined>;
|
|
84
88
|
};
|
|
85
89
|
|
|
86
90
|
type Stream = Amity.InternalStream & Amity.StreamLinkedObject;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getActiveClient } from '~/client/api';
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
|
|
5
|
-
import { prepareChannelPayload } from '../utils';
|
|
6
|
-
import {
|
|
5
|
+
import { prepareChannelPayload } from '../utils/prepareChannelPayload';
|
|
6
|
+
import { constructChannelObject } from '../utils/constructChannelObject';
|
|
7
7
|
|
|
8
8
|
/* begin_public_function
|
|
9
9
|
id: channel.create
|
|
@@ -23,11 +23,14 @@ import { constructChannelDynamicValue } from '../utils/constructChannelDynamicVa
|
|
|
23
23
|
* @async
|
|
24
24
|
*/
|
|
25
25
|
export const createChannel = async <T extends Amity.ChannelType>(
|
|
26
|
-
bundle: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
bundle: {
|
|
27
|
+
type: T;
|
|
28
|
+
userIds?: Amity.InternalUser['userId'][];
|
|
29
|
+
// For live channel linked with a livestream post
|
|
30
|
+
videoStreamId?: string;
|
|
31
|
+
postId?: string;
|
|
32
|
+
} & Pick<Amity.Channel<T>, 'displayName' | 'avatarFileId' | 'tags' | 'metadata' | 'isPublic'>,
|
|
33
|
+
): Promise<Amity.Cached<Amity.Channel<T>>> => {
|
|
31
34
|
const client = getActiveClient();
|
|
32
35
|
client.log('user/createChannel', bundle);
|
|
33
36
|
|
|
@@ -53,7 +56,7 @@ export const createChannel = async <T extends Amity.ChannelType>(
|
|
|
53
56
|
|
|
54
57
|
const { channels } = data;
|
|
55
58
|
return {
|
|
56
|
-
data:
|
|
59
|
+
data: constructChannelObject(channels[0]),
|
|
57
60
|
cachedAt,
|
|
58
61
|
};
|
|
59
62
|
};
|
|
@@ -9,7 +9,6 @@ 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';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* ```js
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getChannelMessagePreviewWithUser } from '~/messagePreview/utils';
|
|
2
2
|
import { constructChannelDynamicValue } from './constructChannelDynamicValue';
|
|
3
|
-
import {
|
|
3
|
+
import { channelLinkedObject } from '~/utils/linkedObject/channelLinkedObject';
|
|
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 channelLinkedObject(
|
|
14
14
|
constructChannelDynamicValue(getChannelMessagePreviewWithUser(channel)),
|
|
15
15
|
);
|
|
16
16
|
};
|
|
@@ -5,6 +5,7 @@ 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';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* ```js
|
|
@@ -22,6 +23,8 @@ import { prepareCommunityPayload } from '../utils';
|
|
|
22
23
|
*/
|
|
23
24
|
export const getCommunity = async (
|
|
24
25
|
communityId: Amity.Community['communityId'],
|
|
26
|
+
type?: Amity.JoinRequestType,
|
|
27
|
+
includeDiscoverablePrivateCommunity?: boolean,
|
|
25
28
|
): Promise<Amity.Cached<Amity.InternalCommunity>> => {
|
|
26
29
|
const client = getActiveClient();
|
|
27
30
|
client.log('community/getCommunity', communityId);
|
|
@@ -29,6 +32,12 @@ export const getCommunity = async (
|
|
|
29
32
|
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
30
33
|
const { data: payload } = await client.http.get<Amity.CommunityPayload>(
|
|
31
34
|
`/api/v3/communities/${communityId}`,
|
|
35
|
+
{
|
|
36
|
+
params: {
|
|
37
|
+
type: 'communityJoinRequest',
|
|
38
|
+
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
32
41
|
);
|
|
33
42
|
|
|
34
43
|
const data = prepareCommunityPayload(payload);
|
|
@@ -23,6 +23,22 @@ 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
|
+
|
|
26
42
|
// API-FIX: This endpoint has not been implemented yet.
|
|
27
43
|
const { data: deleted } = await client.http.delete<Amity.MessagePayload>(
|
|
28
44
|
`/api/v5/messages/${encodeURIComponent(messageId)}`,
|
|
@@ -116,6 +116,19 @@ 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
|
+
|
|
119
132
|
this.notifyChange({ origin: Amity.LiveDataOrigin.EVENT, loading: false });
|
|
120
133
|
};
|
|
121
134
|
}
|
|
@@ -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';
|
|
6
5
|
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,7 +46,8 @@ export const createPost = async <T extends Amity.PostContentType | string>(
|
|
|
46
46
|
|
|
47
47
|
fireEvent('post.created', payload);
|
|
48
48
|
|
|
49
|
-
const data =
|
|
49
|
+
const data = preparePostPayload(payload);
|
|
50
|
+
|
|
50
51
|
const cachedAt = client.cache && Date.now();
|
|
51
52
|
|
|
52
53
|
if (client.cache) ingestInCache(data, { cachedAt });
|
|
@@ -1,8 +1,28 @@
|
|
|
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
|
+
};
|
|
3
23
|
|
|
4
24
|
export const preparePostPayload = (payload: Amity.PostPayload): Amity.ProcessedPostPayload => {
|
|
5
|
-
const { posts: postsData, ...postPayload } = payload;
|
|
25
|
+
const { posts: postsData, postChildren, videoStreamings, ...postPayload } = payload;
|
|
6
26
|
|
|
7
27
|
// Unpack community payload by mapping payload field to postSetting value.
|
|
8
28
|
const communitiesWithPostSetting = addPostSetting({ communities: postPayload.communities });
|
|
@@ -24,18 +44,34 @@ export const preparePostPayload = (payload: Amity.PostPayload): Amity.ProcessedP
|
|
|
24
44
|
mappedCommunityUsers,
|
|
25
45
|
);
|
|
26
46
|
|
|
47
|
+
let mappedNewStream: Amity.RawStream[] = [];
|
|
48
|
+
|
|
27
49
|
// feed type
|
|
28
50
|
const posts = postsData.map(post => {
|
|
29
51
|
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
|
+
}
|
|
30
63
|
|
|
31
64
|
return {
|
|
32
65
|
...post,
|
|
66
|
+
childPosts,
|
|
33
67
|
feedType,
|
|
34
68
|
};
|
|
35
69
|
});
|
|
36
70
|
|
|
37
71
|
return {
|
|
38
72
|
...postPayload,
|
|
73
|
+
postChildren,
|
|
74
|
+
videoStreamings: mappedNewStream,
|
|
39
75
|
posts,
|
|
40
76
|
communities: communityWithMembershipStatus,
|
|
41
77
|
communityUsers: mappedCommunityUsers,
|
|
@@ -21,7 +21,10 @@ import { LinkedObject } from '~/utils/linkedObject';
|
|
|
21
21
|
* @async
|
|
22
22
|
*/
|
|
23
23
|
export const createStream = async (
|
|
24
|
-
bundle: Pick<
|
|
24
|
+
bundle: Pick<
|
|
25
|
+
Amity.InternalStream,
|
|
26
|
+
'title' | 'thumbnailFileId' | 'description' | 'channelEnabled'
|
|
27
|
+
> & {
|
|
25
28
|
isSecure?: boolean;
|
|
26
29
|
},
|
|
27
30
|
): Promise<Amity.Cached<Amity.Stream>> => {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api';
|
|
2
|
+
|
|
3
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
5
|
+
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: stream.update
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* ```js
|
|
12
|
+
* import { StreamRepository } from '@amityco/ts-sdk'
|
|
13
|
+
* const updated = await StreamRepository.editStream(streamId, { title: 'foobar' })
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Updates an {@link Amity.Stream}
|
|
17
|
+
*
|
|
18
|
+
* @param streamId The ID of the {@link Amity.Stream} to edit
|
|
19
|
+
* @param patch The patch data to apply
|
|
20
|
+
* @returns the updated {@link Amity.Stream} object
|
|
21
|
+
*
|
|
22
|
+
* @category Stream API
|
|
23
|
+
* @async
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export const editStream = async (
|
|
27
|
+
streamId: Amity.Stream['streamId'],
|
|
28
|
+
patch: Patch<
|
|
29
|
+
Amity.Stream,
|
|
30
|
+
'title' | 'thumbnailFileId' | 'description' | 'metadata' | 'channelEnabled'
|
|
31
|
+
>,
|
|
32
|
+
): Promise<Amity.Cached<Amity.Stream>> => {
|
|
33
|
+
const client = getActiveClient();
|
|
34
|
+
client.log('stream/updateStream', streamId, patch);
|
|
35
|
+
|
|
36
|
+
const { data } = await client.http.put<Amity.StreamPayload>(
|
|
37
|
+
`/api/v3/video-streaming/${streamId}`,
|
|
38
|
+
patch,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const cachedAt = client.cache && Date.now();
|
|
42
|
+
if (client.cache) ingestInCache(data, { cachedAt });
|
|
43
|
+
|
|
44
|
+
const { videoStreamings } = data;
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
data: LinkedObject.stream(videoStreamings.find(stream => stream.streamId === streamId)!),
|
|
48
|
+
cachedAt,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/* end_public_function */
|
|
@@ -7,6 +7,9 @@ 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
|
+
*
|
|
10
13
|
* ```js
|
|
11
14
|
* import { updateStream } from '@amityco/ts-sdk'
|
|
12
15
|
* const updated = await updateStream(streamId, { title: 'foobar' })
|
|
@@ -21,9 +24,13 @@ import { LinkedObject } from '~/utils/linkedObject';
|
|
|
21
24
|
* @category Stream API
|
|
22
25
|
* @async
|
|
23
26
|
*/
|
|
27
|
+
|
|
24
28
|
export const updateStream = async (
|
|
25
29
|
streamId: Amity.Stream['streamId'],
|
|
26
|
-
patch: Patch<
|
|
30
|
+
patch: Patch<
|
|
31
|
+
Amity.Stream,
|
|
32
|
+
'title' | 'thumbnailFileId' | 'description' | 'metadata' | 'channelEnabled'
|
|
33
|
+
>,
|
|
27
34
|
): Promise<Amity.Cached<Amity.Stream>> => {
|
|
28
35
|
const client = getActiveClient();
|
|
29
36
|
client.log('stream/updateStream', streamId, patch);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { mergeInCache, pullFromCache } from '~/cache/api';
|
|
3
|
+
import { createChannel } from '~/channelRepository/api/createChannel';
|
|
4
|
+
import { channelLinkedObject } from '~/utils/linkedObject/channelLinkedObject';
|
|
5
|
+
import { getChannel } from '~/channelRepository/internalApi/getChannel';
|
|
6
|
+
import { constructChannelObject } from '~/channelRepository/utils/constructChannelObject';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ```js
|
|
10
|
+
* import { getStream } from '@amityco/ts-sdk'
|
|
11
|
+
* const stream = await getStream('foobar')
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Fetches a {@link Amity.Channel} object linked with a current stream
|
|
15
|
+
*
|
|
16
|
+
* @param stream {@link Amity.Stream} that has linked live channel
|
|
17
|
+
* @returns the associated {@link Amity.Channel<'live'>} object
|
|
18
|
+
*
|
|
19
|
+
* @category Stream API
|
|
20
|
+
* @async
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export const getLiveChat = async (
|
|
24
|
+
stream: Amity.InternalStream,
|
|
25
|
+
): Promise<Amity.Channel<'live'> | undefined> => {
|
|
26
|
+
const client = getActiveClient();
|
|
27
|
+
client.log('stream/getLiveChat', stream.streamId);
|
|
28
|
+
|
|
29
|
+
if (stream.channelId) {
|
|
30
|
+
const channel = pullFromCache<Amity.StaticInternalChannel>([
|
|
31
|
+
'channel',
|
|
32
|
+
'get',
|
|
33
|
+
stream.channelId,
|
|
34
|
+
])?.data;
|
|
35
|
+
|
|
36
|
+
if (channel) return channelLinkedObject(constructChannelObject(channel));
|
|
37
|
+
|
|
38
|
+
const { data } = await getChannel(stream.channelId);
|
|
39
|
+
return channelLinkedObject(constructChannelObject(data));
|
|
40
|
+
}
|
|
41
|
+
// No Channel ID
|
|
42
|
+
// streamer: create a new live channel
|
|
43
|
+
if (stream.userId === client.userId) {
|
|
44
|
+
const { data: channel } = await createChannel({
|
|
45
|
+
type: 'live',
|
|
46
|
+
postId: stream.postId,
|
|
47
|
+
videoStreamId: stream.streamId,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Update channelId to stream object in cache
|
|
51
|
+
mergeInCache(['stream', 'get', stream.streamId], {
|
|
52
|
+
channelId: channel.channelId,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return channel;
|
|
56
|
+
}
|
|
57
|
+
// watcher: return undefined
|
|
58
|
+
return undefined;
|
|
59
|
+
};
|