@amityco/ts-sdk 7.4.1-b9f48528.0 → 7.4.1-d23fab2f.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 (175) 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 +8 -4
  6. package/dist/@types/core/payload.d.ts.map +1 -1
  7. package/dist/@types/domains/community.d.ts +5 -1
  8. package/dist/@types/domains/community.d.ts.map +1 -1
  9. package/dist/@types/domains/invitation.d.ts +43 -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.map +1 -1
  15. package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
  16. package/dist/communityRepository/api/getRecommendedCommunities.d.ts.map +1 -1
  17. package/dist/communityRepository/api/getTrendingCommunities.d.ts.map +1 -1
  18. package/dist/communityRepository/api/queryCommunities.d.ts.map +1 -1
  19. package/dist/communityRepository/api/updateCommunity.d.ts.map +1 -1
  20. package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts +1 -1
  21. package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts.map +1 -1
  22. package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts +1 -1
  23. package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts.map +1 -1
  24. package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts +1 -1
  25. package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts.map +1 -1
  26. package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts +1 -1
  27. package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts.map +1 -1
  28. package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts +1 -1
  29. package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts.map +1 -1
  30. package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts +1 -1
  31. package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts.map +1 -1
  32. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts +1 -1
  33. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts.map +1 -1
  34. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts +1 -1
  35. package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts.map +1 -1
  36. package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts +1 -1
  37. package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts.map +1 -1
  38. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts +1 -1
  39. package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts.map +1 -1
  40. package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts +1 -1
  41. package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts.map +1 -1
  42. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts +1 -1
  43. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts.map +1 -1
  44. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts +1 -1
  45. package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts.map +1 -1
  46. package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts +1 -1
  47. package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts.map +1 -1
  48. package/dist/communityRepository/communityMembership/events/utils.d.ts +2 -2
  49. package/dist/communityRepository/communityMembership/events/utils.d.ts.map +1 -1
  50. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts +2 -2
  51. package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
  52. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts +2 -2
  53. package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts.map +1 -1
  54. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts +1 -1
  55. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts.map +1 -1
  56. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts +1 -1
  57. package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts.map +1 -1
  58. package/dist/communityRepository/events/onCommunityCreated.d.ts +1 -1
  59. package/dist/communityRepository/events/onCommunityCreated.d.ts.map +1 -1
  60. package/dist/communityRepository/events/onCommunityDeleted.d.ts +1 -1
  61. package/dist/communityRepository/events/onCommunityDeleted.d.ts.map +1 -1
  62. package/dist/communityRepository/events/onCommunityUpdated.d.ts +1 -1
  63. package/dist/communityRepository/events/onCommunityUpdated.d.ts.map +1 -1
  64. package/dist/communityRepository/events/utils.d.ts +1 -1
  65. package/dist/communityRepository/events/utils.d.ts.map +1 -1
  66. package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts +2 -2
  67. package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts.map +1 -1
  68. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts +2 -2
  69. package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts.map +1 -1
  70. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts +2 -2
  71. package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts.map +1 -1
  72. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts +2 -2
  73. package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts.map +1 -1
  74. package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts +2 -2
  75. package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts.map +1 -1
  76. package/dist/communityRepository/utils/communityWithMembership.d.ts +1 -1
  77. package/dist/communityRepository/utils/communityWithMembership.d.ts.map +1 -1
  78. package/dist/communityRepository/utils/payload.d.ts +1 -1
  79. package/dist/communityRepository/utils/payload.d.ts.map +1 -1
  80. package/dist/core/events.d.ts +3 -3
  81. package/dist/core/events.d.ts.map +1 -1
  82. package/dist/core/model/idResolvers.d.ts.map +1 -1
  83. package/dist/core/model/index.d.ts.map +1 -1
  84. package/dist/index.cjs.js +266 -51
  85. package/dist/index.d.ts +1 -0
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.esm.js +248 -34
  88. package/dist/index.umd.js +4 -4
  89. package/dist/invitationRepository/events/index.d.ts +2 -0
  90. package/dist/invitationRepository/events/index.d.ts.map +1 -0
  91. package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts +17 -0
  92. package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts.map +1 -0
  93. package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts +17 -0
  94. package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts.map +1 -0
  95. package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts +17 -0
  96. package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts.map +1 -0
  97. package/dist/invitationRepository/index.d.ts +2 -0
  98. package/dist/invitationRepository/index.d.ts.map +1 -0
  99. package/dist/invitationRepository/internalApi/acceptInvitation.d.ts +16 -0
  100. package/dist/invitationRepository/internalApi/acceptInvitation.d.ts.map +1 -0
  101. package/dist/invitationRepository/internalApi/cancelInvitation.d.ts +16 -0
  102. package/dist/invitationRepository/internalApi/cancelInvitation.d.ts.map +1 -0
  103. package/dist/invitationRepository/internalApi/createInvitations.d.ts +21 -0
  104. package/dist/invitationRepository/internalApi/createInvitations.d.ts.map +1 -0
  105. package/dist/invitationRepository/internalApi/index.d.ts +5 -0
  106. package/dist/invitationRepository/internalApi/index.d.ts.map +1 -0
  107. package/dist/invitationRepository/internalApi/rejectInvitation.d.ts +16 -0
  108. package/dist/invitationRepository/internalApi/rejectInvitation.d.ts.map +1 -0
  109. package/dist/utils/linkedObject/communityLinkedObject.d.ts +2 -0
  110. package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +1 -0
  111. package/dist/utils/linkedObject/index.d.ts +2 -0
  112. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  113. package/dist/utils/linkedObject/invitationLinkedObject.d.ts +2 -0
  114. package/dist/utils/linkedObject/invitationLinkedObject.d.ts.map +1 -0
  115. package/dist/utils/tests/dummy/post.d.ts +3 -3
  116. package/package.json +1 -1
  117. package/src/@types/core/events.ts +4 -0
  118. package/src/@types/core/model.ts +5 -1
  119. package/src/@types/core/payload.ts +9 -4
  120. package/src/@types/domains/community.ts +10 -1
  121. package/src/@types/domains/invitation.ts +52 -0
  122. package/src/@types/index.ts +1 -0
  123. package/src/communityRepository/api/createCommunity.ts +2 -1
  124. package/src/communityRepository/api/getCommunities.ts +2 -1
  125. package/src/communityRepository/api/getCommunity.ts +4 -1
  126. package/src/communityRepository/api/getRecommendedCommunities.ts +2 -1
  127. package/src/communityRepository/api/getTrendingCommunities.ts +2 -1
  128. package/src/communityRepository/api/queryCommunities.ts +6 -1
  129. package/src/communityRepository/api/updateCommunity.ts +4 -1
  130. package/src/communityRepository/communityMembership/events/onCommunityJoined.ts +1 -1
  131. package/src/communityRepository/communityMembership/events/onCommunityLeft.ts +1 -1
  132. package/src/communityRepository/communityMembership/events/onCommunityUserAdded.ts +1 -1
  133. package/src/communityRepository/communityMembership/events/onCommunityUserBanned.ts +1 -1
  134. package/src/communityRepository/communityMembership/events/onCommunityUserChanged.ts +1 -1
  135. package/src/communityRepository/communityMembership/events/onCommunityUserRemoved.ts +1 -1
  136. package/src/communityRepository/communityMembership/events/onCommunityUserRoleAdded.ts +1 -1
  137. package/src/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.ts +1 -1
  138. package/src/communityRepository/communityMembership/events/onCommunityUserUnbanned.ts +1 -1
  139. package/src/communityRepository/communityMembership/events/onLocalCommunityJoined.ts +1 -1
  140. package/src/communityRepository/communityMembership/events/onLocalCommunityLeft.ts +1 -1
  141. package/src/communityRepository/communityMembership/events/onLocalCommunityUserAdded.ts +1 -1
  142. package/src/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.ts +1 -1
  143. package/src/communityRepository/communityMembership/events/onUserDeleted.ts +3 -1
  144. package/src/communityRepository/communityMembership/events/utils.ts +2 -2
  145. package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +8 -2
  146. package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.ts +8 -2
  147. package/src/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.ts +1 -1
  148. package/src/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.ts +1 -1
  149. package/src/communityRepository/events/onCommunityCreated.ts +1 -1
  150. package/src/communityRepository/events/onCommunityDeleted.ts +1 -1
  151. package/src/communityRepository/events/onCommunityUpdated.ts +1 -1
  152. package/src/communityRepository/events/utils.ts +1 -1
  153. package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +2 -2
  154. package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +2 -2
  155. package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.ts +2 -2
  156. package/src/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.ts +2 -2
  157. package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.ts +2 -2
  158. package/src/communityRepository/utils/communityWithMembership.ts +8 -4
  159. package/src/communityRepository/utils/payload.ts +1 -1
  160. package/src/core/model/idResolvers.ts +2 -0
  161. package/src/core/model/index.ts +2 -0
  162. package/src/index.ts +2 -0
  163. package/src/invitationRepository/events/index.ts +1 -0
  164. package/src/invitationRepository/events/onLocalInvitationCreated.ts +33 -0
  165. package/src/invitationRepository/events/onLocalInvitationDeleted.ts +33 -0
  166. package/src/invitationRepository/events/onLocalInvitationUpdated.ts +33 -0
  167. package/src/invitationRepository/index.ts +1 -0
  168. package/src/invitationRepository/internalApi/acceptInvitation.ts +45 -0
  169. package/src/invitationRepository/internalApi/cancelInvitation.ts +44 -0
  170. package/src/invitationRepository/internalApi/createInvitations.ts +46 -0
  171. package/src/invitationRepository/internalApi/index.ts +4 -0
  172. package/src/invitationRepository/internalApi/rejectInvitation.ts +45 -0
  173. package/src/utils/linkedObject/communityLinkedObject.ts +16 -0
  174. package/src/utils/linkedObject/index.ts +4 -0
  175. package/src/utils/linkedObject/invitationLinkedObject.ts +20 -0
