@amityco/ts-sdk 7.2.1-b894bb3a.0 → 7.2.1-c3db7142.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/ad.d.ts +1 -1
- package/dist/@types/domains/ad.d.ts.map +1 -1
- package/dist/@types/domains/content.d.ts +12 -0
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/index.cjs.js +22 -4
- package/dist/index.esm.js +23 -5
- package/dist/index.umd.js +4 -4
- package/dist/messageRepository/api/flagMessage.d.ts +3 -2
- package/dist/messageRepository/api/flagMessage.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/ad.ts +1 -1
- package/src/@types/domains/content.ts +16 -0
- package/src/messageRepository/api/flagMessage.ts +19 -6
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": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ad.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/ad.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,WAAW,WAAW;YACpB,IAAI,SAAS;YACb,KAAK,UAAU;YACf,OAAO,YAAY;YACnB,QAAQ,aAAa;YACrB,IAAI,SAAS;SACd;QAED,WAAW,kBAAkB;YAC3B,KAAK,UAAU;YACf,UAAU,gBAAgB;SAC3B;QAED,KAAK,QAAQ,GAAG;YACd,YAAY,EAAE,KAAK,CA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IAAI,CAAC;SAC/B,CAAC;QAEF,KAAK,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW,CAAC,GAAG;YACrD,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;YAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/B,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAChC,SAAS,EAAE;gBACT,UAAU,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC;gBACnD,iBAAiB,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC;aAC3D,CAAC;SACH,CAAC;QAEF,KAAK,kBAAkB,GAAG;YACxB,GAAG,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;YACxB,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC;SAC7B,CAAC;QAEF,KAAK,UAAU,GAAG;YAChB,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;YAChB,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC;SAC7B,CAAC;KACH;CACF"}
|
|
@@ -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,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;SACxC,CAAC;QAEF,KAAK,gBAAgB,GAAG;YACtB,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,OAA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AG;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"}
|
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',
|
|
@@ -15820,19 +15832,25 @@ getDeliveredUsers.locally = (query) => {
|
|
|
15820
15832
|
/**
|
|
15821
15833
|
* ```js
|
|
15822
15834
|
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
15823
|
-
* const flagged = await MessageRepository.flagMessage(messageId)
|
|
15835
|
+
* const flagged = await MessageRepository.flagMessage(messageId, reason)
|
|
15824
15836
|
* ```
|
|
15825
15837
|
*
|
|
15826
15838
|
* @param messageId of the message to flag
|
|
15839
|
+
* @param reason the reason to flag the message
|
|
15827
15840
|
* @returns the created report result
|
|
15828
15841
|
*
|
|
15829
15842
|
* @category Message API
|
|
15830
15843
|
* @async
|
|
15831
15844
|
* */
|
|
15832
|
-
const flagMessage = async (messageId) => {
|
|
15845
|
+
const flagMessage = async (messageId, reason) => {
|
|
15833
15846
|
const client = getActiveClient();
|
|
15834
15847
|
client.log('message/flag', messageId);
|
|
15835
|
-
const
|
|
15848
|
+
const isPredefinedReason = Object.entries(exports.ContentFlagReasonEnum).some(([key, value]) => key !== exports.ContentFlagReasonEnum.Others && value === reason);
|
|
15849
|
+
const body = {
|
|
15850
|
+
reason: isPredefinedReason ? reason : exports.ContentFlagReasonEnum.Others,
|
|
15851
|
+
detail: isPredefinedReason ? '' : reason,
|
|
15852
|
+
};
|
|
15853
|
+
const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`, body);
|
|
15836
15854
|
if (client.cache) {
|
|
15837
15855
|
const messagePayload = await prepareMessagePayload(payload);
|
|
15838
15856
|
ingestInCache(messagePayload);
|
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',
|
|
@@ -31912,19 +31924,25 @@ getDeliveredUsers.locally = (query) => {
|
|
|
31912
31924
|
/**
|
|
31913
31925
|
* ```js
|
|
31914
31926
|
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
31915
|
-
* const flagged = await MessageRepository.flagMessage(messageId)
|
|
31927
|
+
* const flagged = await MessageRepository.flagMessage(messageId, reason)
|
|
31916
31928
|
* ```
|
|
31917
31929
|
*
|
|
31918
31930
|
* @param messageId of the message to flag
|
|
31931
|
+
* @param reason the reason to flag the message
|
|
31919
31932
|
* @returns the created report result
|
|
31920
31933
|
*
|
|
31921
31934
|
* @category Message API
|
|
31922
31935
|
* @async
|
|
31923
31936
|
* */
|
|
31924
|
-
const flagMessage = async (messageId) => {
|
|
31937
|
+
const flagMessage = async (messageId, reason) => {
|
|
31925
31938
|
const client = getActiveClient();
|
|
31926
31939
|
client.log('message/flag', messageId);
|
|
31927
|
-
const
|
|
31940
|
+
const isPredefinedReason = Object.entries(ContentFlagReasonEnum).some(([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason);
|
|
31941
|
+
const body = {
|
|
31942
|
+
reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
31943
|
+
detail: isPredefinedReason ? '' : reason,
|
|
31944
|
+
};
|
|
31945
|
+
const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`, body);
|
|
31928
31946
|
if (client.cache) {
|
|
31929
31947
|
const messagePayload = await prepareMessagePayload(payload);
|
|
31930
31948
|
ingestInCache(messagePayload);
|
|
@@ -42408,4 +42426,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
42408
42426
|
onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
|
|
42409
42427
|
});
|
|
42410
42428
|
|
|
42411
|
-
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 };
|
|
42429
|
+
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 };
|