@amityco/ts-sdk 7.5.4-d9c7b36.0 → 7.5.4-db55aa2.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.
@@ -3,7 +3,7 @@ export declare const getSubChannelMessagePreviewWithUser: (subChannel: Amity.Sub
3
3
  user: Amity.InternalUser | undefined;
4
4
  messagePreviewId: string;
5
5
  subChannelName: string;
6
- data?: string | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataPoll | Record<string, unknown> | undefined;
6
+ data?: string | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataPoll | Amity.ContentDataStream | Record<string, unknown> | undefined;
7
7
  dataType?: any;
8
8
  channelId: string;
9
9
  subChannelId: string;
@@ -23,7 +23,7 @@ export declare const generateComment: (params?: Partial<Amity.InternalComment>)
23
23
  referenceType: Amity.CommentReferenceType;
24
24
  dataType?: any;
25
25
  dataTypes?: any[] | undefined;
26
- data?: string | Record<string, unknown> | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataPoll | undefined;
26
+ data?: string | Record<string, unknown> | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataPoll | Amity.ContentDataStream | undefined;
27
27
  metadata?: Record<string, any> | undefined;
28
28
  flagCount: number;
29
29
  hashFlag: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.5.4-d9c7b36.0",
3
+ "version": "7.5.4-db55aa2.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",
@@ -24,7 +24,15 @@ declare global {
24
24
  | Exclude<`${ContentFlagReasonEnum}`, `${ContentFlagReasonEnum.Others}`>
25
25
  | (string & {});
26
26
 
27
- type ContentType = 'text' | 'image' | 'file' | 'video' | 'poll' | 'json' | string;
27
+ type ContentType =
28
+ | 'text'
29
+ | 'image'
30
+ | 'file'
31
+ | 'video'
32
+ | 'poll'
33
+ | 'json'
34
+ | 'liveStream'
35
+ | string;
28
36
 
29
37
  type ContentFeedType = ValueOf<typeof ContentFeedType>;
30
38
 
@@ -58,6 +66,10 @@ declare global {
58
66
  pollId: Amity.Poll['pollId'];
59
67
  };
60
68
 
69
+ type ContentDataStream = {
70
+ streamId: Amity.Stream['streamId'];
71
+ };
72
+
61
73
  type ContentData<T extends ContentType> = T extends 'text'
62
74
  ? ContentDataText
63
75
  : T extends 'file'
@@ -68,6 +80,8 @@ declare global {
68
80
  ? ContentDataVideo
69
81
  : T extends 'poll'
70
82
  ? ContentDataPoll
83
+ : T extends 'liveStream'
84
+ ? ContentDataStream
71
85
  : T extends 'json'
72
86
  ? Record<string, unknown>
73
87
  : T extends string
@@ -32,6 +32,6 @@ declare global {
32
32
  pinnedAt: Date;
33
33
  };
34
34
 
35
- type GlobalPinnedPostLiveCollection = Amity.LiveCollectionParams<Record<string, never>>;
35
+ type GlobalPinnedPostLiveCollection = Amity.LiveCollectionParams<{}>;
36
36
  }
37
37
  }
@@ -41,3 +41,5 @@ export * from './domains/notification';
41
41
  export * from './domains/client';
42
42
  export * from './domains/invitation';
43
43
  export * from './domains/joinRequest';
44
+ export * from './domains/pin';
45
+ export * from './domains/pinnedPost';
@@ -2,6 +2,7 @@ import { getActiveClient } from '~/client/api';
2
2
 
3
3
  import { fireEvent } from '~/core/events';
4
4
  import { getCommunity } from './getCommunity';
5
+ import { LinkedObject } from '~/utils/linkedObject';
5
6
 
6
7
  /* begin_public_function
7
8
  id: community.delete
@@ -40,6 +41,6 @@ export const deleteCommunity = async (
40
41
  users: [],
41
42
  });
42
43
 
43
- return deleted.data;
44
+ return LinkedObject.community(deleted.data);
44
45
  };
45
46
  /* end_public_function */
@@ -25,7 +25,7 @@ export const getCommunity = async (
25
25
  communityId: Amity.Community['communityId'],
26
26
  type?: Amity.JoinRequestType,
27
27
  includeDiscoverablePrivateCommunity?: boolean,
28
- ): Promise<Amity.Cached<Amity.Community>> => {
28
+ ): Promise<Amity.Cached<Amity.InternalCommunity>> => {
29
29
  const client = getActiveClient();
30
30
  client.log('community/getCommunity', communityId);
31
31
 
@@ -51,9 +51,7 @@ export const getCommunity = async (
51
51
  const { communities } = data;
52
52
 
53
53
  return {
54
- data: LinkedObject.community(
55
- communities.find(community => community.communityId === communityId)!,
56
- ),
54
+ data: communities.find(community => community.communityId === communityId)!,
57
55
  cachedAt,
58
56
  };
59
57
  };
@@ -73,18 +71,18 @@ export const getCommunity = async (
73
71
  */
74
72
  getCommunity.locally = (
75
73
  communityId: Amity.Community['communityId'],
76
- ): Amity.Cached<Amity.Community> | undefined => {
74
+ ): Amity.Cached<Amity.InternalCommunity> | undefined => {
77
75
  const client = getActiveClient();
78
76
  client.log('community/getCommunity.locally', communityId);
79
77
 
80
78
  if (!client.cache) return;
81
79
 
82
- const cached = pullFromCache<Amity.Community>(['community', 'get', communityId]);
80
+ const cached = pullFromCache<Amity.InternalCommunity>(['community', 'get', communityId]);
83
81
 
84
82
  if (!cached) return;
85
83
 
86
84
  return {
87
- data: LinkedObject.community(cached.data),
85
+ data: cached.data,
88
86
  cachedAt: cached.cachedAt,
89
87
  };
90
88
  };
@@ -12,6 +12,7 @@ import {
12
12
  onLocalCommunityJoin,
13
13
  } from '../communityMembership/events';
14
14
  import { convertEventPayload } from '~/utils/event';
15
+ import { LinkedObject } from '~/utils/linkedObject';
15
16
 
16
17
  /* begin_public_function
17
18
  id: community.get
@@ -39,17 +40,28 @@ export const getCommunity = (
39
40
  communityId: Amity.Community['communityId'],
40
41
  callback: Amity.LiveObjectCallback<Amity.Community>,
41
42
  ): Amity.Unsubscriber => {
42
- return liveObject(communityId, callback, 'communityId', _getCommunity, [
43
- onCommunityUpdated,
44
- onCommunityDeleted,
45
- onCommunityJoined,
46
- onCommunityLeft,
47
- onLocalCommunityJoined,
48
- onLocalCommunityLeft,
49
- onCommunityUserBanned,
50
- onCommunityUserUnbanned,
51
- onCommunityUserChanged,
52
- convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
53
- ]);
43
+ return liveObject(
44
+ communityId,
45
+ callback,
46
+ 'communityId',
47
+ _getCommunity,
48
+ [
49
+ onCommunityUpdated,
50
+ onCommunityDeleted,
51
+ onCommunityJoined,
52
+ onCommunityLeft,
53
+ onLocalCommunityJoined,
54
+ onLocalCommunityLeft,
55
+ onCommunityUserBanned,
56
+ onCommunityUserUnbanned,
57
+ onCommunityUserChanged,
58
+ convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
59
+ ],
60
+ {
61
+ callbackDataSelector: (data: Amity.InternalCommunity) => {
62
+ return LinkedObject.community(data);
63
+ },
64
+ },
65
+ );
54
66
  };
55
67
  /* end_public_function */
@@ -1,5 +1,4 @@
1
1
  import { PaginationController } from '~/core/liveCollection/PaginationController';
2
- import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
3
2
 
4
3
  /**
5
4
  * TODO: handle cache receive cache option, and cache policy
@@ -10,7 +9,7 @@ export class JoinRequestsPaginationController extends PaginationController<
10
9
  Amity.JoinRequestLiveCollection
11
10
  > {
12
11
  async getRequest(queryParams: Amity.JoinRequestLiveCollection, token: string | undefined) {
13
- const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, communityId, ...params } = queryParams;
12
+ const { limit = 20, communityId, ...params } = queryParams;
14
13
  const options = token ? { token } : { limit };
15
14
 
16
15
  const { data: queryResponse } = await this.http.get<