@@ -0,0 +1,2 @@
1
+ export * from './onLocalInvitationCreated';
2
+ //# 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"}
@@ -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.InvitationPayload>) => 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,iBAAiB,CAAC,KAChD,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.InvitationPayload>) => 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,iBAAiB,CAAC,KAChD,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.InvitationPayload>) => 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,iBAAiB,CAAC,KAChD,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":"AAOA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iBAAiB,WACpB,MAAM,iBAAiB,KAC9B,QAAQ,MAAM,MAAM,CAAC,MAAM,kBAAkB,EAAE,CAAC,CAgBlD,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,2 @@
1
+ export declare const communityLinkedObject: (community: Amity.RawCommunity) => 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":"AAGA,eAAO,MAAM,qBAAqB,cAAe,MAAM,YAAY,KAAG,MAAM,SAY3E,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.RawCommunity) => Amity.Community;
16
+ invitation: (invitation: Amity.RawInvitation) => 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.RawInvitation) => 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":"AAMA,eAAO,MAAM,sBAAsB,eAAgB,MAAM,aAAa,KAAG,MAAM,UAa9E,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-d23fab2f.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.InvitationPayload;
265
+ 'local.invitation.updated': Amity.InvitationPayload;
266
+ 'local.invitation.deleted': Amity.InvitationPayload;
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,9 @@ declare global {
545
546
  Amity.Flaggable &
546
547
  Amity.Taggable &
547
548
  Amity.Timestamps;
549
+
550
+ type InvitationPayload = {
551
+ invitations: Amity.RawInvitation[];
552
+ };
548
553
  }
