@amityco/ts-sdk 0.0.1-beta.32 → 0.0.1-beta.33

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.
Files changed (50) hide show
  1. package/dist/cache/api/ingestInCache.d.ts +1 -1
  2. package/dist/cache/api/tests/ingestInCache.test.d.ts +2 -0
  3. package/dist/cache/api/tests/ingestInCache.test.d.ts.map +1 -0
  4. package/dist/core/model/idResolvers.d.ts.map +1 -1
  5. package/dist/index.cjs.js +26 -6
  6. package/dist/index.esm.js +26 -6
  7. package/dist/index.umd.js +1 -1
  8. package/dist/reaction/api/addReaction.d.ts.map +1 -1
  9. package/dist/reaction/api/removeReaction.d.ts.map +1 -1
  10. package/dist/utils/tests/dummy/channel.d.ts +6 -0
  11. package/dist/utils/tests/dummy/channel.d.ts.map +1 -1
  12. package/dist/utils/tests/dummy/community.d.ts +4 -0
  13. package/dist/utils/tests/dummy/community.d.ts.map +1 -0
  14. package/dist/utils/tests/dummy/file.d.ts +2 -0
  15. package/dist/utils/tests/dummy/file.d.ts.map +1 -0
  16. package/dist/utils/tests/dummy/follow.d.ts +1 -0
  17. package/dist/utils/tests/dummy/follow.d.ts.map +1 -1
  18. package/dist/utils/tests/dummy/index.d.ts +5 -0
  19. package/dist/utils/tests/dummy/index.d.ts.map +1 -1
  20. package/dist/utils/tests/dummy/message.d.ts +5 -0
  21. package/dist/utils/tests/dummy/message.d.ts.map +1 -1
  22. package/dist/utils/tests/dummy/poll.d.ts +3 -0
  23. package/dist/utils/tests/dummy/poll.d.ts.map +1 -0
  24. package/dist/utils/tests/dummy/post.d.ts +3 -0
  25. package/dist/utils/tests/dummy/post.d.ts.map +1 -1
  26. package/dist/utils/tests/dummy/reaction.d.ts +4 -0
  27. package/dist/utils/tests/dummy/reaction.d.ts.map +1 -0
  28. package/dist/utils/tests/dummy/role.d.ts +4 -0
  29. package/dist/utils/tests/dummy/role.d.ts.map +1 -0
  30. package/dist/utils/tests/dummy/user.d.ts +1 -0
  31. package/dist/utils/tests/dummy/user.d.ts.map +1 -1
  32. package/package.json +1 -1
  33. package/src/cache/api/ingestInCache.ts +2 -2
  34. package/src/cache/api/tests/ingestInCache.test.ts +87 -0
  35. package/src/core/model/idResolvers.ts +1 -1
  36. package/src/reaction/api/addReaction.ts +17 -3
  37. package/src/reaction/api/removeReaction.ts +17 -3
  38. package/src/reaction/api/tests/addReaction.test.ts +42 -6
  39. package/src/reaction/api/tests/removeReaction.test.ts +49 -13
  40. package/src/utils/tests/dummy/channel.ts +9 -1
  41. package/src/utils/tests/dummy/community.ts +44 -0
  42. package/src/utils/tests/dummy/file.ts +20 -0
  43. package/src/utils/tests/dummy/follow.ts +6 -0
  44. package/src/utils/tests/dummy/index.ts +9 -0
  45. package/src/utils/tests/dummy/message.ts +8 -1
  46. package/src/utils/tests/dummy/poll.ts +43 -0
  47. package/src/utils/tests/dummy/post.ts +39 -1
  48. package/src/utils/tests/dummy/reaction.ts +22 -0
  49. package/src/utils/tests/dummy/role.ts +21 -0
  50. package/src/utils/tests/dummy/user.ts +6 -0
@@ -1,4 +1,4 @@
1
- import { date, channel11, user11 } from '.';
1
+ import { date, channel11, user11, file11 } from '.';
2
2
 
3
3
  export const message11: Amity.Message = {
4
4
  fileId: null,
@@ -33,3 +33,10 @@ export const messageQueryResponse = {
33
33
  },
34
34
  },
35
35
  };
