@amityco/ts-sdk 7.4.1-c116567e.0 → 7.4.1-e8631ca7.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/dist/@types/core/payload.d.ts +11 -0
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +2 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/invitation.d.ts +18 -2
- package/dist/@types/domains/invitation.d.ts.map +1 -1
- package/dist/index.cjs.js +252 -21
- package/dist/index.esm.js +252 -21
- package/dist/index.umd.js +4 -4
- package/dist/invitationRepository/index.d.ts +1 -0
- package/dist/invitationRepository/index.d.ts.map +1 -1
- package/dist/invitationRepository/internalApi/getInvitation.d.ts +17 -0
- package/dist/invitationRepository/internalApi/getInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts +12 -0
- package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts +14 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts +5 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts +15 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/index.d.ts +2 -0
- package/dist/invitationRepository/observers/index.d.ts.map +1 -0
- package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts +2 -0
- package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts.map +1 -1
- package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts +2 -0
- package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts.map +1 -0
- package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/payload.ts +13 -0
- package/src/@types/domains/community.ts +2 -0
- package/src/@types/domains/invitation.ts +26 -2
- package/src/communityRepository/api/getCommunity.ts +1 -1
- package/src/invitationRepository/index.ts +1 -0
- package/src/invitationRepository/internalApi/getInvitation.ts +47 -0
- package/src/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.ts +1 -1
- package/src/invitationRepository/observers/getInvitations/InvitationsPaginationController.ts +1 -1
- package/src/invitationRepository/observers/getMyCommunityInvitations.ts +48 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.ts +148 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.ts +22 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.ts +105 -0
- package/src/invitationRepository/observers/index.ts +1 -0
- package/src/invitationRepository/utils/convertRawInvitationToInternalInvitation.ts +8 -0
- package/src/invitationRepository/utils/prepareInvitationPayload.ts +6 -5
- package/src/invitationRepository/utils/prepareMyInvitationsPayload.ts +12 -0
- package/src/utils/linkedObject/communityLinkedObject.ts +7 -0
- package/src/utils/linkedObject/invitationLinkedObject.ts +5 -5
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { convertRawUserToInternalUser } from '~/userRepository/utils/convertRawUserToInternalUser';
|
|
2
|
+
import { convertRawInvitationToInternalInvitation } from './convertRawInvitationToInternalInvitation';
|
|
3
|
+
|
|
1
4
|
export const prepareInvitationPayload = (
|
|
2
5
|
rawPayload: Amity.InvitationPayload,
|
|
3
6
|
): Amity.ProcessedInvitationPayload => {
|
|
4
7
|
return {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
createdById: invitation.createdBy,
|
|
9
|
-
})),
|
|
8
|
+
...rawPayload,
|
|
9
|
+
invitations: rawPayload.invitations.map(convertRawInvitationToInternalInvitation),
|
|
10
|
+
users: rawPayload.users.map(convertRawUserToInternalUser),
|
|
10
11
|
};
|
|
11
12
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { convertRawUserToInternalUser } from '~/userRepository/utils/convertRawUserToInternalUser';
|
|
2
|
+
import { convertRawInvitationToInternalInvitation } from './convertRawInvitationToInternalInvitation';
|
|
3
|
+
|
|
4
|
+
export const prepareMyInvitationsPayload = (
|
|
5
|
+
rawPayload: Amity.MyInvitationsPayload,
|
|
6
|
+
): Amity.ProcessedMyInvitationsPayload => {
|
|
7
|
+
return {
|
|
8
|
+
...rawPayload,
|
|
9
|
+
users: rawPayload.users.map(convertRawUserToInternalUser),
|
|
10
|
+
invitations: rawPayload.invitations.map(convertRawInvitationToInternalInvitation),
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InvitationTypeEnum } from '~/@types';
|
|
2
2
|
import { createInvitations } from '~/invitationRepository/internalApi';
|
|
3
|
+
import { getInvitation } from '~/invitationRepository/internalApi/getInvitation';
|
|
3
4
|
import { getInvitations } from '~/invitationRepository/observers/getInvitations';
|
|
4
5
|
|
|
5
6
|
export const communityLinkedObject = (community: Amity.InternalCommunity): Amity.Community => {
|
|
@@ -14,10 +15,12 @@ export const communityLinkedObject = (community: Amity.InternalCommunity): Amity
|
|
|
14
15
|
});
|
|
15
16
|
},
|
|
16
17
|
getMemberInvitations: (
|
|
18
|
+
params: Pick<Amity.InvitationLiveCollection, 'limit' | 'sortBy' | 'statuses'>,
|
|
17
19
|
callback: Amity.LiveCollectionCallback<Amity.Invitation>,
|
|
18
20
|
): Amity.Unsubscriber => {
|
|
19
21
|
return getInvitations(
|
|
20
22
|
{
|
|
23
|
+
...params,
|
|
21
24
|
targetId: community.communityId,
|
|
22
25
|
targetType: 'community',
|
|
23
26
|
type: InvitationTypeEnum.CommunityMemberInvite,
|
|
@@ -25,5 +28,9 @@ export const communityLinkedObject = (community: Amity.InternalCommunity): Amity
|
|
|
25
28
|
callback,
|
|
26
29
|
);
|
|
27
30
|
},
|
|
31
|
+
getInvitation: async () => {
|
|
32
|
+
const { data } = await getInvitation('community', community.communityId);
|
|
33
|
+
return data;
|
|
34
|
+
},
|
|
28
35
|
};
|
|
29
36
|
};
|
|
@@ -9,17 +9,17 @@ import {
|
|
|
9
9
|
export const invitationLinkedObject = (invitation: Amity.InternalInvitation): Amity.Invitation => {
|
|
10
10
|
return {
|
|
11
11
|
...invitation,
|
|
12
|
-
get user() {
|
|
13
|
-
const cacheData = pullFromCache<Amity.User>(['user', 'get', invitation.
|
|
12
|
+
get user(): Amity.User | undefined {
|
|
13
|
+
const cacheData = pullFromCache<Amity.User>(['user', 'get', invitation.invitedUserPublicId]);
|
|
14
14
|
if (cacheData?.data) return userLinkedObject(cacheData.data);
|
|
15
15
|
return undefined;
|
|
16
16
|
},
|
|
17
|
-
get createdBy() {
|
|
18
|
-
const cacheData = pullFromCache<Amity.User>(['user', 'get', invitation.
|
|
17
|
+
get createdBy(): Amity.User | undefined {
|
|
18
|
+
const cacheData = pullFromCache<Amity.User>(['user', 'get', invitation.inviterUserPublicId]);
|
|
19
19
|
if (cacheData?.data) return userLinkedObject(cacheData.data);
|
|
20
20
|
return undefined;
|
|
21
21
|
},
|
|
22
|
-
get target() {
|
|
22
|
+
get target(): Amity.InvitationTarget<Amity.InvitationTargetType> | undefined {
|
|
23
23
|
if (invitation.targetType === 'community') {
|
|
24
24
|
const cacheData = pullFromCache<Amity.InternalCommunity>([
|
|
25
25
|
'community',
|