549
554
  }
@@ -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'];
@@ -212,5 +217,9 @@ declare global {
212
217
  Amity.Community['communityId'], // communityId:score
213
218
  QuerySemanticSearchCommunity
214
219
  >;
220
+
221
+ type CommunityLinkedObject = {
222
+ createInvitations: (userIds: string[]) => Promise<void>;
223
+ };
215
224
  }
216
225
  }
@@ -0,0 +1,52 @@
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
+ declare global {
16
+ namespace Amity {
17
+ type InvitationType = InvitationTypeEnum;
18
+
19
+ type InvitationStatus = InvitationStatusEnum;
20
+
21
+ type InvitationTargetType = Extract<Amity.Domain, 'community' | 'post' | 'comment'>;
22
+
23
+ type RawInvitation = {
24
+ _id: string;
25
+ networkId: string;
26
+ type: Amity.InvitationType;
27
+ targetId: string;
28
+ targetType: Amity.InvitationTargetType;
29
+ userId: string;
30
+ status: Amity.InvitationStatus;
31
+ respondedAt: Amity.timestamp;
32
+ createdBy: string;
33
+ } & Amity.Timestamps;
34
+
35
+ type InternalInvitation = RawInvitation;
36
+
37
+ type Invitation = Amity.InternalInvitation & Amity.InvitationLinkedObject;
38
+
39
+ type InvitationLinkedObject = {
40
+ accept: () => Promise<void>;
41
+ reject: () => Promise<void>;
42
+ cancel: () => Promise<void>;
43
+ };
44
+
45
+ type CreateInvitations = {
46
+ type: Amity.InvitationType;
47
+ targetType: Amity.InvitationTargetType;
48
+ targetId: string;
49
+ userIds: string[];
50
+ };
51
+ }
52
+ }
@@ -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
  };
