@amityco/ts-sdk 6.2.1-b60a2f4.0 → 6.2.1-b68e715.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/README.md +0 -4
- package/dist/@types/domains/channel.d.ts +5 -1
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/channelRepsitory/api/createChannel.d.ts +1 -1
- package/dist/communityRepository/{communityModeration → communityMembership}/api/addMembers.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/api/index.d.ts +3 -0
- package/dist/communityRepository/communityMembership/api/index.d.ts.map +1 -0
- package/dist/communityRepository/{communityModeration → communityMembership}/api/removeMembers.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/api/tests/addMembers.test.d.ts.map +1 -0
- package/dist/communityRepository/communityMembership/api/tests/removeMembers.test.d.ts.map +1 -0
- package/dist/communityRepository/communityMembership/index.d.ts +1 -0
- package/dist/communityRepository/communityMembership/index.d.ts.map +1 -1
- package/dist/communityRepository/communityModeration/api/index.d.ts +0 -2
- package/dist/communityRepository/communityModeration/api/index.d.ts.map +1 -1
- package/dist/feedRepository/api/index.d.ts +1 -0
- package/dist/feedRepository/api/index.d.ts.map +1 -1
- package/dist/fileRepository/api/index.d.ts +3 -3
- package/dist/fileRepository/api/test/uploadFile.test.d.ts +2 -0
- package/dist/fileRepository/api/test/uploadFile.test.d.ts.map +1 -0
- package/dist/fileRepository/api/test/uploadImage.test.d.ts +2 -0
- package/dist/fileRepository/api/test/uploadImage.test.d.ts.map +1 -0
- package/dist/fileRepository/api/test/uploadVideo.test.d.ts +2 -0
- package/dist/fileRepository/api/test/uploadVideo.test.d.ts.map +1 -0
- package/dist/fileRepository/api/{createFile.d.ts → uploadFile.d.ts} +4 -4
- package/dist/fileRepository/api/uploadFile.d.ts.map +1 -0
- package/dist/fileRepository/api/{createImage.d.ts → uploadImage.d.ts} +4 -4
- package/dist/fileRepository/api/uploadImage.d.ts.map +1 -0
- package/dist/fileRepository/api/{createVideo.d.ts → uploadVideo.d.ts} +5 -5
- package/dist/fileRepository/api/uploadVideo.d.ts.map +1 -0
- package/dist/index.cjs.js +657 -170
- package/dist/index.esm.js +657 -170
- package/dist/index.umd.js +4 -4
- package/dist/messageRepository/api/createMessage.d.ts +1 -1
- package/dist/messageRepository/api/editMessage.d.ts +38 -0
- package/dist/messageRepository/api/editMessage.d.ts.map +1 -0
- package/dist/messageRepository/api/flagMessage.d.ts +14 -0
- package/dist/messageRepository/api/flagMessage.d.ts.map +1 -0
- package/dist/messageRepository/api/index.d.ts +5 -1
- package/dist/messageRepository/api/index.d.ts.map +1 -1
- package/dist/messageRepository/api/isMessageFlaggedByMe.d.ts +14 -0
- package/dist/messageRepository/api/isMessageFlaggedByMe.d.ts.map +1 -0
- package/dist/messageRepository/api/{deleteMessage.d.ts → softDeleteMessage.d.ts} +6 -6
- package/dist/messageRepository/api/softDeleteMessage.d.ts.map +1 -0
- package/dist/messageRepository/api/tests/editMessage.test.d.ts +2 -0
- package/dist/messageRepository/api/tests/editMessage.test.d.ts.map +1 -0
- package/dist/messageRepository/api/tests/flagMessage.test.d.ts +2 -0
- package/dist/messageRepository/api/tests/flagMessage.test.d.ts.map +1 -0
- package/dist/messageRepository/api/tests/unflagMessage.test.d.ts +2 -0
- package/dist/messageRepository/api/tests/unflagMessage.test.d.ts.map +1 -0
- package/dist/messageRepository/api/unflagMessage.d.ts +14 -0
- package/dist/messageRepository/api/unflagMessage.d.ts.map +1 -0
- package/dist/messageRepository/api/updateMessage.d.ts.map +1 -1
- package/dist/postRepository/api/deletePost.d.ts +1 -1
- package/dist/postRepository/api/deletePost.d.ts.map +1 -1
- package/dist/postRepository/api/editPost.d.ts +24 -0
- package/dist/postRepository/api/editPost.d.ts.map +1 -0
- package/dist/postRepository/api/flagPost.d.ts +14 -0
- package/dist/postRepository/api/flagPost.d.ts.map +1 -0
- package/dist/postRepository/api/hardDeletePost.d.ts +16 -0
- package/dist/postRepository/api/hardDeletePost.d.ts.map +1 -0
- package/dist/postRepository/api/index.d.ts +6 -0
- package/dist/postRepository/api/index.d.ts.map +1 -1
- package/dist/postRepository/api/isPostFlaggedByMe.d.ts +14 -0
- package/dist/postRepository/api/isPostFlaggedByMe.d.ts.map +1 -0
- package/dist/postRepository/api/softDeletePost.d.ts +16 -0
- package/dist/postRepository/api/softDeletePost.d.ts.map +1 -0
- package/dist/postRepository/api/unflagPost.d.ts +14 -0
- package/dist/postRepository/api/unflagPost.d.ts.map +1 -0
- package/dist/postRepository/api/updatePost.d.ts.map +1 -1
- package/dist/userRepository/api/flagUser.d.ts +14 -0
- package/dist/userRepository/api/flagUser.d.ts.map +1 -0
- package/dist/userRepository/api/index.d.ts +3 -0
- package/dist/userRepository/api/index.d.ts.map +1 -1
- package/dist/userRepository/api/isUserFlaggedByMe.d.ts +14 -0
- package/dist/userRepository/api/isUserFlaggedByMe.d.ts.map +1 -0
- package/dist/userRepository/api/tests/flagUser.test.d.ts +2 -0
- package/dist/userRepository/api/tests/flagUser.test.d.ts.map +1 -0
- package/dist/userRepository/api/tests/unflagUser.test.d.ts +2 -0
- package/dist/userRepository/api/tests/unflagUser.test.d.ts.map +1 -0
- package/dist/userRepository/api/unflagUser.d.ts +14 -0
- package/dist/userRepository/api/unflagUser.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/@types/domains/channel.ts +7 -2
- package/src/categoryRepository/observers/getCategories.ts +1 -1
- package/src/channelRepsitory/channelMembership/observers/getMembers.ts +1 -1
- package/src/channelRepsitory/observers/getChannels.ts +1 -1
- package/src/channelRepsitory/observers/tests/getChannels.test.ts +3 -9
- package/src/commentRepository/observers/getComments.ts +4 -4
- package/src/communityRepository/communityMembership/api/index.ts +2 -0
- package/src/communityRepository/{communityModeration/api/test → communityMembership/api/tests}/addMembers.test.ts +1 -1
- package/src/communityRepository/{communityModeration/api/test → communityMembership/api/tests}/removeMembers.test.ts +1 -1
- package/src/communityRepository/communityMembership/index.ts +1 -0
- package/src/communityRepository/communityMembership/observers/getMembers.ts +1 -1
- package/src/communityRepository/communityModeration/api/index.ts +0 -3
- package/src/communityRepository/observers/getCommunities.ts +1 -1
- package/src/core/query/tests/runQuery.test.ts +3 -3
- package/src/feedRepository/api/index.ts +1 -0
- package/src/fileRepository/api/index.ts +3 -3
- package/src/fileRepository/api/test/uploadFile.test.ts +69 -0
- package/src/fileRepository/api/test/{createImage.test.ts → uploadImage.test.ts} +7 -7
- package/src/fileRepository/api/test/{createVideo.test.ts → uploadVideo.test.ts} +8 -8
- package/src/fileRepository/api/{createFile.ts → uploadFile.ts} +4 -6
- package/src/fileRepository/api/{createImage.ts → uploadImage.ts} +4 -6
- package/src/fileRepository/api/{createVideo.ts → uploadVideo.ts} +5 -7
- package/src/messageRepository/api/editMessage.ts +100 -0
- package/src/messageRepository/api/flagMessage.ts +40 -0
- package/src/messageRepository/api/index.ts +7 -1
- package/src/messageRepository/api/isMessageFlaggedByMe.ts +30 -0
- package/src/messageRepository/api/{deleteMessage.ts → softDeleteMessage.ts} +8 -8
- package/src/messageRepository/api/tests/deleteMessage.test.ts +11 -11
- package/src/messageRepository/api/tests/{updateMessage.test.ts → editMessage.test.ts} +10 -10
- package/src/messageRepository/api/tests/flagMessage.test.ts +87 -0
- package/src/messageRepository/api/tests/unflagMessage.test.ts +87 -0
- package/src/messageRepository/api/unflagMessage.ts +40 -0
- package/src/messageRepository/api/updateMessage.ts +4 -0
- package/src/messageRepository/observers/getMessages.ts +4 -4
- package/src/postRepository/api/deletePost.ts +1 -7
- package/src/postRepository/api/editPost.ts +58 -0
- package/src/postRepository/api/flagPost.ts +38 -0
- package/src/postRepository/api/hardDeletePost.ts +30 -0
- package/src/postRepository/api/index.ts +8 -0
- package/src/postRepository/api/isPostFlaggedByMe.ts +33 -0
- package/src/postRepository/api/softDeletePost.ts +30 -0
- package/src/postRepository/api/unflagPost.ts +39 -0
- package/src/postRepository/api/updatePost.ts +4 -0
- package/src/postRepository/observers/getPosts.ts +4 -4
- package/src/reactionRepository/observers/getReactions.ts +4 -4
- package/src/report/api/createReport.ts +1 -1
- package/src/report/api/tests/createReport.test.ts +2 -62
- package/src/report/api/tests/deleteReport.test.ts +2 -62
- package/src/userRepository/api/flagUser.ts +37 -0
- package/src/userRepository/api/index.ts +4 -0
- package/src/userRepository/api/isUserFlaggedByMe.ts +33 -0
- package/src/userRepository/api/tests/flagUser.test.ts +81 -0
- package/src/userRepository/api/tests/unflagUser.test.ts +80 -0
- package/src/userRepository/api/unflagUser.ts +37 -0
- package/src/userRepository/observers/getBlockedUsers.ts +4 -4
- package/src/userRepository/observers/getUsers.ts +1 -1
- package/src/userRepository/observers/tests/getUsers.test.ts +3 -9
- package/src/userRepository/relationship/follow/observers/getFollowers.ts +4 -4
- package/src/userRepository/relationship/follow/observers/getFollowings.ts +4 -4
- package/dist/communityRepository/communityModeration/api/test/addMembers.test.d.ts.map +0 -1
- package/dist/communityRepository/communityModeration/api/test/removeMembers.test.d.ts.map +0 -1
- package/dist/fileRepository/api/createFile.d.ts.map +0 -1
- package/dist/fileRepository/api/createImage.d.ts.map +0 -1
- package/dist/fileRepository/api/createVideo.d.ts.map +0 -1
- package/dist/fileRepository/api/test/createImage.test.d.ts +0 -2
- package/dist/fileRepository/api/test/createImage.test.d.ts.map +0 -1
- package/dist/fileRepository/api/test/createVideo.test.d.ts +0 -2
- package/dist/fileRepository/api/test/createVideo.test.d.ts.map +0 -1
- package/dist/messageRepository/api/deleteMessage.d.ts.map +0 -1
- package/dist/messageRepository/api/tests/updateMessage.test.d.ts +0 -2
- package/dist/messageRepository/api/tests/updateMessage.test.d.ts.map +0 -1
- /package/dist/communityRepository/{communityModeration → communityMembership}/api/addMembers.d.ts +0 -0
- /package/dist/communityRepository/{communityModeration → communityMembership}/api/removeMembers.d.ts +0 -0
- /package/dist/communityRepository/{communityModeration/api/test → communityMembership/api/tests}/addMembers.test.d.ts +0 -0
- /package/dist/communityRepository/{communityModeration/api/test → communityMembership/api/tests}/removeMembers.test.d.ts +0 -0
- /package/src/communityRepository/{communityModeration → communityMembership}/api/addMembers.ts +0 -0
- /package/src/communityRepository/{communityModeration → communityMembership}/api/removeMembers.ts +0 -0
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* @async
|
|
22
22
|
*/
|
|
23
23
|
export declare const createMessage: {
|
|
24
|
-
<T extends Amity.MessageContentType>(bundle: Pick<Amity.Message<T>, "
|
|
24
|
+
<T extends Amity.MessageContentType>(bundle: Pick<Amity.Message<T>, "metadata" | "tags" | "subChannelId" | "parentId" | "dataType" | "mentionees"> & {
|
|
25
25
|
data?: Amity.ContentData<T> | undefined;
|
|
26
26
|
fileId?: string | undefined;
|
|
27
27
|
referenceId?: string | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const updated = await MessageRepository.editMessage(messageId, {
|
|
5
|
+
* data: { text: 'hello world' }
|
|
6
|
+
* })
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* Updates an {@link Amity.Message}
|
|
10
|
+
*
|
|
11
|
+
* @param messageId The ID of the {@link Amity.Message} to edit
|
|
12
|
+
* @param patch The patch data to apply
|
|
13
|
+
* @returns the updated {@link Amity.Message} object
|
|
14
|
+
*
|
|
15
|
+
* @category Message API
|
|
16
|
+
* @async
|
|
17
|
+
*/
|
|
18
|
+
export declare const editMessage: {
|
|
19
|
+
(messageId: Amity.Message['messageId'], patch: Patch<Amity.Message, 'data' | 'tags' | 'metadata' | 'mentionees'>): Promise<Amity.Cached<Amity.Message>>;
|
|
20
|
+
/**
|
|
21
|
+
* ```js
|
|
22
|
+
* import { editMessage } from '@amityco/ts-sdk'
|
|
23
|
+
* const updated = editMessage.optimistically('foobar', {
|
|
24
|
+
* data: { text: 'hello world' }
|
|
25
|
+
* })
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Updates an {@link Amity.Message} in cache
|
|
29
|
+
*
|
|
30
|
+
* @param messageId The ID of the {@link Amity.Message} to edit
|
|
31
|
+
* @param patch The patch data to apply
|
|
32
|
+
* @returns the updated {@link Amity.Message} object
|
|
33
|
+
*
|
|
34
|
+
* @category Message API
|
|
35
|
+
*/
|
|
36
|
+
optimistically(messageId: Amity.Message['messageId'], patch: Patch<Amity.Message, 'data' | 'tags' | 'metadata' | 'mentionees'>): Amity.Cached<Amity.Message> | undefined;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=editMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/editMessage.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW;gBACX,MAAM,OAAO,CAAC,WAAW,CAAC,SAC9B,MAAM,MAAM,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC,GACvE,QAAQ,MAAM,MAAM,CAAC,MAAM,OAAO,CAAC,CAAC;IAwBvC;;;;;;;;;;;;;;;OAeG;8BAEU,MAAM,OAAO,CAAC,WAAW,CAAC,SAC9B,MAAM,MAAM,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC,GACvE,MAAM,MAAM,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS;CArBzC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const flagged = await MessageRepository.flagMessage(messageId)
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* @param messageId of the message to flag
|
|
8
|
+
* @returns the created report result
|
|
9
|
+
*
|
|
10
|
+
* @category Message API
|
|
11
|
+
* @async
|
|
12
|
+
* */
|
|
13
|
+
export declare const flagMessage: (messageId: Amity.Message['messageId']) => Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=flagMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/flagMessage.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,WAAW,cAAqB,MAAM,OAAO,CAAC,WAAW,CAAC,KAAG,QAAQ,OAAO,CAgBxF,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export { getMessages as getMessageByIds } from './getMessages';
|
|
2
2
|
export * from './createMessage';
|
|
3
3
|
export * from './updateMessage';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './editMessage';
|
|
5
|
+
export * from './softDeleteMessage';
|
|
5
6
|
export * from './markAsDelivered';
|
|
6
7
|
export * from './getReadUsers';
|
|
7
8
|
export * from './getDeliveredUsers';
|
|
9
|
+
export * from './flagMessage';
|
|
10
|
+
export * from './unflagMessage';
|
|
11
|
+
export * from './isMessageFlaggedByMe';
|
|
8
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAE/D,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAE/D,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const isReportedByMe = await MessageRepository.isMessageFlaggedByMe(messageId)
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* @param messageId of the message to check a report of.
|
|
8
|
+
* @returns `true` if the report is created by me, `false` if doesn't.
|
|
9
|
+
*
|
|
10
|
+
* @category Report API
|
|
11
|
+
* @async
|
|
12
|
+
* */
|
|
13
|
+
export declare const isMessageFlaggedByMe: (messageId: Amity.Message['messageId']) => Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=isMessageFlaggedByMe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isMessageFlaggedByMe.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/isMessageFlaggedByMe.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,oBAAoB,cACpB,MAAM,OAAO,CAAC,WAAW,CAAC,KACpC,QAAQ,OAAO,CASjB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ```js
|
|
3
|
-
* import {
|
|
4
|
-
* const success = await
|
|
3
|
+
* import { softDeleteMessage } from '@amityco/ts-sdk'
|
|
4
|
+
* const success = await softDeleteMessage('foobar')
|
|
5
5
|
* ```
|
|
6
6
|
*
|
|
7
7
|
* Delete a {@link Amity.Message}
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
* @category Message API
|
|
13
13
|
* @async
|
|
14
14
|
*/
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const softDeleteMessage: {
|
|
16
16
|
(messageId: Amity.Message['messageId']): Promise<Amity.Message>;
|
|
17
17
|
/**
|
|
18
18
|
* ```js
|
|
19
|
-
* import {
|
|
20
|
-
* const success =
|
|
19
|
+
* import { softDeleteMessage } from '@amityco/ts-sdk'
|
|
20
|
+
* const success = softDeleteMessage.optimistically('foobar')
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
23
23
|
* Deletes a {@link Amity.Message}
|
|
@@ -29,4 +29,4 @@ export declare const deleteMessage: {
|
|
|
29
29
|
*/
|
|
30
30
|
optimistically(messageId: Amity.Message['messageId']): Amity.Cached<Amity.Message> | undefined;
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=
|
|
32
|
+
//# sourceMappingURL=softDeleteMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"softDeleteMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/softDeleteMessage.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB;gBACjB,MAAM,OAAO,CAAC,WAAW,CAAC,GACpC,QAAQ,MAAM,OAAO,CAAC;IAgBzB;;;;;;;;;;;;OAYG;8BAEU,MAAM,OAAO,CAAC,WAAW,CAAC,GACpC,MAAM,MAAM,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS;CAjBzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editMessage.test.d.ts","sourceRoot":"","sources":["../../../../src/messageRepository/api/tests/editMessage.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagMessage.test.d.ts","sourceRoot":"","sources":["../../../../src/messageRepository/api/tests/flagMessage.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unflagMessage.test.d.ts","sourceRoot":"","sources":["../../../../src/messageRepository/api/tests/unflagMessage.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const unflagged = await MessageRepository.unflag(messageId)
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* @param messageId of the message to unflag
|
|
8
|
+
* @returns boolean to indicate success
|
|
9
|
+
*
|
|
10
|
+
* @category Report API
|
|
11
|
+
* @async
|
|
12
|
+
* */
|
|
13
|
+
export declare const unflagMessage: (messageId: Amity.Message['messageId']) => Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=unflagMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unflagMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/unflagMessage.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,aAAa,cAAqB,MAAM,OAAO,CAAC,WAAW,CAAC,KAAG,QAAQ,OAAO,CAgB1F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/updateMessage.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa;gBACb,MAAM,OAAO,CAAC,WAAW,CAAC,SAC9B,MAAM,MAAM,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC,GACvE,QAAQ,MAAM,MAAM,CAAC,MAAM,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"updateMessage.d.ts","sourceRoot":"","sources":["../../../src/messageRepository/api/updateMessage.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa;gBACb,MAAM,OAAO,CAAC,WAAW,CAAC,SAC9B,MAAM,MAAM,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC,GACvE,QAAQ,MAAM,MAAM,CAAC,MAAM,OAAO,CAAC,CAAC;IA4BvC;;;;;;;;;;;;;;;OAeG;8BAEU,MAAM,OAAO,CAAC,WAAW,CAAC,SAC9B,MAAM,MAAM,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC,GACvE,MAAM,MAAM,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS;CArBzC,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @param postId The {@link Amity.Post} ID to delete
|
|
10
10
|
* @return A success boolean if the {@link Amity.Post} was deleted
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
12
|
+
* @private
|
|
13
13
|
* @async
|
|
14
14
|
*/
|
|
15
15
|
export declare const deletePost: (postId: Amity.Post['postId'], permanent?: boolean) => Promise<Amity.Post>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deletePost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/deletePost.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deletePost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/deletePost.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,WACb,MAAM,IAAI,CAAC,QAAQ,CAAC,0BAE3B,QAAQ,MAAM,IAAI,CAoDpB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const updated = await PostRepository.editPost(postId, {
|
|
5
|
+
* data: { text: 'hello world' }
|
|
6
|
+
* })
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* Updates an {@link Amity.Post}
|
|
10
|
+
*
|
|
11
|
+
* @param postId The ID of the {@link Amity.Post} to edit
|
|
12
|
+
* @param patch The patch data to apply
|
|
13
|
+
* @returns the updated {@link Amity.Post} object
|
|
14
|
+
*
|
|
15
|
+
* @category Post API
|
|
16
|
+
* @async
|
|
17
|
+
*/
|
|
18
|
+
export declare const editPost: <T extends Amity.PostContentType>(postId: Amity.Post['postId'], patch: Partial<Pick<Amity.Post<any>, "data" | "metadata" | "mentionees" | "tags">> & {
|
|
19
|
+
attachments?: {
|
|
20
|
+
type: T;
|
|
21
|
+
fileId: Amity.File['fileId'];
|
|
22
|
+
}[] | undefined;
|
|
23
|
+
}) => Promise<Amity.Cached<Amity.Post>>;
|
|
24
|
+
//# sourceMappingURL=editPost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/editPost.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,4CACX,MAAM,IAAI,CAAC,QAAQ,CAAC;;;gBAIhB,UAAU,CAAC,QAAQ,CAAC;;MAG/B,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CAsBlC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const flagged = await PostRepository.flagPost(postId)
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* @param postId of the post to flag
|
|
8
|
+
* @returns a boolean
|
|
9
|
+
*
|
|
10
|
+
* @category Post API
|
|
11
|
+
* @async
|
|
12
|
+
* */
|
|
13
|
+
export declare const flagPost: (postId: Amity.Post['postId']) => Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=flagPost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/flagPost.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,QAAQ,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,OAAO,CAe5E,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { hardDeletePost } from '@amityco/ts-sdk'
|
|
4
|
+
* const success = await hardDeletePost('foobar')
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* Hard deletes a {@link Amity.Post}
|
|
8
|
+
*
|
|
9
|
+
* @param postId The {@link Amity.Post} ID to be hard delete
|
|
10
|
+
* @return A success boolean if the {@link Amity.Post} was deleted
|
|
11
|
+
*
|
|
12
|
+
* @category Post API
|
|
13
|
+
* @async
|
|
14
|
+
*/
|
|
15
|
+
export declare const hardDeletePost: (postId: Amity.Post['postId']) => Promise<Amity.Post>;
|
|
16
|
+
//# sourceMappingURL=hardDeletePost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hardDeletePost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/hardDeletePost.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,MAAM,IAAI,CAOrF,CAAC"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export * from './getPostByIds';
|
|
2
2
|
export * from './createPost';
|
|
3
3
|
export * from './updatePost';
|
|
4
|
+
export * from './editPost';
|
|
4
5
|
export * from './deletePost';
|
|
6
|
+
export * from './softDeletePost';
|
|
7
|
+
export * from './hardDeletePost';
|
|
5
8
|
export * from './approvePost';
|
|
6
9
|
export * from './declinePost';
|
|
10
|
+
export * from './flagPost';
|
|
11
|
+
export * from './unflagPost';
|
|
12
|
+
export * from './isPostFlaggedByMe';
|
|
7
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAE9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const isReported = await PostRepository.isPostFlaggedByMe('post', postId)
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* @param postId of the post to check if flagged by current user
|
|
8
|
+
* @returns `true` if the post is flagged by me, `false` if doesn't.
|
|
9
|
+
*
|
|
10
|
+
* @category Post API
|
|
11
|
+
* @async
|
|
12
|
+
* */
|
|
13
|
+
export declare const isPostFlaggedByMe: (postId: Amity.Post['postId']) => Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=isPostFlaggedByMe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPostFlaggedByMe.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/isPostFlaggedByMe.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,iBAAiB,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,OAAO,CAarF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const success = await PostRepository.softDeletePost('foobar')
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* Soft deletes a {@link Amity.Post}
|
|
8
|
+
*
|
|
9
|
+
* @param postId The {@link Amity.Post} ID to soft delete
|
|
10
|
+
* @return A success boolean if the {@link Amity.Post} was deleted
|
|
11
|
+
*
|
|
12
|
+
* @category Post API
|
|
13
|
+
* @async
|
|
14
|
+
*/
|
|
15
|
+
export declare const softDeletePost: (postId: Amity.Post['postId']) => Promise<Amity.Post>;
|
|
16
|
+
//# sourceMappingURL=softDeletePost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"softDeletePost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/softDeletePost.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,MAAM,IAAI,CAOrF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const unflagged = await PostRepository.unflagPost(postId)
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* @param postId of the post to unflag
|
|
8
|
+
* @returns the unflag post result
|
|
9
|
+
*
|
|
10
|
+
* @category Post API
|
|
11
|
+
* @async
|
|
12
|
+
* */
|
|
13
|
+
export declare const unflagPost: (postId: Amity.Post['postId']) => Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=unflagPost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unflagPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/unflagPost.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,UAAU,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,OAAO,CAe9E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updatePost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/updatePost.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,UAAU,4CACb,MAAM,IAAI,CAAC,QAAQ,CAAC;;;gBAIhB,UAAU,CAAC,QAAQ,CAAC;;MAG/B,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"updatePost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/updatePost.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,UAAU,4CACb,MAAM,IAAI,CAAC,QAAQ,CAAC;;;gBAIhB,UAAU,CAAC,QAAQ,CAAC;;MAG/B,QAAQ,MAAM,MAAM,CAAC,MAAM,IAAI,CAAC,CA0BlC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const flagged = await UserRepository.flagUser('userId')
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* @param userId The ID of the user to add a be flagged
|
|
8
|
+
* @returns the created report result
|
|
9
|
+
*
|
|
10
|
+
* @category User API
|
|
11
|
+
* @async
|
|
12
|
+
* */
|
|
13
|
+
export declare const flagUser: (userId: Amity.User['userId']) => Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=flagUser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagUser.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/flagUser.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,QAAQ,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,OAAO,CAe5E,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { getUserByIds } from './getUserByIds';
|
|
2
2
|
export { updateUser } from './updateUser';
|
|
3
|
+
export { flagUser } from './flagUser';
|
|
4
|
+
export { unflagUser } from './unflagUser';
|
|
5
|
+
export { isUserFlaggedByMe } from './isUserFlaggedByMe';
|
|
3
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const isFlagged = await UserRepository.isUserFlaggedByMe('post', postId)
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* @param userId The ID of the thing to check a report to.
|
|
8
|
+
* @returns `true` if the report is created by me, `false` if doesn't.
|
|
9
|
+
*
|
|
10
|
+
* @category Report API
|
|
11
|
+
* @async
|
|
12
|
+
* */
|
|
13
|
+
export declare const isUserFlaggedByMe: (userId: Amity.User['userId']) => Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=isUserFlaggedByMe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUserFlaggedByMe.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/isUserFlaggedByMe.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,iBAAiB,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,OAAO,CAarF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flagUser.test.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/api/tests/flagUser.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unflagUser.test.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/api/tests/unflagUser.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
4
|
+
* const unflagged = await UserRepository.unflagUser('post', postId)
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* @param userId The ID of the user to unflag
|
|
8
|
+
* @returns the deleted report result
|
|
9
|
+
*
|
|
10
|
+
* @category User API
|
|
11
|
+
* @async
|
|
12
|
+
* */
|
|
13
|
+
export declare const unflagUser: (userId: Amity.User['userId']) => Promise<boolean>;
|
|
14
|
+
//# sourceMappingURL=unflagUser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unflagUser.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/unflagUser.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,UAAU,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,OAAO,CAe9E,CAAC"}
|
package/package.json
CHANGED
|
@@ -45,7 +45,7 @@ declare global {
|
|
|
45
45
|
autoDeleteMessageByFlagLimit?: number;
|
|
46
46
|
|
|
47
47
|
memberCount?: number;
|
|
48
|
-
messageCount: number;
|
|
48
|
+
messageCount: number;
|
|
49
49
|
moderatorMemberCount?: number;
|
|
50
50
|
|
|
51
51
|
lastActivity: Amity.timestamp;
|
|
@@ -55,10 +55,15 @@ declare global {
|
|
|
55
55
|
Amity.SoftDelete &
|
|
56
56
|
Amity.Subscribable;
|
|
57
57
|
|
|
58
|
-
type Channel<T extends ChannelType = any> = RawChannel<T> & {
|
|
58
|
+
type Channel<T extends ChannelType = any> = Omit<RawChannel<T>, 'messageCount'> & {
|
|
59
59
|
defaultSubChannelId: string;
|
|
60
60
|
isUnreadCountSupport: boolean;
|
|
61
61
|
unreadCount: number;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated Please use the default sub channel `messageCount` instead.
|
|
65
|
+
*/
|
|
66
|
+
messageCount: RawChannel['messageCount'];
|
|
62
67
|
};
|
|
63
68
|
|
|
64
69
|
type QueryChannels = {
|
|
@@ -79,17 +79,11 @@ describe('getChannels', () => {
|
|
|
79
79
|
getChannels({}, callback);
|
|
80
80
|
await pause();
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
// The second `getChannels` call fetches data from the cache,
|
|
83
|
+
// so there is no loading state and the callback only fires once.
|
|
84
|
+
expect(callback).toHaveBeenCalledTimes(1);
|
|
83
85
|
expect(callback).toHaveBeenNthCalledWith(
|
|
84
86
|
1,
|
|
85
|
-
expect.objectContaining(
|
|
86
|
-
getSnapshot({
|
|
87
|
-
data: convertRawChannelPayload(channelQueryResponse.data).channels,
|
|
88
|
-
}),
|
|
89
|
-
),
|
|
90
|
-
);
|
|
91
|
-
expect(callback).toHaveBeenNthCalledWith(
|
|
92
|
-
2,
|
|
93
87
|
expect.objectContaining(
|
|
94
88
|
getSnapshot({
|
|
95
89
|
data: convertRawChannelPayload(channelQueryResponse.data).channels,
|
|
@@ -123,16 +123,16 @@ export const getComments = (
|
|
|
123
123
|
responder(collection);
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
const onFetch = () => {
|
|
126
|
+
const onFetch = (initial = false) => {
|
|
127
127
|
const collection = pullFromCache<Amity.CommentLiveCollectionCache>(cacheKey)?.data;
|
|
128
128
|
|
|
129
129
|
const comments = collection?.data ?? [];
|
|
130
130
|
|
|
131
|
-
if (comments.length > 0 && !collection?.params?.page) return;
|
|
131
|
+
if (!initial && comments.length > 0 && !collection?.params?.page) return;
|
|
132
132
|
|
|
133
133
|
const query = createQuery(queryComments, {
|
|
134
134
|
...queryParams,
|
|
135
|
-
page: collection?.params
|
|
135
|
+
page: (!initial ? collection?.params.page : undefined) ?? { limit },
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
runQuery(
|
|
@@ -170,7 +170,7 @@ export const getComments = (
|
|
|
170
170
|
onCommentReactionRemoved(realtimeRouter('onReactionRemoved')),
|
|
171
171
|
);
|
|
172
172
|
|
|
173
|
-
onFetch();
|
|
173
|
+
onFetch(true);
|
|
174
174
|
|
|
175
175
|
return () => {
|
|
176
176
|
log(`getComments(tmpid: ${timestamp}) > dispose`);
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
user11,
|
|
11
11
|
} from '~/utils/tests';
|
|
12
12
|
|
|
13
|
-
import { onCommunityUserAdded } from '
|
|
13
|
+
import { onCommunityUserAdded } from '../../events';
|
|
14
14
|
import { addMembers } from '../addMembers';
|
|
15
15
|
|
|
16
16
|
const communityToAddUserTo = community11;
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
disconnectClient,
|
|
11
11
|
} from '~/utils/tests';
|
|
12
12
|
|
|
13
|
-
import { onCommunityUserRemoved } from '
|
|
13
|
+
import { onCommunityUserRemoved } from '../../events';
|
|
14
14
|
import { removeMembers } from '../removeMembers';
|
|
15
15
|
|
|
16
16
|
const communityToRemoveUser = community11;
|
|
@@ -134,7 +134,7 @@ export const getMembers = (
|
|
|
134
134
|
|
|
135
135
|
const query = createQuery(queryCommunityMembers, {
|
|
136
136
|
...queryParams,
|
|
137
|
-
page: collection?.params.page ?? { limit },
|
|
137
|
+
page: (!initial ? collection?.params.page : undefined) ?? { limit },
|
|
138
138
|
});
|
|
139
139
|
|
|
140
140
|
runQuery(
|