36
+
37
+ // for testing ingest in cache
38
+ export const messagePayload = {
39
+ messages: [message11],
40
+ files: [file11],
41
+ users: [user11],
42
+ };
@@ -0,0 +1,43 @@
1
+ import { user11 } from '.';
2
+
3
+ export const poll11: Amity.Poll = {
4
+ pollId: 'c7b7c3e52be052be3fd5b5f0b4033d501667195535489',
5
+ userId: 'test',
6
+ question: 'Yellow',
7
+ answers: [
8
+ {
9
+ dataType: 'text',
10
+ data: '1',
11
+ isVotedByUser: false,
12
+ voteCount: 0,
13
+ id: '635f628f651eeb361624a8b6',
14
+ },
15
+ {
16
+ dataType: 'text',
17
+ data: '2',
18
+ isVotedByUser: false,
19
+ voteCount: 0,
20
+ id: '635f628f651eeb619424a8b7',
21
+ },
22
+ {
23
+ dataType: 'text',
24
+ data: '3',
25
+ isVotedByUser: false,
26
+ voteCount: 0,
27
+ id: '635f628f651eeb391f24a8b8',
28
+ },
29
+ ],
30
+ answerType: 'single',
31
+ closedAt: '2022-11-30T05:52:15.489Z',
32
+ createdAt: '2022-10-31T05:52:15.493Z',
33
+ updatedAt: '2022-10-31T05:52:15.493Z',
34
+ isVoted: false,
35
+ status: 'open',
36
+ closedIn: 2592000000,
37
+ isDeleted: false,
38
+ };
39
+
40
+ export const pollPayload: Amity.PollPayload = {
41
+ polls: [poll11],
42
+ users: [user11],
43
+ };
@@ -1,5 +1,5 @@
1
+ import { user11, file11, communityUser11, date } from '.';
1
2
  import { encodeJson } from '..';
2
- import { user11, date } from '.';
3
3
 
4
4
  export const post11: Amity.Post = {
5
5
  path: '',
@@ -23,6 +23,31 @@ export const post11: Amity.Post = {
23
23
  postedUserId: user11.userId,
24
24
  };
25
25
 
26
+ export const comment11: Amity.Comment = {
27
+ path: '',
28
+ referenceType: 'post',
29
+ dataType: 'text',
30
+ rootId: 'test',
31
+ data: {
32
+ text: 'yellow new world',
33
+ },
34
+ childrenNumber: 0,
35
+ isDeleted: false,
36
+ editedAt: '2022-10-31T05:57:45.661Z',
37
+ updatedAt: '2022-10-31T05:57:45.670Z',
38
+ createdAt: '2022-10-31T05:57:45.661Z',
39
+ segmentNumber: 2,
40
+ commentId: 'comment11',
41
+ userId: 'test',
42
+ referenceId: post11.postId,
43
+ flagCount: 0,
44
+ hashFlag: null,
45
+ children: [],
46
+ mentionees: [],
47
+ reactions: {},
48
+ reactionsCount: 0,
49
+ };
50
+
26
51
  export const post12: Amity.Post = {
27
52
  ...post11,
28
53
  postId: 'post12',
@@ -41,6 +66,19 @@ export const posts = {
41
66
  page3: ['postId31', 'postId32', 'postId33'],
42
67
  };
43
68
 
69
+ export const commentPayload: Amity.CommentPayload = {
70
+ comments: [comment11],
71
+ users: [user11],
72
+ };
73
+
74
+ export const postPayload: Amity.PostPayload = {
75
+ posts: [post11],
76
+ users: [user11],
77
+ files: [file11],
78
+ comments: [comment11],
79
+ communityUsers: [],
80
+ };
81
+
44
82
  const nextPage = encodeJson({ before: post13.postId, limit: 10 });
45
83
 
46
84
  export const postQueryResponse = {
@@ -0,0 +1,22 @@
1
+ import { post11, user11 } from '.';
2
+
3
+ export const reaction11: Amity.Reaction = {
4
+ reactionName: 'reaction11',
5
+ reactionId: 'reaction11',
6
+ referenceId: post11.postId,
7
+ referenceType: 'post',
8
+ userId: user11.userId,
9
+ createdAt: '',
10
+ };
11
+
12
+ export const reactor11: Amity.Reactor = {
13
+ reactionName: 'reaction11',
14
+ reactionId: 'reaction11',
15
+ userId: user11.userId,
16
+ createdAt: '',
17
+ };
18
+
19
+ export const reactionPayload: Amity.ReactionPayload = {
20
+ reactions: [{ ...reaction11, reactors: [reactor11] }],
21
+ users: [user11],
22
+ };
@@ -0,0 +1,21 @@
1
+ export const role11: Amity.Role = {
2
+ roleId: 'channel moderator',
3
+ displayName: 'channel moderator',
4
+ createdAt: '2022-10-31T04:03:56.786Z',
5
+ updatedAt: '2022-10-31T04:03:56.786Z',
6
+ permissions: [],
7
+ isDeleted: false,
8
+ };
9
+
10
+ export const role12: Amity.Role = {
11
+ roleId: 'test',
12
+ displayName: 'test',
13
+ createdAt: '2022-10-26T04:33:17.344Z',
14
+ updatedAt: '2022-10-26T04:33:17.344Z',
15
+ permissions: [],
16
+ isDeleted: false,
17
+ };
18
+
19
+ export const rolePayload: Amity.RolePayload = {
20
+ roles: [role11, role12],
21
+ };
@@ -35,3 +35,9 @@ export const userQueryResponse = {
35
35
  },
36
36
  },
37
37
  };
38
+
39
+ // user payload with file
40
+ export const userPayload: Amity.UserPayload = {
41
+ users: [user11, user12],
42
+ files: [{ fileId: 'test-file-id' } as Amity.File<'image'>],
43
+ };