@@ -5,6 +5,7 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
5
5
 
6
6
  import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
7
7
  import { prepareCommunityPayload } from '../utils';
8
+ import { LinkedObject } from '~/utils/linkedObject';
8
9
 
9
10
  /**
10
11
  * ```js
@@ -43,7 +44,7 @@ export const getCommunities = async (
43
44
  }
44
45
 
45
46
  return {
46
- data: data.communities,
47
+ data: data.communities.map(community => LinkedObject.community(community)),
47
48
  cachedAt,
48
49
  };
49
50
  };
@@ -5,6 +5,7 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
5
5
 
6
6
  import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
7
7
  import { prepareCommunityPayload } from '../utils';
8
+ import { LinkedObject } from '~/utils/linkedObject';
8
9
 
9
10
  /**
10
11
  * ```js
@@ -42,7 +43,9 @@ export const getCommunity = async (
42
43
  const { communities } = data;
43
44
 
44
45
  return {
45
- data: communities.find(community => community.communityId === communityId)!,
46
+ data: LinkedObject.community(
47
+ communities.find(community => community.communityId === communityId)!,
48
+ ),
46
49
  cachedAt,
47
50
  };
48
51
  };
@@ -4,6 +4,7 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
4
4
 
5
5
  import { prepareCommunityPayload } from '../utils';
6
6
  import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
7
+ import { LinkedObject } from '~/utils/linkedObject';
7
8
 
8
9
  /* begin_public_function
9
10
  id: community.query.recommended_communities
@@ -47,5 +48,5 @@ export const getRecommendedCommunities = async (
47
48
  ingestInCache(data, { cachedAt });
48
49
  }
49
50
 
50
- return { data: communities, cachedAt };
51
+ return { data: communities.map(community => LinkedObject.community(community)), cachedAt };
51
52
  };
@@ -4,6 +4,7 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
4
4
 
5
5
  import { prepareCommunityPayload } from '../utils';
6
6
  import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
7
+ import { LinkedObject } from '~/utils/linkedObject';
7
8
 
8
9
  /**
9
10
  * ```js
@@ -44,5 +45,5 @@ export const getTrendingCommunities = async (
44
45
  ingestInCache(data, { cachedAt });
45
46
  }
46
47
 
47
- return { data: communities, cachedAt };
48
+ return { data: communities.map(community => LinkedObject.community(community)), cachedAt };
48
49
  };
@@ -6,6 +6,7 @@ import { getResolver } from '~/core/model';
6
6
  import { inferIsDeleted } from '~/utils/inferIsDeleted';
7
7
  import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
8
8
  import { prepareCommunityPayload } from '../utils';
9
+ import { LinkedObject } from '~/utils/linkedObject';
9
10
 
10
11
  /**
11
12
  * ```js
@@ -68,5 +69,9 @@ export const queryCommunities = async (
68
69
  saveCommunityUsers(data.communities, data.communityUsers);
69
70
  }
70
71
 
71
- return { data: communities, cachedAt, paging };
72
+ return {
73
+ data: communities.map(community => LinkedObject.community(community)),
74
+ cachedAt,
75
+ paging,
76
+ };
72
77
  };
@@ -5,6 +5,7 @@ import { fireEvent } from '~/core/events';
5
5
 
6
6
  import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
7
7
  import { prepareCommunityPayload, prepareCommunityRequest } from '../utils';
8
+ import { LinkedObject } from '~/utils/linkedObject';
8
9
 
9
10
  /* begin_public_function
10
11
  id: community.update
@@ -53,7 +54,9 @@ export const updateCommunity = async (
53
54
  const { communities } = data;
54
55
 
55
56
  return {
56
- data: communities.find(community => community.communityId === communityId)!,
57
+ data: LinkedObject.community(
58
+ communities.find(community => community.communityId === communityId)!,
59
+ ),
57
60
  cachedAt,
58
61
  };
59
62
  };
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
16
16
  * @category Community Events
17
17
  */
