@amityco/ts-sdk 7.3.1-b3a17de.0 → 7.3.1-be858577.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/.eslintrc.json +2 -1
- package/dist/@types/domains/content.d.ts +12 -0
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/commentRepository/api/flagComment.d.ts +3 -2
- package/dist/commentRepository/api/flagComment.d.ts.map +1 -1
- package/dist/index.cjs.js +31 -7
- package/dist/index.esm.js +32 -8
- package/dist/index.umd.js +4 -4
- package/dist/messageRepository/api/flagMessage.d.ts.map +1 -1
- package/dist/postRepository/api/flagPost.d.ts +3 -2
- package/dist/postRepository/api/flagPost.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/content.ts +16 -0
- package/src/commentRepository/api/flagComment.ts +18 -3
- package/src/messageRepository/api/flagMessage.ts +2 -4
- package/src/postRepository/api/flagPost.ts +17 -3
package/.eslintrc.json
CHANGED
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"import/no-unresolved": "off",
|
|
30
30
|
"no-shadow": "off",
|
|
31
31
|
"no-unused-vars": "off",
|
|
32
|
-
"no-console": ["warn", { "allow": ["warn", "error"] }]
|
|
32
|
+
"no-console": ["warn", { "allow": ["warn", "error"] }],
|
|
33
|
+
"@typescript-eslint/ban-types": "off"
|
|
33
34
|
},
|
|
34
35
|
"settings": {
|
|
35
36
|
"import/resolver": {
|
|
@@ -5,8 +5,20 @@ export declare const ContentFeedType: Readonly<{
|
|
|
5
5
|
POST: "post";
|
|
6
6
|
MESSAGE: "message";
|
|
7
7
|
}>;
|
|
8
|
+
export declare enum ContentFlagReasonEnum {
|
|
9
|
+
CommunityGuidelines = "Against community guidelines",
|
|
10
|
+
HarassmentOrBullying = "Harassment or bullying",
|
|
11
|
+
SelfHarmOrSuicide = "Self-harm or suicide",
|
|
12
|
+
ViolenceOrThreateningContent = "Violence or threatening content",
|
|
13
|
+
SellingRestrictedItems = "Selling and promoting restricted items",
|
|
14
|
+
SexualContentOrNudity = "Sexual message or nudity",
|
|
15
|
+
SpamOrScams = "Spam or scams",
|
|
16
|
+
FalseInformation = "False information or misinformation",
|
|
17
|
+
Others = "Others"
|
|
18
|
+
}
|
|
8
19
|
declare global {
|
|
9
20
|
namespace Amity {
|
|
21
|
+
type ContentFlagReason = Exclude<`${ContentFlagReasonEnum}`, `${ContentFlagReasonEnum.Others}`> | (string & {});
|
|
10
22
|
type ContentType = 'text' | 'image' | 'file' | 'video' | 'poll' | 'json' | string;
|
|
11
23
|
type ContentFeedType = ValueOf<typeof ContentFeedType>;
|
|
12
24
|
type ContentDataText = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/content.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;EAM1B,CAAC;AAEH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;QAElF,KAAK,eAAe,GAAG,OAAO,CAAC,OAAO,eAAe,CAAC,CAAC;QAEvD,KAAK,eAAe,GAAG;YACrB,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;QAEF,KAAK,eAAe,GAAG;YACrB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;SACtC,CAAC;QAEF,KAAK,gBAAgB,GAAG;YACtB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;YACtC,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC;QAEF,KAAK,UAAU,GAAG;YAChB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;YACvB,GAAG,CAAC,EAAE,MAAM,CAAC;YACb,MAAM,CAAC,EA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AC,CAAC,CAAC;SACvB,CAAC;QAEF,KAAK,kBAAkB,GAAG;YACxB,WAAW,EAAE,MAAM,CAAC;YACpB,OAAO,EAAE,OAAO,CAAC;SAClB,CAAC;QAEF,KAAK,mBAAmB,GAAG;YACzB,WAAW,EAAE,OAAO,CAAC;YACrB,OAAO,EAAE,OAAO,CAAC;YACjB,kBAAkB,EAAE,MAAM,CAAC;YAC3B,eAAe,EAAE;gBACf,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;gBACrC,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC;aACtC,CAAC;SACH,CAAC;QAEF,KAAK,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,MAAM,GAAG,OAAO,IAAI,CAAC,SAAS,MAAM,GAC5E,kBAAkB,GAClB,CAAC,SAAS,OAAO,GACjB,mBAAmB,GACnB,KAAK,CAAC;KACX;CACF"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ```js
|
|
3
3
|
* import { CommentRepository } from '@amityco/ts-sdk'
|
|
4
|
-
* const flagged = await CommentRepository.flagComment(
|
|
4
|
+
* const flagged = await CommentRepository.flagComment(commentId, reason)
|
|
5
5
|
* ```
|
|
6
6
|
*
|
|
7
7
|
* @param commentId The ID of the comment to flag
|
|
8
|
+
* @param reason the reason to flag the comment
|
|
8
9
|
* @returns the created report result
|
|
9
10
|
*
|
|
10
11
|
* @category Comment API
|
|
11
12
|
* @async
|
|
12
13
|
* */
|
|
13
|
-
export declare const flagComment: (commentId: Amity.Comment['commentId']) => Promise<boolean>;
|
|
14
|
+
export declare const flagComment: (commentId: Amity.Comment['commentId'], reason: Amity.ContentFlagReason) => Promise<boolean>;
|
|
14
15
|
//# sourceMappingURL=flagComment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flagComment.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/api/flagComment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flagComment.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/api/flagComment.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;KAYK;AACL,eAAO,MAAM,WAAW,cACX,aAAa,CAAC,WAAW,CAAC,UAC7B,MAAM,iBAAiB,KAC9B,QAAQ,OAAO,CAyBjB,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -80,7 +80,19 @@ const ContentFeedType = Object.freeze({
|
|
|
80
80
|
CHAT: 'chat',
|
|
81
81
|
POST: 'post',
|
|
82
82
|
MESSAGE: 'message',
|
|
83
|
-
});
|
|
83
|
+
});
|
|
84
|
+
exports.ContentFlagReasonEnum = void 0;
|
|
85
|
+
(function (ContentFlagReasonEnum) {
|
|
86
|
+
ContentFlagReasonEnum["CommunityGuidelines"] = "Against community guidelines";
|
|
87
|
+
ContentFlagReasonEnum["HarassmentOrBullying"] = "Harassment or bullying";
|
|
88
|
+
ContentFlagReasonEnum["SelfHarmOrSuicide"] = "Self-harm or suicide";
|
|
89
|
+
ContentFlagReasonEnum["ViolenceOrThreateningContent"] = "Violence or threatening content";
|
|
90
|
+
ContentFlagReasonEnum["SellingRestrictedItems"] = "Selling and promoting restricted items";
|
|
91
|
+
ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual message or nudity";
|
|
92
|
+
ContentFlagReasonEnum["SpamOrScams"] = "Spam or scams";
|
|
93
|
+
ContentFlagReasonEnum["FalseInformation"] = "False information or misinformation";
|
|
94
|
+
ContentFlagReasonEnum["Others"] = "Others";
|
|
95
|
+
})(exports.ContentFlagReasonEnum || (exports.ContentFlagReasonEnum = {}));
|
|
84
96
|
|
|
85
97
|
const MessageContentType = Object.freeze({
|
|
86
98
|
TEXT: 'text',
|
|
@@ -21654,19 +21666,25 @@ const declinePost = async (postId) => {
|
|
|
21654
21666
|
/**
|
|
21655
21667
|
* ```js
|
|
21656
21668
|
* import { PostRepository } from '@amityco/ts-sdk'
|
|
21657
|
-
* const flagged = await PostRepository.flagPost(postId)
|
|
21669
|
+
* const flagged = await PostRepository.flagPost(postId, reason)
|
|
21658
21670
|
* ```
|
|
21659
21671
|
*
|
|
21660
21672
|
* @param postId of the post to flag
|
|
21673
|
+
* @param reason the reason to flag the post
|
|
21661
21674
|
* @returns a boolean
|
|
21662
21675
|
*
|
|
21663
21676
|
* @category Post API
|
|
21664
21677
|
* @async
|
|
21665
21678
|
* */
|
|
21666
|
-
const flagPost = async (postId) => {
|
|
21679
|
+
const flagPost = async (postId, reason) => {
|
|
21667
21680
|
const client = getActiveClient();
|
|
21668
21681
|
client.log('post/flagPost', postId);
|
|
21669
|
-
const
|
|
21682
|
+
const isPredefinedReason = Object.entries(exports.ContentFlagReasonEnum).some(([key, value]) => key !== exports.ContentFlagReasonEnum.Others && value === reason);
|
|
21683
|
+
const body = {
|
|
21684
|
+
reason: isPredefinedReason ? reason : exports.ContentFlagReasonEnum.Others,
|
|
21685
|
+
detail: isPredefinedReason ? '' : reason,
|
|
21686
|
+
};
|
|
21687
|
+
const { data: payload } = await client.http.post(`/api/v3/posts/${encodeURIComponent(postId)}/flag`, body);
|
|
21670
21688
|
if (client.cache) {
|
|
21671
21689
|
ingestInCache(prepareMembershipPayload(payload, 'communityUsers'));
|
|
21672
21690
|
}
|
|
@@ -22129,19 +22147,25 @@ const hardDeleteComment = async (commentId) => {
|
|
|
22129
22147
|
/**
|
|
22130
22148
|
* ```js
|
|
22131
22149
|
* import { CommentRepository } from '@amityco/ts-sdk'
|
|
22132
|
-
* const flagged = await CommentRepository.flagComment(
|
|
22150
|
+
* const flagged = await CommentRepository.flagComment(commentId, reason)
|
|
22133
22151
|
* ```
|
|
22134
22152
|
*
|
|
22135
22153
|
* @param commentId The ID of the comment to flag
|
|
22154
|
+
* @param reason the reason to flag the comment
|
|
22136
22155
|
* @returns the created report result
|
|
22137
22156
|
*
|
|
22138
22157
|
* @category Comment API
|
|
22139
22158
|
* @async
|
|
22140
22159
|
* */
|
|
22141
|
-
const flagComment = async (commentId) => {
|
|
22160
|
+
const flagComment = async (commentId, reason) => {
|
|
22142
22161
|
const client = getActiveClient();
|
|
22143
22162
|
client.log('comment/flagComment', commentId);
|
|
22144
|
-
const
|
|
22163
|
+
const isPredefinedReason = Object.entries(exports.ContentFlagReasonEnum).some(([key, value]) => key !== exports.ContentFlagReasonEnum.Others && value === reason);
|
|
22164
|
+
const body = {
|
|
22165
|
+
reason: isPredefinedReason ? reason : exports.ContentFlagReasonEnum.Others,
|
|
22166
|
+
detail: isPredefinedReason ? '' : reason,
|
|
22167
|
+
};
|
|
22168
|
+
const { data: payload } = await client.http.post(`/api/v3/comments/${encodeURIComponent(commentId)}/flag`, body);
|
|
22145
22169
|
if (client.cache) {
|
|
22146
22170
|
ingestInCache(payload);
|
|
22147
22171
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -65,7 +65,19 @@ const ContentFeedType = Object.freeze({
|
|
|
65
65
|
CHAT: 'chat',
|
|
66
66
|
POST: 'post',
|
|
67
67
|
MESSAGE: 'message',
|
|
68
|
-
});
|
|
68
|
+
});
|
|
69
|
+
var ContentFlagReasonEnum;
|
|
70
|
+
(function (ContentFlagReasonEnum) {
|
|
71
|
+
ContentFlagReasonEnum["CommunityGuidelines"] = "Against community guidelines";
|
|
72
|
+
ContentFlagReasonEnum["HarassmentOrBullying"] = "Harassment or bullying";
|
|
73
|
+
ContentFlagReasonEnum["SelfHarmOrSuicide"] = "Self-harm or suicide";
|
|
74
|
+
ContentFlagReasonEnum["ViolenceOrThreateningContent"] = "Violence or threatening content";
|
|
75
|
+
ContentFlagReasonEnum["SellingRestrictedItems"] = "Selling and promoting restricted items";
|
|
76
|
+
ContentFlagReasonEnum["SexualContentOrNudity"] = "Sexual message or nudity";
|
|
77
|
+
ContentFlagReasonEnum["SpamOrScams"] = "Spam or scams";
|
|
78
|
+
ContentFlagReasonEnum["FalseInformation"] = "False information or misinformation";
|
|
79
|
+
ContentFlagReasonEnum["Others"] = "Others";
|
|
80
|
+
})(ContentFlagReasonEnum || (ContentFlagReasonEnum = {}));
|
|
69
81
|
|
|
70
82
|
const MessageContentType = Object.freeze({
|
|
71
83
|
TEXT: 'text',
|
|
@@ -37746,19 +37758,25 @@ const declinePost = async (postId) => {
|
|
|
37746
37758
|
/**
|
|
37747
37759
|
* ```js
|
|
37748
37760
|
* import { PostRepository } from '@amityco/ts-sdk'
|
|
37749
|
-
* const flagged = await PostRepository.flagPost(postId)
|
|
37761
|
+
* const flagged = await PostRepository.flagPost(postId, reason)
|
|
37750
37762
|
* ```
|
|
37751
37763
|
*
|
|
37752
37764
|
* @param postId of the post to flag
|
|
37765
|
+
* @param reason the reason to flag the post
|
|
37753
37766
|
* @returns a boolean
|
|
37754
37767
|
*
|
|
37755
37768
|
* @category Post API
|
|
37756
37769
|
* @async
|
|
37757
37770
|
* */
|
|
37758
|
-
const flagPost = async (postId) => {
|
|
37771
|
+
const flagPost = async (postId, reason) => {
|
|
37759
37772
|
const client = getActiveClient();
|
|
37760
37773
|
client.log('post/flagPost', postId);
|
|
37761
|
-
const
|
|
37774
|
+
const isPredefinedReason = Object.entries(ContentFlagReasonEnum).some(([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason);
|
|
37775
|
+
const body = {
|
|
37776
|
+
reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
37777
|
+
detail: isPredefinedReason ? '' : reason,
|
|
37778
|
+
};
|
|
37779
|
+
const { data: payload } = await client.http.post(`/api/v3/posts/${encodeURIComponent(postId)}/flag`, body);
|
|
37762
37780
|
if (client.cache) {
|
|
37763
37781
|
ingestInCache(prepareMembershipPayload(payload, 'communityUsers'));
|
|
37764
37782
|
}
|
|
@@ -38221,19 +38239,25 @@ const hardDeleteComment = async (commentId) => {
|
|
|
38221
38239
|
/**
|
|
38222
38240
|
* ```js
|
|
38223
38241
|
* import { CommentRepository } from '@amityco/ts-sdk'
|
|
38224
|
-
* const flagged = await CommentRepository.flagComment(
|
|
38242
|
+
* const flagged = await CommentRepository.flagComment(commentId, reason)
|
|
38225
38243
|
* ```
|
|
38226
38244
|
*
|
|
38227
38245
|
* @param commentId The ID of the comment to flag
|
|
38246
|
+
* @param reason the reason to flag the comment
|
|
38228
38247
|
* @returns the created report result
|
|
38229
38248
|
*
|
|
38230
38249
|
* @category Comment API
|
|
38231
38250
|
* @async
|
|
38232
38251
|
* */
|
|
38233
|
-
const flagComment = async (commentId) => {
|
|
38252
|
+
const flagComment = async (commentId, reason) => {
|
|
38234
38253
|
const client = getActiveClient();
|
|
38235
38254
|
client.log('comment/flagComment', commentId);
|
|
38236
|
-
const
|
|
38255
|
+
const isPredefinedReason = Object.entries(ContentFlagReasonEnum).some(([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason);
|
|
38256
|
+
const body = {
|
|
38257
|
+
reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
38258
|
+
detail: isPredefinedReason ? '' : reason,
|
|
38259
|
+
};
|
|
38260
|
+
const { data: payload } = await client.http.post(`/api/v3/comments/${encodeURIComponent(commentId)}/flag`, body);
|
|
38237
38261
|
if (client.cache) {
|
|
38238
38262
|
ingestInCache(payload);
|
|
38239
38263
|
}
|
|
@@ -42497,4 +42521,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
42497
42521
|
onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
|
|
42498
42522
|
});
|
|
42499
42523
|
|
|
42500
|
-
export { API_REGIONS, index$1 as AdRepository, index$9 as CategoryRepository, index$d as ChannelRepository, index$m as Client, index$7 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$a as CommunityRepository, ContentFeedType, DefaultCommunityPostSetting, index$8 as FeedRepository, FileAccessTypeEnum, index$j as FileRepository, FileType, index$3 as LiveStreamPlayer, MessageContentType, index$h as MessageRepository, index$4 as PollRepository, PostContentType, index$6 as PostRepository, index$i as ReactionRepository, index$2 as StoryRepository, index$5 as StreamRepository, index$g as SubChannelRepository, SubscriptionLevels, index$k as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
|
|
42524
|
+
export { API_REGIONS, index$1 as AdRepository, index$9 as CategoryRepository, index$d as ChannelRepository, index$m as Client, index$7 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$a as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index$8 as FeedRepository, FileAccessTypeEnum, index$j as FileRepository, FileType, index$3 as LiveStreamPlayer, MessageContentType, index$h as MessageRepository, index$4 as PollRepository, PostContentType, index$6 as PostRepository, index$i as ReactionRepository, index$2 as StoryRepository, index$5 as StreamRepository, index$g as SubChannelRepository, SubscriptionLevels, index$k as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
|