@amityco/ts-sdk 7.8.4-a6beff39.0 → 7.8.4-b3380e0.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/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/@types/domains/message.d.ts +4 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/@types/domains/message.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/@types/domains/message.js.map +1 -1
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/addReactionToMessage.d.ts +2 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/addReactionToMessage.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/addReactionToMessage.js +6 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/addReactionToMessage.js.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/removeReactionToMessage.d.ts +2 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/removeReactionToMessage.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/removeReactionToMessage.js +6 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/removeReactionToMessage.js.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/addReaction.d.ts +5 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/addReaction.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/addReaction.js +92 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/addReaction.js.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/index.d.ts +3 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/index.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/index.js +3 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/removeReaction.d.ts +2 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/removeReaction.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/removeReaction.js +68 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/removeReaction.js.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/utils/linkedObject/messageLinkedObject.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/utils/linkedObject/messageLinkedObject.js +3 -1
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/utils/linkedObject/messageLinkedObject.js.map +1 -1
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/tsconfig.tsbuildinfo +1 -1
- package/dist/@types/domains/message.d.ts +4 -0
- package/dist/@types/domains/message.d.ts.map +1 -1
- package/dist/index.cjs.js +185 -25
- package/dist/index.esm.js +185 -25
- package/dist/index.umd.js +2 -2
- package/dist/messageRepository/utils/addReactionToMessage.d.ts +2 -0
- package/dist/messageRepository/utils/addReactionToMessage.d.ts.map +1 -0
- package/dist/messageRepository/utils/removeReactionToMessage.d.ts +2 -0
- package/dist/messageRepository/utils/removeReactionToMessage.d.ts.map +1 -0
- package/dist/reactionRepository/internalApi/addReaction.d.ts +5 -0
- package/dist/reactionRepository/internalApi/addReaction.d.ts.map +1 -0
- package/dist/reactionRepository/internalApi/index.d.ts +3 -0
- package/dist/reactionRepository/internalApi/index.d.ts.map +1 -0
- package/dist/reactionRepository/internalApi/removeReaction.d.ts +2 -0
- package/dist/reactionRepository/internalApi/removeReaction.d.ts.map +1 -0
- package/dist/utils/linkedObject/messageLinkedObject.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/@types/domains/message.ts +4 -0
- package/src/messageRepository/utils/addReactionToMessage.ts +12 -0
- package/src/messageRepository/utils/removeReactionToMessage.ts +12 -0
- package/src/reactionRepository/internalApi/addReaction.ts +137 -0
- package/src/reactionRepository/internalApi/index.ts +2 -0
- package/src/reactionRepository/internalApi/removeReaction.ts +95 -0
- package/src/utils/linkedObject/messageLinkedObject.ts +4 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -25,6 +25,7 @@ declare global {
|
|
|
25
25
|
userPublicIds: string[];
|
|
26
26
|
})>;
|
|
27
27
|
messageFeedId: Amity.RawSubChannel['messageFeedId'];
|
|
28
|
+
publicId: string;
|
|
28
29
|
messageId: string;
|
|
29
30
|
myReactions?: string[];
|
|
30
31
|
parentId?: string;
|
|
@@ -42,6 +43,7 @@ declare global {
|
|
|
42
43
|
editedAt?: Amity.timestamp;
|
|
43
44
|
parentId?: string;
|
|
44
45
|
messageId: string;
|
|
46
|
+
publicId: string;
|
|
45
47
|
subChannelId: Amity.SubChannel['subChannelId'];
|
|
46
48
|
channelType: Amity.Channel['type'];
|
|
47
49
|
uniqueId: string;
|
|
@@ -49,6 +51,8 @@ declare global {
|
|
|
49
51
|
deliveredCount: number;
|
|
50
52
|
referenceId?: string;
|
|
51
53
|
markRead: () => void;
|
|
54
|
+
addReaction: (reactionName: string) => Promise<boolean>;
|
|
55
|
+
removeReaction: (reactionName: string) => Promise<boolean>;
|
|
52
56
|
} & Amity.Content<T> & Amity.Flaggable & Amity.Mentionable<'user' | 'channel'> & Amity.Metadata & Amity.Reactable & Amity.SoftDelete & Amity.Subscribable & Amity.Timestamps & Amity.Taggable & Amity.MessageOptimistic;
|
|
53
57
|
type InternalMessage<T extends Amity.MessageContentType = any> = Omit<Amity.Message<T>, 'readCount' | 'deliveredCount' | 'markRead'> & {
|
|
54
58
|
creatorPrivateId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/message.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;;;;EAO7B,CAAC;AAEH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,kBAAkB,GAAG,OAAO,CAAC,OAAO,kBAAkB,CAAC,CAAC;QAE7D,KAAK,iBAAiB,GAClB,UAAU,GACV,UAAU,GACV,UAAU,GACV,SAAS,GACT,WAAW,GACX,aAAa,GACb,eAAe,GACf,iBAAiB,GACjB,mBAAmB,CAAC;QAExB,KAAK,iBAAiB,GAAG;YACvB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;SAC7B,CAAC;QAEF,KAAK,UAAU,CAAC,CAAC,SAAS,KAAK,C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,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC","sourcesContent":["export const MessageContentType = Object.freeze({\n TEXT: 'text',\n IMAGE: 'image',\n FILE: 'file',\n VIDEO: 'video',\n AUDIO: 'audio',\n CUSTOM: 'custom',\n});\n\ndeclare global {\n namespace Amity {\n type MessageContentType = ValueOf<typeof MessageContentType>;\n\n type MessageActionType =\n | 'onCreate'\n | 'onUpdate'\n | 'onDelete'\n | 'onFetch'\n | 'onFlagged'\n | 'onUnflagged'\n | 'onFlagCleared'\n | 'onReactionAdded'\n | 'onReactionRemoved';\n\n type MessageOptimistic = {\n syncState?: Amity.SyncState;\n };\n\n type RawMessage<T extends Amity.MessageContentType = any> = {\n channelId: string;\n channelPublicId: string;\n channelType: Amity.Channel['type'];\n childCount: number;\n creatorId: string;\n creatorPublicId: string;\n // TODO: check if editedAt appears on edit\n editedAt?: Amity.timestamp;\n mentionedUsers?: Array<\n Amity.ChannelMention | (Amity.UserMention & { userPublicIds: string[] })\n >;\n messageFeedId: Amity.RawSubChannel['messageFeedId'];\n messageId: string;\n myReactions?: string[];\n parentId?: string;\n reactionCount: number;\n reactions?: Record<string, number>;\n referenceId?: string; // https://ekoapp.atlassian.net/wiki/spaces/UP/pages/2085716114/SDK+V5+message+migration#Handling-%E2%80%98ReferenceId%E2%80%99-in-message-creation\n segment: number;\n } & Amity.Content<T> &\n Amity.Flaggable &\n Amity.Metadata &\n // Amity.Reactable &\n Amity.SoftDelete &\n Amity.Subscribable &\n Amity.Taggable &\n Amity.Timestamps;\n\n type Message<T extends Amity.MessageContentType = any> = {\n channelId: Amity.Channel['channelId'];\n channelSegment: number;\n childrenNumber: number;\n creatorId: string;\n creator?: Amity.User;\n editedAt?: Amity.timestamp;\n parentId?: string;\n messageId: string;\n subChannelId: Amity.SubChannel['subChannelId'];\n channelType: Amity.Channel['type'];\n uniqueId: string;\n readCount: number;\n deliveredCount: number;\n referenceId?: string;\n markRead: () => void;\n } & Amity.Content<T> &\n Amity.Flaggable &\n Amity.Mentionable<'user' | 'channel'> &\n Amity.Metadata &\n Amity.Reactable &\n Amity.SoftDelete &\n Amity.Subscribable &\n Amity.Timestamps &\n Amity.Taggable &\n Amity.MessageOptimistic;\n\n type InternalMessage<T extends Amity.MessageContentType = any> = Omit<\n Amity.Message<T>,\n 'readCount' | 'deliveredCount' | 'markRead'\n > & { creatorPrivateId: string };\n\n type QueryMessages = {\n subChannelId: Amity.SubChannel['subChannelId'];\n type?: Amity.MessageContentType;\n excludingTags?: Amity.Taggable['tags'];\n hasFlags?: boolean;\n includeDeleted?: boolean;\n /*\n * For messages the after and before values are messageId\n */\n page?: Amity.Page<string>;\n parentId?: Amity.Message['parentId'];\n sortBy?: 'segmentAsc' | 'segmentDesc';\n includingTags?: Amity.Taggable['tags'];\n pageToken?: string;\n aroundMessageId?: Amity.Message['messageId'];\n };\n\n type QueryReadUsers = {\n messageId: Amity.Message['messageId'];\n memberships?: ('member' | 'banned' | 'muted' | 'non-member' | 'deleted')[];\n page?: Amity.Page;\n };\n\n type QueryDeliveredUsers = {\n messageId: Amity.Message['messageId'];\n memberships?: ('member' | 'banned' | 'muted' | 'non-member' | 'deleted')[];\n page?: Amity.Page;\n };\n\n type MessagesLiveCollection = Amity.LiveCollectionParams<Omit<QueryMessages, 'page'>>;\n\n type MessageLiveCollectionCache = Amity.LiveCollectionCache<\n Amity.Message['subChannelId'],\n Pick<QueryMessages, 'page'> & { paging?: Amity.Pagination['paging'] }\n >;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/@types/domains/message.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC","sourcesContent":["export const MessageContentType = Object.freeze({\n TEXT: 'text',\n IMAGE: 'image',\n FILE: 'file',\n VIDEO: 'video',\n AUDIO: 'audio',\n CUSTOM: 'custom',\n});\n\ndeclare global {\n namespace Amity {\n type MessageContentType = ValueOf<typeof MessageContentType>;\n\n type MessageActionType =\n | 'onCreate'\n | 'onUpdate'\n | 'onDelete'\n | 'onFetch'\n | 'onFlagged'\n | 'onUnflagged'\n | 'onFlagCleared'\n | 'onReactionAdded'\n | 'onReactionRemoved';\n\n type MessageOptimistic = {\n syncState?: Amity.SyncState;\n };\n\n type RawMessage<T extends Amity.MessageContentType = any> = {\n channelId: string;\n channelPublicId: string;\n channelType: Amity.Channel['type'];\n childCount: number;\n creatorId: string;\n creatorPublicId: string;\n // TODO: check if editedAt appears on edit\n editedAt?: Amity.timestamp;\n mentionedUsers?: Array<\n Amity.ChannelMention | (Amity.UserMention & { userPublicIds: string[] })\n >;\n messageFeedId: Amity.RawSubChannel['messageFeedId'];\n publicId: string;\n messageId: string;\n myReactions?: string[];\n parentId?: string;\n reactionCount: number;\n reactions?: Record<string, number>;\n referenceId?: string; // https://ekoapp.atlassian.net/wiki/spaces/UP/pages/2085716114/SDK+V5+message+migration#Handling-%E2%80%98ReferenceId%E2%80%99-in-message-creation\n segment: number;\n } & Amity.Content<T> &\n Amity.Flaggable &\n Amity.Metadata &\n // Amity.Reactable &\n Amity.SoftDelete &\n Amity.Subscribable &\n Amity.Taggable &\n Amity.Timestamps;\n\n type Message<T extends Amity.MessageContentType = any> = {\n channelId: Amity.Channel['channelId'];\n channelSegment: number;\n childrenNumber: number;\n creatorId: string;\n creator?: Amity.User;\n editedAt?: Amity.timestamp;\n parentId?: string;\n messageId: string;\n publicId: string;\n subChannelId: Amity.SubChannel['subChannelId'];\n channelType: Amity.Channel['type'];\n uniqueId: string;\n readCount: number;\n deliveredCount: number;\n referenceId?: string;\n markRead: () => void;\n addReaction: (reactionName: string) => Promise<boolean>;\n removeReaction: (reactionName: string) => Promise<boolean>;\n } & Amity.Content<T> &\n Amity.Flaggable &\n Amity.Mentionable<'user' | 'channel'> &\n Amity.Metadata &\n Amity.Reactable &\n Amity.SoftDelete &\n Amity.Subscribable &\n Amity.Timestamps &\n Amity.Taggable &\n Amity.MessageOptimistic;\n\n type InternalMessage<T extends Amity.MessageContentType = any> = Omit<\n Amity.Message<T>,\n 'readCount' | 'deliveredCount' | 'markRead'\n > & { creatorPrivateId: string };\n\n type QueryMessages = {\n subChannelId: Amity.SubChannel['subChannelId'];\n type?: Amity.MessageContentType;\n excludingTags?: Amity.Taggable['tags'];\n hasFlags?: boolean;\n includeDeleted?: boolean;\n /*\n * For messages the after and before values are messageId\n */\n page?: Amity.Page<string>;\n parentId?: Amity.Message['parentId'];\n sortBy?: 'segmentAsc' | 'segmentDesc';\n includingTags?: Amity.Taggable['tags'];\n pageToken?: string;\n aroundMessageId?: Amity.Message['messageId'];\n };\n\n type QueryReadUsers = {\n messageId: Amity.Message['messageId'];\n memberships?: ('member' | 'banned' | 'muted' | 'non-member' | 'deleted')[];\n page?: Amity.Page;\n };\n\n type QueryDeliveredUsers = {\n messageId: Amity.Message['messageId'];\n memberships?: ('member' | 'banned' | 'muted' | 'non-member' | 'deleted')[];\n page?: Amity.Page;\n };\n\n type MessagesLiveCollection = Amity.LiveCollectionParams<Omit<QueryMessages, 'page'>>;\n\n type MessageLiveCollectionCache = Amity.LiveCollectionCache<\n Amity.Message['subChannelId'],\n Pick<QueryMessages, 'page'> & { paging?: Amity.Pagination['paging'] }\n >;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addReactionToMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/utils/addReactionToMessage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,iBAAkB,MAAM,WAAW,MAAM,eAAe,qBASxF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { addReaction as _addReaction } from '~/reactionRepository/internalApi';
|
|
2
|
+
export const addReactionToMessage = (reactionName, message) => {
|
|
3
|
+
const isMessageV3 = message.publicId !== message.messageId;
|
|
4
|
+
return _addReaction('message', isMessageV3 ? message.publicId : message.messageId, reactionName, isMessageV3 ? 3 : 5);
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=addReactionToMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addReactionToMessage.js","sourceRoot":"","sources":["../../../src/messageRepository/utils/addReactionToMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAE/E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,YAAoB,EAAE,OAA8B,EAAE,EAAE;IAC3F,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,SAAS,CAAC;IAE3D,OAAO,YAAY,CACjB,SAAS,EACT,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAClD,YAAY,EACZ,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACpB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { addReaction as _addReaction } from '~/reactionRepository/internalApi';\n\nexport const addReactionToMessage = (reactionName: string, message: Amity.InternalMessage) => {\n const isMessageV3 = message.publicId !== message.messageId;\n\n return _addReaction(\n 'message',\n isMessageV3 ? message.publicId : message.messageId,\n reactionName,\n isMessageV3 ? 3 : 5,\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeReactionToMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/utils/removeReactionToMessage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,WAAW,MAAM,eAAe,qBAS3F,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { removeReaction as _removeReaction } from '~/reactionRepository/internalApi';
|
|
2
|
+
export const removeReactionToMessage = (reactionName, message) => {
|
|
3
|
+
const isMessageV3 = message.publicId !== message.messageId;
|
|
4
|
+
return _removeReaction('message', isMessageV3 ? message.publicId : message.messageId, reactionName, isMessageV3 ? 3 : 5);
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=removeReactionToMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeReactionToMessage.js","sourceRoot":"","sources":["../../../src/messageRepository/utils/removeReactionToMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAErF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,YAAoB,EAAE,OAA8B,EAAE,EAAE;IAC9F,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,SAAS,CAAC;IAE3D,OAAO,eAAe,CACpB,SAAS,EACT,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAClD,YAAY,EACZ,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACpB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { removeReaction as _removeReaction } from '~/reactionRepository/internalApi';\n\nexport const removeReactionToMessage = (reactionName: string, message: Amity.InternalMessage) => {\n const isMessageV3 = message.publicId !== message.messageId;\n\n return _removeReaction(\n 'message',\n isMessageV3 ? message.publicId : message.messageId,\n reactionName,\n isMessageV3 ? 3 : 5,\n );\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const addReaction: {
|
|
2
|
+
(referenceType: Amity.Reaction['referenceType'], referenceId: Amity.Reaction['referenceId'], reactionName: Amity.InternalReactor['reactionName'], referenceVersion?: number): Promise<boolean>;
|
|
3
|
+
optimistically(referenceType: Amity.ReactableType, referenceId: Amity.Reaction['referenceId'], reactionName: Amity.InternalReactor['reactionName']): boolean | undefined;
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=addReaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addReaction.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/internalApi/addReaction.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,WAAW;oBACP,MAAM,QAAQ,CAAC,eAAe,CAAC,eACjC,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,eAAe,CAAC,cAAc,CAAC,qBAChC,MAAM,GACxB,QAAQ,OAAO,CAAC;kCAoFF,MAAM,aAAa,eACrB,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,eAAe,CAAC,cAAc,CAAC,GAClD,OAAO,GAAG,SAAS;CANrB,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api';
|
|
2
|
+
import { upsertInCache, pullFromCache } from '~/cache/api';
|
|
3
|
+
import { UNSYNCED_OBJECT_CACHED_AT_VALUE } from '~/utils/constants';
|
|
4
|
+
import { dispatchReactable } from '../utils/dispatchReactable';
|
|
5
|
+
import { fireEvent } from '~/core/events';
|
|
6
|
+
import { ASCApiError } from '~/core/errors';
|
|
7
|
+
export const addReaction = async (referenceType, referenceId, reactionName, referenceVersion) => {
|
|
8
|
+
var _a, _b, _c;
|
|
9
|
+
const client = getActiveClient();
|
|
10
|
+
client.log('reaction/createReaction', {
|
|
11
|
+
referenceId,
|
|
12
|
+
referenceType,
|
|
13
|
+
reactionName,
|
|
14
|
+
});
|
|
15
|
+
if (!['post', 'comment', 'story', 'message'].includes(referenceType))
|
|
16
|
+
throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
17
|
+
const { data } = await client.http.post('/api/v2/reactions', {
|
|
18
|
+
referenceId,
|
|
19
|
+
referenceType,
|
|
20
|
+
reactionName,
|
|
21
|
+
referenceVersion,
|
|
22
|
+
});
|
|
23
|
+
if (client.cache) {
|
|
24
|
+
const model = pullFromCache([
|
|
25
|
+
referenceType,
|
|
26
|
+
'get',
|
|
27
|
+
referenceId,
|
|
28
|
+
]);
|
|
29
|
+
if (!model || ((_a = model.data.myReactions) === null || _a === void 0 ? void 0 : _a.includes(reactionName)))
|
|
30
|
+
return true;
|
|
31
|
+
const updatedModel = Object.assign(Object.assign({}, model.data), { reactionsCount: model.data.reactionsCount + 1, myReactions: [...((_b = model.data.myReactions) !== null && _b !== void 0 ? _b : []), reactionName], reactions: Object.assign(Object.assign({}, model.data.reactions), { [reactionName]: ((_c = model.data.reactions[reactionName]) !== null && _c !== void 0 ? _c : 0) + 1 }), updatedAt: new Date().toISOString() });
|
|
32
|
+
if (referenceType === 'comment') {
|
|
33
|
+
fireEvent('local.comment.addReaction', {
|
|
34
|
+
comment: updatedModel,
|
|
35
|
+
reactor: {
|
|
36
|
+
userId: client.userId,
|
|
37
|
+
reactionName,
|
|
38
|
+
reactionId: data.addedId,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (referenceType === 'post') {
|
|
44
|
+
fireEvent('local.post.addReaction', {
|
|
45
|
+
post: updatedModel,
|
|
46
|
+
reactor: {
|
|
47
|
+
userId: client.userId,
|
|
48
|
+
reactionName,
|
|
49
|
+
reactionId: data.addedId,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (referenceType === 'story') {
|
|
55
|
+
fireEvent('local.story.reactionAdded', {
|
|
56
|
+
story: updatedModel,
|
|
57
|
+
reactor: {
|
|
58
|
+
userId: client.userId,
|
|
59
|
+
reactionName,
|
|
60
|
+
reactionId: data.addedId,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
};
|
|
68
|
+
addReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
69
|
+
var _a, _b, _c, _d, _e;
|
|
70
|
+
const client = getActiveClient();
|
|
71
|
+
client.log('reaction/createReaction.optimistically', {
|
|
72
|
+
referenceId,
|
|
73
|
+
referenceType,
|
|
74
|
+
reactionName,
|
|
75
|
+
});
|
|
76
|
+
if (!client.cache)
|
|
77
|
+
return;
|
|
78
|
+
const model = pullFromCache([
|
|
79
|
+
referenceType,
|
|
80
|
+
'get',
|
|
81
|
+
referenceId,
|
|
82
|
+
]);
|
|
83
|
+
if (!(model === null || model === void 0 ? void 0 : model.data) || ((_a = model.data.myReactions) === null || _a === void 0 ? void 0 : _a.includes(reactionName)))
|
|
84
|
+
return;
|
|
85
|
+
const reaction = Object.assign(Object.assign({}, model.data), { reactionsCount: model.data.reactionsCount + 1, myReactions: [...((_b = model.data.myReactions) !== null && _b !== void 0 ? _b : []), reactionName], reactions: Object.assign(Object.assign({}, model.data.reactions), { [reactionName]: ((_c = model.data.reactions[reactionName]) !== null && _c !== void 0 ? _c : 0) + 1 }) });
|
|
86
|
+
upsertInCache([referenceType, 'get', referenceId], reaction, {
|
|
87
|
+
cachedAt: UNSYNCED_OBJECT_CACHED_AT_VALUE,
|
|
88
|
+
});
|
|
89
|
+
dispatchReactable(referenceType, reaction);
|
|
90
|
+
return (_e = (_d = reaction === null || reaction === void 0 ? void 0 : reaction.myReactions) === null || _d === void 0 ? void 0 : _d.includes(reactionName)) !== null && _e !== void 0 ? _e : false;
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=addReaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addReaction.js","sourceRo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CAAC;AAChE,CAAC,CAAC","sourcesContent":["import { getActiveClient } from '~/client/api';\n\nimport { upsertInCache, pullFromCache } from '~/cache/api';\n\nimport { UNSYNCED_OBJECT_CACHED_AT_VALUE } from '~/utils/constants';\nimport { dispatchReactable } from '../utils/dispatchReactable';\nimport { fireEvent } from '~/core/events';\nimport { ASCApiError } from '~/core/errors';\n\nexport const addReaction = async (\n referenceType: Amity.Reaction['referenceType'],\n referenceId: Amity.Reaction['referenceId'],\n reactionName: Amity.InternalReactor['reactionName'],\n referenceVersion?: number,\n): Promise<boolean> => {\n const client = getActiveClient();\n client.log('reaction/createReaction', {\n referenceId,\n referenceType,\n reactionName,\n });\n\n if (!['post', 'comment', 'story', 'message'].includes(referenceType))\n throw new ASCApiError(\n 'The reference type is not valid. It should be one of post, comment, story, or message',\n Amity.ServerError.BAD_REQUEST,\n Amity.ErrorLevel.ERROR,\n );\n\n const { data } = await client.http.post<{ addedId: 'string' }>('/api/v2/reactions', {\n referenceId,\n referenceType,\n reactionName,\n referenceVersion,\n });\n\n if (client.cache) {\n const model = pullFromCache<Amity.Models[Amity.ReactableType]>([\n referenceType,\n 'get',\n referenceId,\n ]);\n\n if (!model || model.data.myReactions?.includes(reactionName)) return true;\n\n const updatedModel = {\n ...model.data,\n reactionsCount: model.data.reactionsCount + 1,\n myReactions: [...(model.data.myReactions ?? []), reactionName],\n reactions: {\n ...model.data.reactions,\n [reactionName]: (model.data.reactions[reactionName] ?? 0) + 1,\n },\n updatedAt: new Date().toISOString(),\n } as Amity.Models[Amity.ReactableType];\n\n if (referenceType === 'comment') {\n fireEvent('local.comment.addReaction', {\n comment: updatedModel as Amity.InternalComment,\n reactor: {\n userId: client.userId!,\n reactionName,\n reactionId: data.addedId,\n },\n });\n\n return true;\n }\n if (referenceType === 'post') {\n fireEvent('local.post.addReaction', {\n post: updatedModel as Amity.InternalPost,\n reactor: {\n userId: client.userId!,\n reactionName,\n reactionId: data.addedId,\n },\n });\n\n return true;\n }\n if (referenceType === 'story') {\n fireEvent('local.story.reactionAdded', {\n story: updatedModel as Amity.InternalStory,\n reactor: {\n userId: client.userId!,\n reactionName,\n reactionId: data.addedId,\n },\n });\n\n return true;\n }\n }\n\n return true;\n};\n\naddReaction.optimistically = (\n referenceType: Amity.ReactableType,\n referenceId: Amity.Reaction['referenceId'],\n reactionName: Amity.InternalReactor['reactionName'],\n): boolean | undefined => {\n const client = getActiveClient();\n client.log('reaction/createReaction.optimistically', {\n referenceId,\n referenceType,\n reactionName,\n });\n\n if (!client.cache) return;\n\n const model = pullFromCache<Amity.Models[Amity.ReactableType]>([\n referenceType,\n 'get',\n referenceId,\n ]);\n\n if (!model?.data || model.data.myReactions?.includes(reactionName)) return;\n\n const reaction = {\n ...model.data,\n reactionsCount: model.data.reactionsCount + 1,\n myReactions: [...(model.data.myReactions ?? []), reactionName],\n reactions: {\n ...model.data.reactions,\n [reactionName]: (model.data.reactions[reactionName] ?? 0) + 1,\n },\n } as Amity.Models[Amity.ReactableType];\n\n upsertInCache([referenceType, 'get', referenceId], reaction, {\n cachedAt: UNSYNCED_OBJECT_CACHED_AT_VALUE,\n });\n\n dispatchReactable(referenceType, reaction);\n\n return reaction?.myReactions?.includes(reactionName) ?? false;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/internalApi/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reactionRepository/internalApi/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './addReaction';\nexport * from './removeReaction';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeReaction.d.ts","sourceRoot":"","sources":["../../../src/reactionRepository/internalApi/removeReaction.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,kBACV,MAAM,QAAQ,CAAC,eAAe,CAAC,eACjC,MAAM,QAAQ,CAAC,aAAa,CAAC,gBAC5B,MAAM,eAAe,CAAC,cAAc,CAAC,qBAChC,MAAM,KACxB,QAAQ,OAAO,CAoFjB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api';
|
|
2
|
+
import { pullFromCache } from '~/cache/api';
|
|
3
|
+
import { fireEvent } from '~/core/events';
|
|
4
|
+
import { ASCApiError } from '~/core/errors';
|
|
5
|
+
export const removeReaction = async (referenceType, referenceId, reactionName, referenceVersion) => {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const client = getActiveClient();
|
|
8
|
+
client.log('reaction/removeReaction', {
|
|
9
|
+
referenceId,
|
|
10
|
+
referenceType,
|
|
11
|
+
reactionName,
|
|
12
|
+
});
|
|
13
|
+
if (!['post', 'comment', 'story', 'message'].includes(referenceType))
|
|
14
|
+
throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
15
|
+
const { data } = await client.http.delete(`/api/v2/reactions`, {
|
|
16
|
+
data: {
|
|
17
|
+
referenceId,
|
|
18
|
+
referenceType,
|
|
19
|
+
reactionName,
|
|
20
|
+
referenceVersion,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
if (client.cache) {
|
|
24
|
+
const model = pullFromCache([
|
|
25
|
+
referenceType,
|
|
26
|
+
'get',
|
|
27
|
+
referenceId,
|
|
28
|
+
]);
|
|
29
|
+
if (!model)
|
|
30
|
+
return true;
|
|
31
|
+
const updatedModel = Object.assign(Object.assign({}, model.data), { reactionsCount: Math.max(0, model.data.reactionsCount - 1), myReactions: ((_a = model.data.myReactions) !== null && _a !== void 0 ? _a : []).filter(item => item !== reactionName), reactions: Object.assign(Object.assign({}, model.data.reactions), { [reactionName]: Math.max(0, ((_b = model.data.reactions[reactionName]) !== null && _b !== void 0 ? _b : 0) - 1) }), updatedAt: new Date().toISOString() });
|
|
32
|
+
if (referenceType === 'comment') {
|
|
33
|
+
fireEvent('local.comment.removeReaction', {
|
|
34
|
+
comment: updatedModel,
|
|
35
|
+
reactor: {
|
|
36
|
+
reactionId: data.removedId,
|
|
37
|
+
reactionName,
|
|
38
|
+
userId: client.userId,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (referenceType === 'post') {
|
|
44
|
+
fireEvent('local.post.removeReaction', {
|
|
45
|
+
post: updatedModel,
|
|
46
|
+
reactor: {
|
|
47
|
+
reactionId: data.removedId,
|
|
48
|
+
reactionName,
|
|
49
|
+
userId: client.userId,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (referenceType === 'story') {
|
|
55
|
+
fireEvent('local.story.reactionAdded', {
|
|
56
|
+
story: updatedModel,
|
|
57
|
+
reactor: {
|
|
58
|
+
userId: client.userId,
|
|
59
|
+
reactionName,
|
|
60
|
+
reactionId: data.removedId,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=removeReaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeReaction.js","sourceRoot":"","sources":["../../../src/reactionRepository/internalApi/removeReaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,CAAC,MAAM,cAAc,GAAG,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AAC,KAE5E,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,GACC,CAAC;QAEvC,IAAI,aAAa,KAAK,SAAS,EAAE;YAC/B,SAAS,CAAC,8BAA8B,EAAE;gBACxC,OAAO,EAAE,YAAqC;gBAC9C,OAAO,EAAE;oBACP,UAAU,EAAE,IAAI,CAAC,SAAS;oBAC1B,YAAY;oBACZ,MAAM,EAAE,MAAM,CAAC,MAAO;iBACvB;aACF,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;SACb;QACD,IAAI,aAAa,KAAK,MAAM,EAAE;YAC5B,SAAS,CAAC,2BAA2B,EAAE;gBACrC,IAAI,EAAE,YAAkC;gBACxC,OAAO,EAAE;oBACP,UAAU,EAAE,IAAI,CAAC,SAAS;oBAC1B,YAAY;oBACZ,MAAM,EAAE,MAAM,CAAC,MAAO;iBACvB;aACF,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;SACb;QAED,IAAI,aAAa,KAAK,OAAO,EAAE;YAC7B,SAAS,CAAC,2BAA2B,EAAE;gBACrC,KAAK,EAAE,YAAmC;gBAC1C,OAAO,EAAE;oBACP,MAAM,EAAE,MAAM,CAAC,MAAO;oBACtB,YAAY;oBACZ,UAAU,EAAE,IAAI,CAAC,SAAS;iBAC3B;aACF,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;SACb;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import { getActiveClient } from '~/client/api';\nimport { pullFromCache } from '~/cache/api';\nimport { fireEvent } from '~/core/events';\nimport { ASCApiError } from '~/core/errors';\n\nexport const removeReaction = async (\n referenceType: Amity.Reaction['referenceType'],\n referenceId: Amity.Reaction['referenceId'],\n reactionName: Amity.InternalReactor['reactionName'],\n referenceVersion?: number,\n): Promise<boolean> => {\n const client = getActiveClient();\n client.log('reaction/removeReaction', {\n referenceId,\n referenceType,\n reactionName,\n });\n\n if (!['post', 'comment', 'story', 'message'].includes(referenceType))\n throw new ASCApiError(\n 'The reference type is not valid. It should be one of post, comment, story, or message',\n Amity.ServerError.BAD_REQUEST,\n Amity.ErrorLevel.ERROR,\n );\n\n const { data } = await client.http.delete<{ removedId: string }>(`/api/v2/reactions`, {\n data: {\n referenceId,\n referenceType,\n reactionName,\n referenceVersion,\n },\n });\n\n if (client.cache) {\n const model = pullFromCache<Amity.Models[Amity.ReactableType]>([\n referenceType,\n 'get',\n referenceId,\n ]);\n\n if (!model) return true;\n\n const updatedModel = {\n ...model.data,\n reactionsCount: Math.max(0, model.data.reactionsCount - 1),\n myReactions: (model.data.myReactions ?? []).filter(item => item !== reactionName),\n reactions: {\n ...model.data.reactions,\n [reactionName]: Math.max(0, (model.data.reactions[reactionName] ?? 0) - 1),\n },\n updatedAt: new Date().toISOString(),\n } as Amity.Models[Amity.ReactableType];\n\n if (referenceType === 'comment') {\n fireEvent('local.comment.removeReaction', {\n comment: updatedModel as Amity.InternalComment,\n reactor: {\n reactionId: data.removedId,\n reactionName,\n userId: client.userId!,\n },\n });\n\n return true;\n }\n if (referenceType === 'post') {\n fireEvent('local.post.removeReaction', {\n post: updatedModel as Amity.InternalPost,\n reactor: {\n reactionId: data.removedId,\n reactionName,\n userId: client.userId!,\n },\n });\n\n return true;\n }\n\n if (referenceType === 'story') {\n fireEvent('local.story.reactionAdded', {\n story: updatedModel as Amity.InternalStory,\n reactor: {\n userId: client.userId!,\n reactionName,\n reactionId: data.removedId,\n },\n });\n\n return true;\n }\n }\n\n return true;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/messageLinkedObject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"messageLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/messageLinkedObject.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,YAAa,MAAM,eAAe,KAAG,MAAM,OAiB1E,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import { pullFromCache } from '~/cache/api';
|
|
3
|
+
import { addReactionToMessage } from '~/messageRepository/utils/addReactionToMessage';
|
|
3
4
|
import { getMessageReadCount } from '~/messageRepository/utils/getMessageReadCount';
|
|
4
5
|
import { markReadMessage } from '~/messageRepository/utils/markReadMessage';
|
|
6
|
+
import { removeReactionToMessage } from '~/messageRepository/utils/removeReactionToMessage';
|
|
5
7
|
export const messageLinkedObject = (message) => {
|
|
6
8
|
const { creatorPrivateId } = message, rest = __rest(message, ["creatorPrivateId"]);
|
|
7
9
|
return Object.assign(Object.assign({}, rest), { get readCount() {
|
|
@@ -13,6 +15,6 @@ export const messageLinkedObject = (message) => {
|
|
|
13
15
|
get creator() {
|
|
14
16
|
var _a;
|
|
15
17
|
return (_a = pullFromCache(['user', 'get', message.creatorId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16
|
-
}, markRead: () => markReadMessage(message) });
|
|
18
|
+
}, markRead: () => markReadMessage(message), addReaction: (reactionName) => addReactionToMessage(reactionName, message), removeReaction: (reactionName) => removeReactionToMessage(reactionName, message) });
|
|
17
19
|
};
|
|
18
20
|
//# sourceMappingURL=messageLinkedObject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageLinkedObject.js","sourceRoot":"","sources":["../../../src/utils/linkedObject/messageLinkedObject.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"messageLinkedObject.js","sourceRoot":"","sources":["../../../src/utils/linkedObject/messageLinkedObject.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAE5F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAA8B,EAAiB,EAAE;IACnF,MAAM,EAAE,gBAAgB,KAAc,OAAO,EAAhB,IAAI,UAAK,OAAO,EAAvC,oBAA6B,CAAU,CAAC;IAC9C,uCACK,IAAI,KACP,IAAI,SAAS;YACX,OAAO,mBAAmB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC;QAChD,CAAC;QACD,IAAI,cAAc;YAChB,OAAO,mBAAmB,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC;QACrD,CAAC;QACD,IAAI,OAAO;;YACT,OAAO,MAAA,aAAa,CAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,0CAAE,IAAI,CAAC;QACrF,CAAC,EACD,QAAQ,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,EACxC,WAAW,EAAE,CAAC,YAAoB,EAAE,EAAE,CAAC,oBAAoB,CAAC,YAAY,EAAE,OAAO,CAAC,EAClF,cAAc,EAAE,CAAC,YAAoB,EAAE,EAAE,CAAC,uBAAuB,CAAC,YAAY,EAAE,OAAO,CAAC,IACxF;AACJ,CAAC,CAAC","sourcesContent":["import { pullFromCache } from '~/cache/api';\nimport { addReactionToMessage } from '~/messageRepository/utils/addReactionToMessage';\nimport { getMessageReadCount } from '~/messageRepository/utils/getMessageReadCount';\nimport { markReadMessage } from '~/messageRepository/utils/markReadMessage';\nimport { removeReactionToMessage } from '~/messageRepository/utils/removeReactionToMessage';\n\nexport const messageLinkedObject = (message: Amity.InternalMessage): Amity.Message => {\n const { creatorPrivateId, ...rest } = message;\n return {\n ...rest,\n get readCount() {\n return getMessageReadCount(message).readCount;\n },\n get deliveredCount() {\n return getMessageReadCount(message).deliveredCount;\n },\n get creator() {\n return pullFromCache<Amity.InternalUser>(['user', 'get', message.creatorId])?.data;\n },\n markRead: () => markReadMessage(message),\n addReaction: (reactionName: string) => addReactionToMessage(reactionName, message),\n removeReaction: (reactionName: string) => removeReactionToMessage(reactionName, message),\n };\n};\n"]}
|