18
18
  export const onCommunityJoined = (
19
- callback: (community: Amity.Community, member: Amity.Membership<'community'>[]) => void,
19
+ callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
20
20
  ) => createCommunityMemberEventSubscriber('community.joined', callback);
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
16
16
  * @category Community Events
17
17
  */
18
18
  export const onCommunityLeft = (
19
- callback: (community: Amity.Community, member: Amity.Membership<'community'>[]) => void,
19
+ callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
20
20
  ) => createCommunityMemberEventSubscriber('community.left', callback);
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
16
16
  * @category Community Events
17
17
  */
18
18
  export const onCommunityUserAdded = (
19
- callback: (community: Amity.Community, member: Amity.Membership<'community'>[]) => void,
19
+ callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
20
20
  ) => createCommunityMemberEventSubscriber('community.userAdded', callback);
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
16
16
  * @category Community Events
17
17
  */
18
18
  export const onCommunityUserBanned = (
19
- callback: (community: Amity.Community, member: Amity.Membership<'community'>[]) => void,
19
+ callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
20
20
  ) => createCommunityMemberEventSubscriber('community.userBanned', callback);
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
16
16
  * @category Community Events
17
17
  */
18
18
  export const onCommunityUserChanged = (
19
- callback: (community: Amity.Community, members: Amity.Membership<'community'>[]) => void,
19
+ callback: (community: Amity.InternalCommunity, members: Amity.Membership<'community'>[]) => void,
20
20
  ) => createCommunityMemberEventSubscriber('community.userChanged', callback);
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
16
16
  * @category Community Events
17
17
  */
18
18
  export const onCommunityUserRemoved = (
19
- callback: (community: Amity.Community, member: Amity.Membership<'community'>[]) => void,
19
+ callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
20
20
  ) => createCommunityMemberEventSubscriber('community.userRemoved', callback);
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
16
16
  * @category Community Events
17
17
  */
18
18
  export const onCommunityUserRoleAdded = (
19
- callback: (community: Amity.Community, member: Amity.Membership<'community'>[]) => void,
19
+ callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
20
20
  ) => createCommunityMemberEventSubscriber('community.roleAdded', callback);
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
16
16
  * @category Community Events
17
17
  */
18
18
  export const onCommunityUserRoleRemoved = (
19
- callback: (community: Amity.Community, member: Amity.Membership<'community'>[]) => void,
19
+ callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
20
20
  ) => createCommunityMemberEventSubscriber('community.roleRemoved', callback);
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
16
16
  * @category Community Events
17
17
  */
18
18
  export const onCommunityUserUnbanned = (
19
- callback: (community: Amity.Community, member: Amity.Membership<'community'>[]) => void,
19
+ callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
20
20
  ) => createCommunityMemberEventSubscriber('community.userUnbanned', callback);
@@ -1,5 +1,5 @@
1
1
  import { createLocalCommunityMemberEventSubscriber } from './utils';
2
2
 
3
3
  export const onLocalCommunityJoined = (
4
- callback: (community: Amity.Community, member: Amity.Membership<'community'>[]) => void,
4
+ callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
5
5
  ) => createLocalCommunityMemberEventSubscriber('local.community.joined', callback);