@amityco/ts-sdk 7.5.4-91188fd.0 → 7.5.4-d9c7b36.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 +2 -5
- 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 +0 -2
- 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/index.cjs.js +4 -8
- package/dist/index.esm.js +4 -8
- package/dist/index.umd.js +1 -1
- package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
- package/dist/utils/tests/dummy/comment.d.ts +2 -2
- package/package.json +1 -1
- package/src/@types/domains/content.ts +1 -15
- package/src/@types/domains/pinnedPost.ts +1 -1
- package/src/@types/index.ts +0 -2
- package/src/communityRepository/api/deleteCommunity.ts +1 -2
- package/src/communityRepository/api/getCommunity.ts +7 -5
- package/src/communityRepository/observers/getCommunity.ts +12 -24
|
@@ -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 |
|
|
6
|
+
data?: string | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataPoll | Record<string, unknown> | undefined;
|
|
7
7
|
dataType?: any;
|
|
8
8
|
channelId: string;
|
|
9
9
|
subChannelId: string;
|
|
@@ -18,12 +18,12 @@ export declare const generateComment: (params?: Partial<Amity.InternalComment>)
|
|
|
18
18
|
editedAt: string;
|
|
19
19
|
attachments?: Amity.Attachment[] | undefined;
|
|
20
20
|
targetId: string;
|
|
21
|
-
targetType: "
|
|
21
|
+
targetType: "community" | "user" | "content";
|
|
22
22
|
referenceId: string;
|
|
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 |
|
|
26
|
+
data?: string | Record<string, unknown> | Amity.ContentDataText | Amity.ContentDataFile | Amity.ContentDataImage | Amity.ContentDataVideo | Amity.ContentDataPoll | undefined;
|
|
27
27
|
metadata?: Record<string, any> | undefined;
|
|
28
28
|
flagCount: number;
|
|
29
29
|
hashFlag: {
|
package/package.json
CHANGED
|
@@ -24,15 +24,7 @@ declare global {
|
|
|
24
24
|
| Exclude<`${ContentFlagReasonEnum}`, `${ContentFlagReasonEnum.Others}`>
|
|
25
25
|
| (string & {});
|
|
26
26
|
|
|
27
|
-
type ContentType =
|
|
28
|
-
| 'text'
|
|
29
|
-
| 'image'
|
|
30
|
-
| 'file'
|
|
31
|
-
| 'video'
|
|
32
|
-
| 'poll'
|
|
33
|
-
| 'json'
|
|
34
|
-
| 'liveStream'
|
|
35
|
-
| string;
|
|
27
|
+
type ContentType = 'text' | 'image' | 'file' | 'video' | 'poll' | 'json' | string;
|
|
36
28
|
|
|
37
29
|
type ContentFeedType = ValueOf<typeof ContentFeedType>;
|
|
38
30
|
|
|
@@ -66,10 +58,6 @@ declare global {
|
|
|
66
58
|
pollId: Amity.Poll['pollId'];
|
|
67
59
|
};
|
|
68
60
|
|
|
69
|
-
type ContentDataStream = {
|
|
70
|
-
streamId: Amity.Stream['streamId'];
|
|
71
|
-
};
|
|
72
|
-
|
|
73
61
|
type ContentData<T extends ContentType> = T extends 'text'
|
|
74
62
|
? ContentDataText
|
|
75
63
|
: T extends 'file'
|
|
@@ -80,8 +68,6 @@ declare global {
|
|
|
80
68
|
? ContentDataVideo
|
|
81
69
|
: T extends 'poll'
|
|
82
70
|
? ContentDataPoll
|
|
83
|
-
: T extends 'liveStream'
|
|
84
|
-
? ContentDataStream
|
|
85
71
|
: T extends 'json'
|
|
86
72
|
? Record<string, unknown>
|
|
87
73
|
: T extends string
|
package/src/@types/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ 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';
|
|
6
5
|
|
|
7
6
|
/* begin_public_function
|
|
8
7
|
id: community.delete
|
|
@@ -41,6 +40,6 @@ export const deleteCommunity = async (
|
|
|
41
40
|
users: [],
|
|
42
41
|
});
|
|
43
42
|
|
|
44
|
-
return
|
|
43
|
+
return deleted.data;
|
|
45
44
|
};
|
|
46
45
|
/* 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.Community>> => {
|
|
29
29
|
const client = getActiveClient();
|
|
30
30
|
client.log('community/getCommunity', communityId);
|
|
31
31
|
|
|
@@ -51,7 +51,9 @@ export const getCommunity = async (
|
|
|
51
51
|
const { communities } = data;
|
|
52
52
|
|
|
53
53
|
return {
|
|
54
|
-
data:
|
|
54
|
+
data: LinkedObject.community(
|
|
55
|
+
communities.find(community => community.communityId === communityId)!,
|
|
56
|
+
),
|
|
55
57
|
cachedAt,
|
|
56
58
|
};
|
|
57
59
|
};
|
|
@@ -71,18 +73,18 @@ export const getCommunity = async (
|
|
|
71
73
|
*/
|
|
72
74
|
getCommunity.locally = (
|
|
73
75
|
communityId: Amity.Community['communityId'],
|
|
74
|
-
): Amity.Cached<Amity.
|
|
76
|
+
): Amity.Cached<Amity.Community> | undefined => {
|
|
75
77
|
const client = getActiveClient();
|
|
76
78
|
client.log('community/getCommunity.locally', communityId);
|
|
77
79
|
|
|
78
80
|
if (!client.cache) return;
|
|
79
81
|
|
|
80
|
-
const cached = pullFromCache<Amity.
|
|
82
|
+
const cached = pullFromCache<Amity.Community>(['community', 'get', communityId]);
|
|
81
83
|
|
|
82
84
|
if (!cached) return;
|
|
83
85
|
|
|
84
86
|
return {
|
|
85
|
-
data: cached.data,
|
|
87
|
+
data: LinkedObject.community(cached.data),
|
|
86
88
|
cachedAt: cached.cachedAt,
|
|
87
89
|
};
|
|
88
90
|
};
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
onLocalCommunityJoin,
|
|
13
13
|
} from '../communityMembership/events';
|
|
14
14
|
import { convertEventPayload } from '~/utils/event';
|
|
15
|
-
import { LinkedObject } from '~/utils/linkedObject';
|
|
16
15
|
|
|
17
16
|
/* begin_public_function
|
|
18
17
|
id: community.get
|
|
@@ -40,28 +39,17 @@ export const getCommunity = (
|
|
|
40
39
|
communityId: Amity.Community['communityId'],
|
|
41
40
|
callback: Amity.LiveObjectCallback<Amity.Community>,
|
|
42
41
|
): Amity.Unsubscriber => {
|
|
43
|
-
return liveObject(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
);
|
|
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
|
+
]);
|
|
66
54
|
};
|
|
67
55
|
/* end_public_function */
|