@amityco/ts-sdk 7.4.1-b9f48528.0 → 7.4.1-c116567e.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.
Files changed (203) hide show
  1. package/dist/@types/core/events.d.ts +3 -0
  2. package/dist/@types/core/events.d.ts.map +1 -1
  3. package/dist/@types/core/model.d.ts +3 -1
  4. package/dist/@types/core/model.d.ts.map +1 -1
  5. package/dist/@types/core/payload.d.ts +11 -4
  6. package/dist/@types/core/payload.d.ts.map +1 -1
  7. package/dist/@types/domains/community.d.ts +8 -1
  8. package/dist/@types/domains/community.d.ts.map +1 -1
  9. package/dist/@types/domains/invitation.d.ts +72 -0
  10. package/dist/@types/domains/invitation.d.ts.map +1 -0
  11. package/dist/@types/index.d.ts +1 -0
  12. package/dist/@types/index.d.ts.map +1 -1
  13. package/dist/communityRepository/api/createCommunity.d.ts.map +1 -1
  14. package/dist/communityRepository/api/getCommunities.d.ts +1 -1
  15. package/dist/communityRepository/api/getCommunities.d.ts.map +1 -1
  16. package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
  17. package/dist/communityRepository/api/getRecommendedCommunities.d.ts +3 -1
  18. package/dist/communityRepository/api/getRecommendedCommunities.d.ts.map +1 -1
  19. package/dist/communityRepository/api/getTrendingCommunities.d.ts +3 -1
  20. package/dist/communityRepository/api/getTrendingCommunities.d.ts.map +1 -1
  21. package/dist/communityRepository/api/queryCommunities.d.ts.map +1 -1
  22. package/dist/communityRepository/api/updateCommunity.d.ts +2 -2
  23. package/dist/communityRepository/api/updateCommunity.d.ts.map +1 -1
  24. package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts +1 -1
  25. package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts.map +1 -1
  26. package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts +1 -1
  27. package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts.map +1 -1
  28. package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts +1 -1
  29. package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts.map +1 -1
  30. package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts +1 -1
  31. package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts.map +1 -1
  32. package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts +1 -1
  33. package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts.map +1 -1
  34. package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts +1 -1
  35. package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts.map +1 -1
  36. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts +1 -1
  37. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts.map +1 -1
  38. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts +1 -1
  39. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts.map +1 -1
  40. package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts +1 -1
  41. package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts.map +1 -1
  42. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts +1 -1
  43. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts.map +1 -1
  44. package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts +1 -1
  45. package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts.map +1 -1
  46. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts +1 -1
  47. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts.map +1 -1
  48. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts +1 -1
  49. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts.map +1 -1
  50. package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts +1 -1
  51. package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts.map +1 -1
  52. package/dist/communityRepository/communityMembership/events/utils.d.ts +2 -2
  53. package/dist/communityRepository/communityMembership/events/utils.d.ts.map +1 -1
  54. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts +2 -2
  55. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
  56. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts +2 -2
  57. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts.map +1 -1
  58. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts +1 -1
  59. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts.map +1 -1
  60. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts +1 -1
  61. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts.map +1 -1
  62. package/dist/communityRepository/events/onCommunityCreated.d.ts +1 -1
  63. package/dist/communityRepository/events/onCommunityCreated.d.ts.map +1 -1
  64. package/dist/communityRepository/events/onCommunityDeleted.d.ts +1 -1
  65. package/dist/communityRepository/events/onCommunityDeleted.d.ts.map +1 -1
  66. package/dist/communityRepository/events/onCommunityUpdated.d.ts +1 -1
  67. package/dist/communityRepository/events/onCommunityUpdated.d.ts.map +1 -1
  68. package/dist/communityRepository/events/utils.d.ts +1 -1
  69. package/dist/communityRepository/events/utils.d.ts.map +1 -1
  70. package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts +2 -2
  71. package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts.map +1 -1
  72. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts +2 -2
  73. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts.map +1 -1
  74. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts +2 -2
  75. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts.map +1 -1
  76. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts +2 -2
  77. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts.map +1 -1
  78. package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts +2 -2
  79. package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts.map +1 -1
  80. package/dist/communityRepository/utils/communityWithMembership.d.ts +1 -1
  81. package/dist/communityRepository/utils/communityWithMembership.d.ts.map +1 -1
  82. package/dist/communityRepository/utils/payload.d.ts +1 -1
  83. package/dist/communityRepository/utils/payload.d.ts.map +1 -1
  84. package/dist/core/events.d.ts +3 -3
  85. package/dist/core/events.d.ts.map +1 -1
  86. package/dist/core/model/idResolvers.d.ts.map +1 -1
  87. package/dist/core/model/index.d.ts.map +1 -1
  88. package/dist/index.cjs.js +2929 -2421
  89. package/dist/index.d.ts +1 -0
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.esm.js +2277 -1770
  92. package/dist/index.umd.js +4 -4
  93. package/dist/invitationRepository/events/index.d.ts +4 -0
  94. package/dist/invitationRepository/events/index.d.ts.map +1 -0
  95. package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts +17 -0
  96. package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts.map +1 -0
  97. package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts +17 -0
  98. package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts.map +1 -0
  99. package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts +17 -0
  100. package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts.map +1 -0
  101. package/dist/invitationRepository/index.d.ts +2 -0
  102. package/dist/invitationRepository/index.d.ts.map +1 -0
  103. package/dist/invitationRepository/internalApi/acceptInvitation.d.ts +16 -0
  104. package/dist/invitationRepository/internalApi/acceptInvitation.d.ts.map +1 -0
  105. package/dist/invitationRepository/internalApi/cancelInvitation.d.ts +16 -0
  106. package/dist/invitationRepository/internalApi/cancelInvitation.d.ts.map +1 -0
  107. package/dist/invitationRepository/internalApi/createInvitations.d.ts +21 -0
  108. package/dist/invitationRepository/internalApi/createInvitations.d.ts.map +1 -0
  109. package/dist/invitationRepository/internalApi/index.d.ts +5 -0
  110. package/dist/invitationRepository/internalApi/index.d.ts.map +1 -0
  111. package/dist/invitationRepository/internalApi/rejectInvitation.d.ts +16 -0
  112. package/dist/invitationRepository/internalApi/rejectInvitation.d.ts.map +1 -0
  113. package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts +14 -0
  114. package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts.map +1 -0
  115. package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts +5 -0
  116. package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts.map +1 -0
  117. package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts +15 -0
  118. package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts.map +1 -0
  119. package/dist/invitationRepository/observers/getInvitations/enums.d.ts +6 -0
  120. package/dist/invitationRepository/observers/getInvitations/enums.d.ts.map +1 -0
  121. package/dist/invitationRepository/observers/getInvitations.d.ts +12 -0
  122. package/dist/invitationRepository/observers/getInvitations.d.ts.map +1 -0
  123. package/dist/invitationRepository/utils/index.d.ts +2 -0
  124. package/dist/invitationRepository/utils/index.d.ts.map +1 -0
  125. package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts +2 -0
  126. package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts.map +1 -0
  127. package/dist/utils/linkedObject/communityLinkedObject.d.ts +2 -0
  128. package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +1 -0
  129. package/dist/utils/linkedObject/index.d.ts +2 -0
  130. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  131. package/dist/utils/linkedObject/invitationLinkedObject.d.ts +2 -0
  132. package/dist/utils/linkedObject/invitationLinkedObject.d.ts.map +1 -0
  133. package/dist/utils/tests/dummy/post.d.ts +3 -3
  134. package/package.json +1 -1
  135. package/src/@types/core/events.ts +4 -0
  136. package/src/@types/core/model.ts +5 -1
  137. package/src/@types/core/payload.ts +13 -4
  138. package/src/@types/domains/community.ts +15 -1
  139. package/src/@types/domains/invitation.ts +92 -0
  140. package/src/@types/index.ts +1 -0
  141. package/src/communityRepository/api/createCommunity.ts +2 -1
  142. package/src/communityRepository/api/getCommunities.ts +7 -2
  143. package/src/communityRepository/api/getCommunity.ts +4 -1
  144. package/src/communityRepository/api/getRecommendedCommunities.ts +11 -4
  145. package/src/communityRepository/api/getTrendingCommunities.ts +11 -4
  146. package/src/communityRepository/api/queryCommunities.ts +6 -1
  147. package/src/communityRepository/api/updateCommunity.ts +13 -3
  148. package/src/communityRepository/communityMembership/events/onCommunityJoined.ts +1 -1
  149. package/src/communityRepository/communityMembership/events/onCommunityLeft.ts +1 -1
  150. package/src/communityRepository/communityMembership/events/onCommunityUserAdded.ts +1 -1
  151. package/src/communityRepository/communityMembership/events/onCommunityUserBanned.ts +1 -1
  152. package/src/communityRepository/communityMembership/events/onCommunityUserChanged.ts +1 -1
  153. package/src/communityRepository/communityMembership/events/onCommunityUserRemoved.ts +1 -1
  154. package/src/communityRepository/communityMembership/events/onCommunityUserRoleAdded.ts +1 -1
  155. package/src/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.ts +1 -1
  156. package/src/communityRepository/communityMembership/events/onCommunityUserUnbanned.ts +1 -1
  157. package/src/communityRepository/communityMembership/events/onLocalCommunityJoined.ts +1 -1
  158. package/src/communityRepository/communityMembership/events/onLocalCommunityLeft.ts +1 -1
  159. package/src/communityRepository/communityMembership/events/onLocalCommunityUserAdded.ts +1 -1
  160. package/src/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.ts +1 -1
  161. package/src/communityRepository/communityMembership/events/onUserDeleted.ts +3 -1
  162. package/src/communityRepository/communityMembership/events/utils.ts +2 -2
  163. package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +8 -2
  164. package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.ts +8 -2
  165. package/src/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.ts +1 -1
  166. package/src/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.ts +1 -1
  167. package/src/communityRepository/events/onCommunityCreated.ts +1 -1
  168. package/src/communityRepository/events/onCommunityDeleted.ts +1 -1
  169. package/src/communityRepository/events/onCommunityUpdated.ts +1 -1
  170. package/src/communityRepository/events/utils.ts +1 -1
  171. package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +2 -2
  172. package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +2 -2
  173. package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.ts +2 -2
  174. package/src/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.ts +2 -2
  175. package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.ts +2 -2
  176. package/src/communityRepository/utils/communityWithMembership.ts +8 -4
  177. package/src/communityRepository/utils/payload.ts +1 -1
  178. package/src/core/liveCollection/PaginationController.ts +1 -1
  179. package/src/core/liveCollection/PaginationNoPageController.ts +1 -1
  180. package/src/core/model/idResolvers.ts +2 -0
  181. package/src/core/model/index.ts +2 -0
  182. package/src/index.ts +2 -0
  183. package/src/invitationRepository/events/index.ts +3 -0
  184. package/src/invitationRepository/events/onLocalInvitationCreated.ts +33 -0
  185. package/src/invitationRepository/events/onLocalInvitationDeleted.ts +33 -0
  186. package/src/invitationRepository/events/onLocalInvitationUpdated.ts +33 -0
  187. package/src/invitationRepository/index.ts +1 -0
  188. package/src/invitationRepository/internalApi/acceptInvitation.ts +45 -0
  189. package/src/invitationRepository/internalApi/cancelInvitation.ts +44 -0
  190. package/src/invitationRepository/internalApi/createInvitations.ts +52 -0
  191. package/src/invitationRepository/internalApi/index.ts +4 -0
  192. package/src/invitationRepository/internalApi/rejectInvitation.ts +45 -0
  193. package/src/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.ts +148 -0
  194. package/src/invitationRepository/observers/getInvitations/InvitationsPaginationController.ts +19 -0
  195. package/src/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.ts +97 -0
  196. package/src/invitationRepository/observers/getInvitations/enums.ts +5 -0
  197. package/src/invitationRepository/observers/getInvitations.ts +44 -0
  198. package/src/invitationRepository/utils/index.ts +1 -0
  199. package/src/invitationRepository/utils/prepareInvitationPayload.ts +11 -0
  200. package/src/messagePreview/utils/getChannelMessagePreviewWithUser.ts +3 -3
  201. package/src/utils/linkedObject/communityLinkedObject.ts +29 -0
  202. package/src/utils/linkedObject/index.ts +4 -0
  203. package/src/utils/linkedObject/invitationLinkedObject.ts +44 -0
