@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.
Files changed (58) hide show
  1. package/dist/@types/domains/channel.d.ts +0 -2
  2. package/dist/@types/domains/channel.d.ts.map +1 -1
  3. package/dist/@types/domains/post.d.ts +0 -3
  4. package/dist/@types/domains/post.d.ts.map +1 -1
  5. package/dist/@types/domains/stream.d.ts +0 -4
  6. package/dist/@types/domains/stream.d.ts.map +1 -1
  7. package/dist/channelRepository/api/createChannel.d.ts +1 -3
  8. package/dist/channelRepository/api/createChannel.d.ts.map +1 -1
  9. package/dist/channelRepository/internalApi/getChannel.d.ts.map +1 -1
  10. package/dist/communityRepository/api/getCommunity.d.ts +1 -1
  11. package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
  12. package/dist/index.cjs.js +5335 -5499
  13. package/dist/index.esm.js +5603 -5767
  14. package/dist/index.umd.js +2 -2
  15. package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +0 -2
  16. package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts.map +1 -1
  17. package/dist/messageRepository/api/deleteMessage.d.ts.map +1 -1
  18. package/dist/messageRepository/observers/getMessages/MessageQueryStreamController.d.ts.map +1 -1
  19. package/dist/postRepository/api/createPost.d.ts.map +1 -1
  20. package/dist/postRepository/utils/payload.d.ts.map +1 -1
  21. package/dist/streamRepository/api/createStream.d.ts +1 -1
  22. package/dist/streamRepository/api/createStream.d.ts.map +1 -1
  23. package/dist/streamRepository/api/index.d.ts +0 -1
  24. package/dist/streamRepository/api/index.d.ts.map +1 -1
  25. package/dist/streamRepository/api/updateStream.d.ts +1 -4
  26. package/dist/streamRepository/api/updateStream.d.ts.map +1 -1
  27. package/dist/streamRepository/internalApi/getStream.d.ts +2 -2
  28. package/dist/streamRepository/internalApi/getStream.d.ts.map +1 -1
  29. package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
  30. package/dist/utils/linkedObject/streamLinkedObject.d.ts.map +1 -1
  31. package/dist/utils/postTypePredicate.d.ts +3 -5
  32. package/dist/utils/postTypePredicate.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/@types/domains/channel.ts +0 -3
  35. package/src/@types/domains/post.ts +0 -3
  36. package/src/@types/domains/stream.ts +0 -4
  37. package/src/channelRepository/api/createChannel.ts +9 -12
  38. package/src/channelRepository/internalApi/getChannel.ts +1 -0
  39. package/src/channelRepository/utils/constructChannelObject.ts +2 -2
  40. package/src/communityRepository/api/getCommunity.ts +0 -9
  41. package/src/messageRepository/api/deleteMessage.ts +0 -16
  42. package/src/messageRepository/observers/getMessages/MessageQueryStreamController.ts +0 -13
  43. package/src/postRepository/api/createPost.ts +2 -3
  44. package/src/postRepository/utils/payload.ts +1 -37
  45. package/src/streamRepository/api/createStream.ts +1 -4
  46. package/src/streamRepository/api/index.ts +0 -1
  47. package/src/streamRepository/api/updateStream.ts +1 -8
  48. package/src/streamRepository/internalApi/getStream.ts +3 -3
  49. package/src/streamRepository/observers/getStreams/GetStreamsLiveCollectionController.ts +1 -1
  50. package/src/utils/linkedObject/postLinkedObject.ts +2 -32
  51. package/src/utils/linkedObject/streamLinkedObject.ts +0 -2
  52. package/src/utils/postTypePredicate.ts +3 -26
  53. package/dist/streamRepository/api/editStream.d.ts +0 -18
  54. package/dist/streamRepository/api/editStream.d.ts.map +0 -1
  55. package/dist/streamRepository/internalApi/getLiveChat.d.ts +0 -16
  56. package/dist/streamRepository/internalApi/getLiveChat.d.ts.map +0 -1
  57. package/src/streamRepository/api/editStream.ts +0 -51
  58. package/src/streamRepository/internalApi/getLiveChat.ts +0 -59
@@ -1,18 +0,0 @@
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
@@ -1 +0,0 @@
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,16 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,51 +0,0 @@
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 */
@@ -1,59 +0,0 @@
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
- };