@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.
- package/dist/@types/domains/content.d.ts +5 -2
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/@types/domains/pinnedPost.d.ts +1 -1
- package/dist/@types/domains/pinnedPost.d.ts.map +1 -1
- package/dist/@types/index.d.ts +2 -0
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/communityRepository/api/deleteCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts +2 -2
- package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts.map +1 -1
- package/dist/index.cjs.js +9 -5
- package/dist/index.esm.js +9 -5
- package/dist/index.umd.js +1 -1
- package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
- package/dist/utils/tests/dummy/comment.d.ts +1 -1
- package/package.json +1 -1
- package/src/@types/domains/content.ts +15 -1
- package/src/@types/domains/pinnedPost.ts +1 -1
- package/src/@types/index.ts +2 -0
- package/src/communityRepository/api/deleteCommunity.ts +2 -1
- package/src/communityRepository/api/getCommunity.ts +5 -7
- package/src/communityRepository/observers/getCommunity.ts +24 -12
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts +1 -2
|
@@ -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
|
@@ -24,7 +24,15 @@ declare global {
|
|
|
24
24
|
| Exclude<`${ContentFlagReasonEnum}`, `${ContentFlagReasonEnum.Others}`>
|
|
25
25
|
| (string & {});
|
|
26
26
|
|
|
27
|
-
type ContentType =
|
|
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
|
package/src/@types/index.ts
CHANGED
|
@@ -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.
|
|
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:
|
|
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.
|
|
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.
|
|
80
|
+
const cached = pullFromCache<Amity.InternalCommunity>(['community', 'get', communityId]);
|
|
83
81
|
|
|
84
82
|
if (!cached) return;
|
|
85
83
|
|
|
86
84
|
return {
|
|
87
|
-
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(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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 */
|
package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts
CHANGED
|
@@ -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 =
|
|
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<
|