@@ -0,0 +1,4 @@
1
+ export * from './onLocalInvitationCreated';
2
+ export * from './onLocalInvitationUpdated';
3
+ export * from './onLocalInvitationDeleted';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ```js
3
+ * import { onLocalInvitationCreated } from '@amityco/ts-sdk'
4
+ * const dispose = onLocalInvitationCreated(data => {
5
+ * // ...
6
+ * })
7
+ * ```
8
+ *
9
+ * Fired when an {@link Amity.InvitationPayload} has been created
10
+ *
11
+ * @param callback The function to call when the event was fired
12
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
13
+ *
14
+ * @category Invitation Events
15
+ */
16
+ export declare const onLocalInvitationCreated: (callback: Amity.Listener<Amity.InternalInvitation[]>) => Amity.Unsubscriber;
17
+ //# sourceMappingURL=onLocalInvitationCreated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onLocalInvitationCreated.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/events/onLocalInvitationCreated.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,aACzB,MAAM,QAAQ,CAAC,MAAM,kBAAkB,EAAE,CAAC,KACnD,MAAM,YAYR,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ```js
3
+ * import { onLocalInvitationDeleted } from '@amityco/ts-sdk'
4
+ * const dispose = onLocalInvitationDeleted(data => {
5
+ * // ...
6
+ * })
7
+ * ```
8
+ *
9
+ * Fired when an {@link Amity.InvitationPayload} has been deleted
10
+ *
11
+ * @param callback The function to call when the event was fired
12
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
13
+ *
14
+ * @category Invitation Events
15
+ */
16
+ export declare const onLocalInvitationDeleted: (callback: Amity.Listener<Amity.InternalInvitation[]>) => Amity.Unsubscriber;
17
+ //# sourceMappingURL=onLocalInvitationDeleted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onLocalInvitationDeleted.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/events/onLocalInvitationDeleted.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,aACzB,MAAM,QAAQ,CAAC,MAAM,kBAAkB,EAAE,CAAC,KACnD,MAAM,YAYR,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ```js
3
+ * import { onLocalInvitationUpdated } from '@amityco/ts-sdk'
4
+ * const dispose = onLocalInvitationUpdated(data => {
5
+ * // ...
6
+ * })
7
+ * ```
8
+ *
9
+ * Fired when an {@link Amity.InvitationPayload} has been updated
10
+ *
11
+ * @param callback The function to call when the event was fired
12
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
13
+ *
14
+ * @category Invitation Events
15
+ */
16
+ export declare const onLocalInvitationUpdated: (callback: Amity.Listener<Amity.InternalInvitation[]>) => Amity.Unsubscriber;
17
+ //# sourceMappingURL=onLocalInvitationUpdated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onLocalInvitationUpdated.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/events/onLocalInvitationUpdated.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,aACzB,MAAM,QAAQ,CAAC,MAAM,kBAAkB,EAAE,CAAC,KACnD,MAAM,YAYR,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './events';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/invitationRepository/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * ```js
3
+ * import { acceptInvitation } from '@amityco/ts-sdk'
4
+ * const isAccepted = await acceptInvitation(invitationId)
5
+ * ```
6
+ *
7
+ * Accepts a {@link Amity.Invitation} object
8
+ *
9
+ * @param invitationId the {@link Amity.Invitation} to accept
10
+ * @returns A success boolean if the {@link Amity.Invitation} was accepted
11
+ *
12
+ * @category Invitation API
13
+ * @async
14
+ */
15
+ export declare const acceptInvitation: (invitationId: Amity.Invitation['_id']) => Promise<boolean>;
16
+ //# sourceMappingURL=acceptInvitation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acceptInvitation.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/internalApi/acceptInvitation.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,iBAAwB,MAAM,UAAU,CAAC,KAAK,CAAC,KAAG,QAAQ,OAAO,CAqB7F,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * ```js
3
+ * import { cancelInvitation } from '@amityco/ts-sdk'
4
+ * const isCanceled = await cancelInvitation(invitationId)
5
+ * ```
6
+ *
7
+ * Cancels a {@link Amity.Invitation} object
8
+ *
9
+ * @param invitationId the {@link Amity.Invitation} to cancel
10
+ * @returns A success boolean if the {@link Amity.Invitation} was canceled
11
+ *
12
+ * @category Invitation API
13
+ * @async
14
+ */
15
+ export declare const cancelInvitation: (invitationId: Amity.Invitation['_id']) => Promise<boolean>;
16
+ //# sourceMappingURL=cancelInvitation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancelInvitation.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/internalApi/cancelInvitation.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,iBAAwB,MAAM,UAAU,CAAC,KAAK,CAAC,KAAG,QAAQ,OAAO,CAqB7F,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * ```js
3
+ * import { createInvitations } from '@amityco/ts-sdk'
4
+ * const created = await createInvitations({
5
+ * type: string,
6
+ * targetType: string,
7
+ * targetId: string,
8
+ * userIds: string[]
9
+ * }))
10
+ * ```
11
+ *
12
+ * Creates an {@link Amity.Invitation}
13
+ *
14
+ * @param bundle The data necessary to create a new {@link Amity.Invitation}
15
+ * @returns The newly created {@link Amity.Invitation}
16
+ *
17
+ * @category Invitation API
18
+ * @async
19
+ */
20
+ export declare const createInvitations: (bundle: Amity.CreateInvitations) => Promise<Amity.Cached<Amity.InternalInvitation[]>>;
21
+ //# sourceMappingURL=createInvitations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createInvitations.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/internalApi/createInvitations.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iBAAiB,WACpB,MAAM,iBAAiB,KAC9B,QAAQ,MAAM,MAAM,CAAC,MAAM,kBAAkB,EAAE,CAAC,CAqBlD,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './createInvitations';
2
+ export * from './acceptInvitation';
3
+ export * from './rejectInvitation';
4
+ export * from './cancelInvitation';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/internalApi/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * ```js
3
+ * import { rejectInvitation } from '@amityco/ts-sdk'
4
+ * const isRejected = await rejectInvitation(invitationId)
5
+ * ```
6
+ *
7
+ * Rejects a {@link Amity.Invitation} object
8
+ *
9
+ * @param invitationId the {@link Amity.Invitation} to reject
10
+ * @returns A success boolean if the {@link Amity.Invitation} was rejected
11
+ *
12
+ * @category Invitation API
13
+ * @async
14
+ */
15
+ export declare const rejectInvitation: (invitationId: Amity.Invitation['_id']) => Promise<boolean>;
16
+ //# sourceMappingURL=rejectInvitation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rejectInvitation.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/internalApi/rejectInvitation.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,iBAAwB,MAAM,UAAU,CAAC,KAAK,CAAC,KAAG,QAAQ,OAAO,CAqB7F,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { InvitationsPaginationController } from './InvitationsPaginationController';
2
+ import { LiveCollectionController } from '~/core/liveCollection/LiveCollectionController';
3
+ export declare class InvitationsLiveCollectionController extends LiveCollectionController<'invitation', Amity.InvitationLiveCollection, Amity.Invitation, InvitationsPaginationController> {
4
+ private queryStreamController;
5
+ private query;
6
+ constructor(query: Amity.InvitationLiveCollection, callback: Amity.LiveCollectionCallback<Amity.Invitation>);
7
+ protected setup(): void;
8
+ protected persistModel(queryPayload: Amity.InvitationPayload & Amity.Pagination): Promise<void>;
9
+ protected persistQueryStream({ response, direction, refresh, }: Amity.LiveCollectionPersistQueryStreamParams<'invitation'>): void;
10
+ startSubscription(): Amity.Unsubscriber[];
11
+ notifyChange({ origin, loading, error }: Amity.LiveCollectionNotifyParams): void;
12
+ applyFilter(data: Amity.Invitation[]): Amity.Invitation[];
13
+ }
14
+ //# sourceMappingURL=InvitationsLiveCollectionController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvitationsLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAQ1F,qBAAa,mCAAoC,SAAQ,wBAAwB,CAC/E,YAAY,EACZ,KAAK,CAAC,wBAAwB,EAC9B,KAAK,CAAC,UAAU,EAChB,+BAA+B,CAChC;IACC,OAAO,CAAC,qBAAqB,CAAmC;IAEhE,OAAO,CAAC,KAAK,CAAiC;gBAG5C,KAAK,EAAE,KAAK,CAAC,wBAAwB,EACrC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,UAAU,CAAC;IAoB1D,SAAS,CAAC,KAAK;cAUC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,iBAAiB,GAAG,KAAK,CAAC,UAAU;IAIrF,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,YAAY,CAAC;IAI7D,iBAAiB;IAiBjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;IAsBzE,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,EAAE;CAsCrC"}
@@ -0,0 +1,5 @@
1
+ import { PaginationController } from '~/core/liveCollection/PaginationController';
2
+ export declare class InvitationsPaginationController extends PaginationController<'invitation', Amity.InvitationLiveCollection> {
3
+ getRequest(queryParams: Amity.InvitationLiveCollection, token: string | undefined): Promise<Amity.InvitationPayload & Amity.Pagination>;
4
+ }
5
+ //# sourceMappingURL=InvitationsPaginationController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvitationsPaginationController.d.ts","sourceRoot":"","sources":["../../../../src/invitationRepository/observers/getInvitations/InvitationsPaginationController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAElF,qBAAa,+BAAgC,SAAQ,oBAAoB,CACvE,YAAY,EACZ,KAAK,CAAC,wBAAwB,CAC/B;IACO,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,wBAAwB,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS;CAWxF"}
@@ -0,0 +1,15 @@
1
+ import { InvitationActionsEnum } from './enums';
2
+ import { QueryStreamController } from '~/core/liveCollection/QueryStreamController';
3
+ export declare class InvitationsQueryStreamController extends QueryStreamController<Amity.InvitationPayload, Amity.InvitationLiveCollection> {
4
+ private notifyChange;
5
+ private preparePayload;
6
+ constructor(query: Amity.InvitationLiveCollection, cacheKey: string[], notifyChange: (params: Amity.LiveCollectionNotifyParams) => void, preparePayload: (response: Amity.InvitationPayload) => Amity.ProcessedInvitationPayload);
7
+ saveToMainDB(response: Amity.InvitationPayload): Promise<void>;
8
+ appendToQueryStream(response: Amity.InvitationPayload & Partial<Amity.Pagination>, direction: Amity.LiveCollectionPageDirection, refresh?: boolean): void;
9
+ reactor(action: InvitationActionsEnum): (invitations: Amity.InternalInvitation[]) => void;
10
+ subscribeRTE(createSubscriber: {
11
+ fn: (reactor: Amity.Listener<Amity.InternalInvitation[]>) => Amity.Unsubscriber;
12
+ action: InvitationActionsEnum;
13
+ }[]): Amity.Unsubscriber[];
14
+ }
15
+ //# sourceMappingURL=InvitationsQueryStreamController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvitationsQueryStreamController.d.ts","sourceRoot":"","sources":["../../../../src/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEpF,qBAAa,gCAAiC,SAAQ,qBAAqB,CACzE,KAAK,CAAC,iBAAiB,EACvB,KAAK,CAAC,wBAAwB,CAC/B;IACC,OAAO,CAAC,YAAY,CAAqD;IAEzE,OAAO,CAAC,cAAc,CAA0E;gBAG9F,KAAK,EAAE,KAAK,CAAC,wBAAwB,EACrC,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,KAAK,IAAI,EAChE,cAAc,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,iBAAiB,KAAK,KAAK,CAAC,0BAA0B;IAOnF,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,iBAAiB;IAWpD,mBAAmB,CACjB,QAAQ,EAAE,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAC7D,SAAS,EAAE,KAAK,CAAC,2BAA2B,EAC5C,OAAO,UAAQ;IAoBjB,OAAO,CAAC,MAAM,EAAE,qBAAqB,iBACd,MAAM,kBAAkB,EAAE;IA2BjD,YAAY,CACV,gBAAgB,EAAE;QAChB,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC;QAChF,MAAM,EAAE,qBAAqB,CAAC;KAC/B,EAAE;CAIN"}
@@ -0,0 +1,6 @@
1
+ export declare enum InvitationActionsEnum {
2
+ OnLocalInvitationCreated = "onLocalInvitationCreated",
3
+ OnLocalInvitationUpdated = "onLocalInvitationUpdated",
4
+ OnLocalInvitationDeleted = "onLocalInvitationDeleted"
5
+ }
6
+ //# sourceMappingURL=enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../../src/invitationRepository/observers/getInvitations/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,qBAAqB;IAC/B,wBAAwB,6BAA6B;IACrD,wBAAwB,6BAA6B;IACrD,wBAAwB,6BAA6B;CACtD"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Get invitations
3
+ *
4
+ * @param params the query parameters
5
+ * @param callback the callback to be called when the invitations are updated
6
+ * @returns invitations
7
+ *
8
+ * @category Invitation Live Collection
9
+ *
10
+ */
11
+ export declare const getInvitations: (params: Amity.InvitationLiveCollection, callback: Amity.LiveCollectionCallback<Amity.Invitation>, config?: Amity.LiveCollectionConfig) => () => void;
12
+ //# sourceMappingURL=getInvitations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getInvitations.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/observers/getInvitations.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,WACjB,MAAM,wBAAwB,YAC5B,MAAM,sBAAsB,CAAC,MAAM,UAAU,CAAC,WAC/C,MAAM,oBAAoB,eAyBpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './prepareInvitationPayload';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const prepareInvitationPayload: (rawPayload: Amity.InvitationPayload) => Amity.ProcessedInvitationPayload;
2
+ //# sourceMappingURL=prepareInvitationPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareInvitationPayload.d.ts","sourceRoot":"","sources":["../../../src/invitationRepository/utils/prepareInvitationPayload.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,eACvB,MAAM,iBAAiB,KAClC,MAAM,0BAQR,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const communityLinkedObject: (community: Amity.InternalCommunity) => Amity.Community;
2
+ //# sourceMappingURL=communityLinkedObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"communityLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/communityLinkedObject.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,cAAe,MAAM,iBAAiB,KAAG,MAAM,SAwBhF,CAAC"}
@@ -12,5 +12,7 @@ export declare const LinkedObject: {
12
12
  channel: (channel: Amity.InternalChannel<any>) => Amity.Channel<any>;
13
13
  pinnedPost: (pinnedPost: Amity.RawPin) => Amity.PinnedPost;
14
14
  notificationTray: (noti: Amity.RawNotificationTrayItem) => Amity.NotificationTrayItem;
15
+ community: (community: Amity.InternalCommunity) => Amity.Community;
16
+ invitation: (invitation: Amity.InternalInvitation) => Amity.Invitation;
15
17
  };
16
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;CAcxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;CAgBxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const invitationLinkedObject: (invitation: Amity.InternalInvitation) => Amity.Invitation;
2
+ //# sourceMappingURL=invitationLinkedObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invitationLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/invitationLinkedObject.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,sBAAsB,eAAgB,MAAM,kBAAkB,KAAG,MAAM,UAmCnF,CAAC"}
@@ -30,21 +30,21 @@ export declare const emptyPostPayload: {
30
30
  export declare const postQueryResponse: {
31
31
  data: Omit<Amity.PostPayload<any>, "communityUsers" | "communities" | "posts"> & {
32
32
  posts: Amity.InternalPost<any>[];
33
- communities: Amity.Community[];
33
+ communities: Amity.InternalCommunity[];
34
34
  communityUsers: Amity.Membership<"community">[];
35
35
  } & Amity.Pagination;
36
36
  };
37
37
  export declare const postQueryResponse2: {
38
38
  data: Omit<Amity.PostPayload<any>, "communityUsers" | "communities" | "posts"> & {
39
39
  posts: Amity.InternalPost<any>[];
40
- communities: Amity.Community[];
40
+ communities: Amity.InternalCommunity[];
41
41
  communityUsers: Amity.Membership<"community">[];
42
42
  } & Amity.Pagination;
43
43
  };
44
44
  export declare const postQueryResponsePage2: {
45
45
  data: Omit<Amity.PostPayload<any>, "communityUsers" | "communities" | "posts"> & {
46
46
  posts: Amity.InternalPost<any>[];
47
- communities: Amity.Community[];
47
+ communities: Amity.InternalCommunity[];
48
48
  communityUsers: Amity.Membership<"community">[];
49
49
  } & Amity.Pagination;
50
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.4.1-b9f48528.0",
3
+ "version": "7.4.1-c116567e.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",
@@ -261,6 +261,10 @@ declare global {
261
261
  notificationTrayItems: Amity.InternalNotificationTrayItem[];
262
262
  };
263
263
 
264
+ 'local.invitation.created': Amity.InternalInvitation[];
265
+ 'local.invitation.updated': Amity.InternalInvitation[];
266
+ 'local.invitation.deleted': Amity.InternalInvitation[];
267
+
264
268
  sessionStateChange: Amity.SessionStates;
265
269
  // used by accessTokenExpiryWatcher
266
270
  tokenExpired: Amity.SessionStates.TOKEN_EXPIRED;
@@ -33,7 +33,7 @@ declare global {
33
33
  feedMarker: Amity.FeedMarker;
34
34
  userMarker: Amity.UserMarker;
35
35
 
36
- community: Amity.Community;
36
+ community: Amity.InternalCommunity;
37
37
  category: Amity.InternalCategory;
38
38
  communityUsers: Amity.Membership<'community'>;
39
39
  post: Amity.InternalPost;
@@ -60,6 +60,8 @@ declare global {
60
60
 
61
61
  notificationTrayItem: Amity.InternalNotificationTrayItem;
62
62
  notificationTraySeen: Amity.InternalNotificationTraySeen;
63
+
64
+ invitation: Amity.InternalInvitation;
63
65
  };
64
66
 
65
67
  type Model = ValueOf<Models>;
@@ -124,6 +126,8 @@ declare global {
124
126
 
125
127
  notificationTrayItem: Pick<Amity.InternalNotificationTrayItem, '_id'>;
126
128
  notificationTraySeen: Pick<Amity.InternalNotificationTraySeen, 'userId'>;
129
+
130
+ invitation: Pick<Amity.InternalInvitation, '_id'>;
127
131
  };
128
132
  }
129
133
  }
@@ -27,6 +27,7 @@ declare global {
27
27
  semanticSearchPost: Amity.SemanticSearchPostPayload;
28
28
  semanticSearchCommunity: Amity.SemanticSearchCommunityPayload;
29
29
  notificationTrayItem: Amity.NotificationTrayPayload;
30
+ invitation: Amity.InvitationPayload;
30
31
  };
31
32
 
32
33
  type UserPayload = {
@@ -306,7 +307,7 @@ declare global {
306
307
  * - communityUsers: `Amity.RawMembership` -> `Amity.Membership` (Add user getter prop)
307
308
  */
308
309
  type ProcessedCommunityPayload = Omit<CommunityPayload, 'communities' | 'communityUsers'> & {
309
- communities: Amity.Community[];
310
+ communities: Amity.InternalCommunity[];
310
311
  communityUsers: Amity.Membership<'community'>[];
311
312
  };
312
313
 
@@ -333,7 +334,7 @@ declare global {
333
334
  CommunityMembershipPayload,
334
335
  'communities' | 'communityUsers'
335
336
  > & {
336
- communities: Amity.Community[];
337
+ communities: Amity.InternalCommunity[];
337
338
  communityUsers: Amity.Membership<'community'>[];
338
339
  };
339
340
 
@@ -383,7 +384,7 @@ declare global {
383
384
  Amity.StoryTargetPayload;
384
385
 
385
386
  type ProcessedGlobalStoryFeed = Omit<GlobalStoryFeedPayload, 'communities'> & {
386
- communities: Amity.Community[];
387
+ communities: Amity.InternalCommunity[];
387
388
  };
388
389
 
389
390
  // Original Payload form BE
@@ -436,7 +437,7 @@ declare global {
436
437
  */
437
438
  type ProcessedPostPayload = Omit<PostPayload, 'communities' | 'communityUsers' | 'posts'> & {
438
439
  posts: Amity.InternalPost[];
439
- communities: Amity.Community[];
440
+ communities: Amity.InternalCommunity[];
440
441
  communityUsers: Amity.Membership<'community'>[];
441
442
  };
442
443
 
@@ -545,5 +546,13 @@ declare global {
545
546
  Amity.Flaggable &
546
547
  Amity.Taggable &
547
548
  Amity.Timestamps;
549
+
550
+ type InvitationPayload = {
551
+ invitations: Amity.RawInvitation[];
552
+ };
553
+
554
+ type ProcessedInvitationPayload = {
555
+ invitations: Amity.InternalInvitation[];
556
+ };
548
557
  }
549
558
  }
@@ -104,11 +104,16 @@ declare global {
104
104
  Amity.SoftDelete &
105
105
  Amity.Subscribable;
106
106
 
107
- type Community = Omit<Amity.RawCommunity, 'onlyAdminCanPost' | 'needApprovalOnPostCreation'> &
107
+ type InternalCommunity = Omit<
108
+ Amity.RawCommunity,
109
+ 'onlyAdminCanPost' | 'needApprovalOnPostCreation'
110
+ > &
108
111
  Amity.CommunityStorySettings & {
109
112
  postSetting?: ValueOf<typeof CommunityPostSettings>;
110
113
  };
111
114
 
115
+ type Community = Amity.InternalCommunity & Amity.CommunityLinkedObject;
116
+
112
117
  type QueryCommunities = {
113
118
  membership?: 'all' | 'member' | 'notMember';
114
119
  categoryId?: Amity.InternalCategory['categoryId'];
@@ -128,6 +133,7 @@ declare global {
128
133
  sortBy?: Amity.SearchCommunitySortBy | Amity.SearchCommunitySortByEnum;
129
134
  page?: string;
130
135
  limit?: number;
136
+ includeDiscoverablePrivateCommunity?: boolean;
131
137
  };
132
138
 
133
139
  type CommunityLiveCollection = Amity.LiveCollectionParams<Omit<QueryCommunities, 'page'>>;
@@ -200,6 +206,7 @@ declare global {
200
206
  token?: string;
201
207
  };
202
208
  tags?: string[];
209
+ includeDiscoverablePrivateCommunity?: boolean;
203
210
  };
204
211
 
205
212
  type SemanticSearchCommunityLiveCollection = Amity.LiveCollectionParams<
@@ -212,5 +219,12 @@ declare global {
212
219
  Amity.Community['communityId'], // communityId:score
213
220
  QuerySemanticSearchCommunity
214
221
  >;
222
+
223
+ type CommunityLinkedObject = {
224
+ createInvitations: (userIds: string[]) => Promise<void>;
225
+ getMemberInvitations: (
226
+ callback: Amity.LiveCollectionCallback<Amity.Invitation>,
227
+ ) => Amity.Unsubscriber;
228
+ };
215
229
  }
216
230
  }
@@ -0,0 +1,92 @@
1
+ export {};
2
+
3
+ export const enum InvitationTypeEnum {
4
+ CommunityMemberInvite = 'communityMemberInvite',
5
+ LivestreamInvite = 'livestreamInvite',
6
+ }
7
+
8
+ export const enum InvitationStatusEnum {
9
+ Pending = 'pending',
10
+ Approved = 'approved',
11
+ Rejected = 'rejected',
12
+ Cancelled = 'cancelled',
13
+ }
14
+
15
+ export const enum InvitationSortByEnum {
16
+ FirstCreated = 'firstCreated',
17
+ LastCreated = 'lastCreated',
18
+ }
19
+
20
+ declare global {
21
+ namespace Amity {
22
+ type InvitationType = InvitationTypeEnum;
23
+
24
+ type InvitationStatus = InvitationStatusEnum;
25
+
26
+ type InvitationTargetType = Extract<Amity.Domain, 'community'>;
27
+
28
+ type InvitationTargetMap = {
29
+ community: Amity.InternalCommunity;
30
+ };
31
+
32
+ type InvitationTarget<T extends InvitationTargetType> = InvitationTargetMap[T];
33
+
34
+ type InvitationSortBy = InvitationSortByEnum;
35
+
36
+ type RawInvitation = {
37
+ _id: string;
38
+ networkId: string;
39
+ type: Amity.InvitationType;
40
+ targetId: string;
41
+ targetType: Amity.InvitationTargetType;
42
+ userId: string;
43
+ status: Amity.InvitationStatus;
44
+ respondedAt: Amity.timestamp;
45
+ createdBy: string;
46
+ } & Amity.Timestamps;
47
+
48
+ type InternalInvitation = Omit<RawInvitation, 'createdBy'> & {
49
+ invitationId: string;
50
+ createdById: string;
51
+ };
52
+
53
+ type Invitation = Omit<Amity.InternalInvitation, 'createdBy'> &
54
+ Amity.InvitationLinkedObject & {
55
+ user?: Amity.User;
56
+ createdById: string;
57
+ createdBy?: Amity.User;
58
+ invitationId: string;
59
+ target?: Amity.InvitationTarget<Amity.InvitationTargetType>;
60
+ };
61
+
62
+ type QueryInvitations = {
63
+ targetId: string;
64
+ statuses?: string[];
65
+ token?: Amity.Token;
66
+ type: Amity.InvitationType;
67
+ sortBy?: Amity.InvitationSortBy;
68
+ limit?: Amity.PageLimit['limit'];
69
+ targetType: Amity.InvitationTargetType;
70
+ };
71
+
72
+ type InvitationLiveCollection = Amity.LiveCollectionParams<Omit<QueryInvitations, 'limit'>>;
73
+
74
+ type InvitationLiveCollectionCache = Amity.LiveCollectionCache<
75
+ Amity.InternalInvitation['_id'],
76
+ Pick<QueryInvitations, 'limit'>
77
+ >;
78
+
79
+ type InvitationLinkedObject = {
80
+ accept: () => Promise<void>;
81
+ reject: () => Promise<void>;
82
+ cancel: () => Promise<void>;
83
+ };
84
+
85
+ type CreateInvitations = {
86
+ type: Amity.InvitationType;
87
+ targetType: Amity.InvitationTargetType;
88
+ targetId: string;
89
+ userIds: string[];
90
+ };
91
+ }
92
+ }
@@ -39,3 +39,4 @@ export * from './domains/story';
39
39
  export * from './domains/ad';
40
40
  export * from './domains/notification';
41
41
  export * from './domains/client';
42
+ export * from './domains/invitation';
@@ -1,3 +1,4 @@
1
+ import { LinkedObject } from '~/utils/linkedObject';
1
2
  import { getActiveClient } from '~/client/api';
2
3
 
3
4
  import { ingestInCache } from '~/cache/api/ingestInCache';
@@ -62,7 +63,7 @@ export const createCommunity = async (
62
63
 
63
64
  const { communities } = data;
64
65
  return {
65
- data: communities[0],
66
+ data: LinkedObject.community(communities[0]),
66
67
  cachedAt,
67
68
  };
68
69
  };