@shipfox/client-workspace-settings 5.0.0 → 6.0.2
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +53 -0
- package/dist/components/members/form-errors.d.ts +1 -0
- package/dist/components/members/form-errors.d.ts.map +1 -1
- package/dist/components/members/form-errors.js +26 -13
- package/dist/components/members/form-errors.js.map +1 -1
- package/dist/components/members/workspace-members-section.d.ts.map +1 -1
- package/dist/components/members/workspace-members-section.js +31 -28
- package/dist/components/members/workspace-members-section.js.map +1 -1
- package/dist/core/membership.d.ts +41 -0
- package/dist/core/membership.d.ts.map +1 -0
- package/dist/core/membership.js +16 -0
- package/dist/core/membership.js.map +1 -0
- package/dist/feature.d.ts +15 -2
- package/dist/feature.d.ts.map +1 -1
- package/dist/feature.js +20 -18
- package/dist/feature.js.map +1 -1
- package/dist/hooks/api/create-invitation.d.ts +4 -2
- package/dist/hooks/api/create-invitation.d.ts.map +1 -1
- package/dist/hooks/api/create-invitation.js +6 -3
- package/dist/hooks/api/create-invitation.js.map +1 -1
- package/dist/hooks/api/invitation-mapper.d.ts +2 -2
- package/dist/hooks/api/invitation-mapper.d.ts.map +1 -1
- package/dist/hooks/api/invitation-mapper.js.map +1 -1
- package/dist/hooks/api/list-invitations.d.ts +5 -5
- package/dist/hooks/api/list-invitations.d.ts.map +1 -1
- package/dist/hooks/api/list-invitations.js.map +1 -1
- package/dist/hooks/api/list-members.d.ts +10 -11
- package/dist/hooks/api/list-members.d.ts.map +1 -1
- package/dist/hooks/api/list-members.js +11 -5
- package/dist/hooks/api/list-members.js.map +1 -1
- package/dist/hooks/api/membership-mapper.d.ts +4 -0
- package/dist/hooks/api/membership-mapper.d.ts.map +1 -0
- package/dist/hooks/api/membership-mapper.js +14 -0
- package/dist/hooks/api/membership-mapper.js.map +1 -0
- package/dist/hooks/api/remove-member.d.ts +2 -1
- package/dist/hooks/api/remove-member.d.ts.map +1 -1
- package/dist/hooks/api/remove-member.js +6 -8
- package/dist/hooks/api/remove-member.js.map +1 -1
- package/dist/hooks/api/revoke-invitation.d.ts +2 -1
- package/dist/hooks/api/revoke-invitation.d.ts.map +1 -1
- package/dist/hooks/api/revoke-invitation.js +4 -4
- package/dist/hooks/api/revoke-invitation.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +10 -11
- package/src/components/members/form-errors.test.ts +57 -4
- package/src/components/members/form-errors.ts +21 -10
- package/src/components/members/workspace-members-section.tsx +38 -35
- package/src/core/membership.test.ts +69 -0
- package/src/core/membership.ts +64 -0
- package/src/feature.ts +27 -20
- package/src/hooks/api/create-invitation.ts +8 -4
- package/src/hooks/api/invitation-mapper.ts +2 -2
- package/src/hooks/api/list-invitations.ts +2 -2
- package/src/hooks/api/list-members.ts +17 -7
- package/src/hooks/api/membership-mapper.test.ts +24 -0
- package/src/hooks/api/membership-mapper.ts +15 -0
- package/src/hooks/api/remove-member.ts +11 -8
- package/src/hooks/api/revoke-invitation.ts +11 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/core/invitation.d.ts +0 -15
- package/dist/core/invitation.d.ts.map +0 -1
- package/dist/core/invitation.js +0 -3
- package/dist/core/invitation.js.map +0 -1
- package/src/core/invitation.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-invitation.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/create-invitation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-invitation.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/create-invitation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,uBAAuB,EAAsB,MAAM,6BAA6B,CAAC;AAG9F,OAAO,KAAK,EAAC,uBAAuB,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAmBpF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,uBAAuB,CAEhG;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,iHAQtD"}
|
|
@@ -6,12 +6,15 @@ import { listInvitationsQueryOptions } from './list-invitations.js';
|
|
|
6
6
|
async function createInvitation(params) {
|
|
7
7
|
const response = await checkedApiRequest(invitationDtoSchema, `/workspaces/${params.workspaceId}/invitations`, {
|
|
8
8
|
method: 'POST',
|
|
9
|
-
body:
|
|
10
|
-
email: params.command.email
|
|
11
|
-
}
|
|
9
|
+
body: toCreateInvitationBody(params.command)
|
|
12
10
|
});
|
|
13
11
|
return toInvitation(response);
|
|
14
12
|
}
|
|
13
|
+
export function toCreateInvitationBody(command) {
|
|
14
|
+
return {
|
|
15
|
+
email: command.email
|
|
16
|
+
};
|
|
17
|
+
}
|
|
15
18
|
export function useCreateInvitation(workspaceId) {
|
|
16
19
|
const queryClient = useQueryClient();
|
|
17
20
|
return useMutation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/api/create-invitation.ts"],"sourcesContent":["import {invitationDtoSchema} from '@shipfox/api-workspaces-dto';\nimport {checkedApiRequest} from '@shipfox/client-api';\nimport {useMutation, useQueryClient} from '@tanstack/react-query';\nimport type {CreateInvitationCommand,
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/create-invitation.ts"],"sourcesContent":["import {type CreateInvitationBodyDto, invitationDtoSchema} from '@shipfox/api-workspaces-dto';\nimport {checkedApiRequest} from '@shipfox/client-api';\nimport {useMutation, useQueryClient} from '@tanstack/react-query';\nimport type {CreateInvitationCommand, PendingInvitation} from '#core/membership.js';\nimport {toInvitation} from './invitation-mapper.js';\nimport {listInvitationsQueryOptions} from './list-invitations.js';\n\nasync function createInvitation(params: {\n workspaceId: string;\n command: CreateInvitationCommand;\n}): Promise<PendingInvitation> {\n const response = await checkedApiRequest(\n invitationDtoSchema,\n `/workspaces/${params.workspaceId}/invitations`,\n {\n method: 'POST',\n body: toCreateInvitationBody(params.command),\n },\n );\n return toInvitation(response);\n}\n\nexport function toCreateInvitationBody(command: CreateInvitationCommand): CreateInvitationBodyDto {\n return {email: command.email};\n}\n\nexport function useCreateInvitation(workspaceId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (command: CreateInvitationCommand) => createInvitation({workspaceId, command}),\n onSuccess: async () => {\n await queryClient.invalidateQueries(listInvitationsQueryOptions(workspaceId));\n },\n });\n}\n"],"names":["invitationDtoSchema","checkedApiRequest","useMutation","useQueryClient","toInvitation","listInvitationsQueryOptions","createInvitation","params","response","workspaceId","method","body","toCreateInvitationBody","command","email","useCreateInvitation","queryClient","mutationFn","onSuccess","invalidateQueries"],"mappings":"AAAA,SAAsCA,mBAAmB,QAAO,8BAA8B;AAC9F,SAAQC,iBAAiB,QAAO,sBAAsB;AACtD,SAAQC,WAAW,EAAEC,cAAc,QAAO,wBAAwB;AAElE,SAAQC,YAAY,QAAO,yBAAyB;AACpD,SAAQC,2BAA2B,QAAO,wBAAwB;AAElE,eAAeC,iBAAiBC,MAG/B;IACC,MAAMC,WAAW,MAAMP,kBACrBD,qBACA,CAAC,YAAY,EAAEO,OAAOE,WAAW,CAAC,YAAY,CAAC,EAC/C;QACEC,QAAQ;QACRC,MAAMC,uBAAuBL,OAAOM,OAAO;IAC7C;IAEF,OAAOT,aAAaI;AACtB;AAEA,OAAO,SAASI,uBAAuBC,OAAgC;IACrE,OAAO;QAACC,OAAOD,QAAQC,KAAK;IAAA;AAC9B;AAEA,OAAO,SAASC,oBAAoBN,WAAmB;IACrD,MAAMO,cAAcb;IACpB,OAAOD,YAAY;QACjBe,YAAY,CAACJ,UAAqCP,iBAAiB;gBAACG;gBAAaI;YAAO;QACxFK,WAAW;YACT,MAAMF,YAAYG,iBAAiB,CAACd,4BAA4BI;QAClE;IACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { InvitationDto } from '@shipfox/api-workspaces-dto';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function toInvitation(dto: InvitationDto):
|
|
2
|
+
import type { PendingInvitation } from '#core/membership.js';
|
|
3
|
+
export declare function toInvitation(dto: InvitationDto): PendingInvitation;
|
|
4
4
|
//# sourceMappingURL=invitation-mapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitation-mapper.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/invitation-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"invitation-mapper.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/invitation-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAE3D,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,iBAAiB,CAYlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/api/invitation-mapper.ts"],"sourcesContent":["import type {InvitationDto} from '@shipfox/api-workspaces-dto';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/invitation-mapper.ts"],"sourcesContent":["import type {InvitationDto} from '@shipfox/api-workspaces-dto';\nimport type {PendingInvitation} from '#core/membership.js';\n\nexport function toInvitation(dto: InvitationDto): PendingInvitation {\n return {\n id: dto.id,\n workspaceId: dto.workspace_id,\n email: dto.email,\n expiresAt: dto.expires_at,\n acceptedAt: dto.accepted_at,\n invitedByUserId: dto.invited_by_user_id,\n invitedByDisplay: dto.invited_by_display,\n createdAt: dto.created_at,\n updatedAt: dto.updated_at,\n };\n}\n"],"names":["toInvitation","dto","id","workspaceId","workspace_id","email","expiresAt","expires_at","acceptedAt","accepted_at","invitedByUserId","invited_by_user_id","invitedByDisplay","invited_by_display","createdAt","created_at","updatedAt","updated_at"],"mappings":"AAGA,OAAO,SAASA,aAAaC,GAAkB;IAC7C,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,aAAaF,IAAIG,YAAY;QAC7BC,OAAOJ,IAAII,KAAK;QAChBC,WAAWL,IAAIM,UAAU;QACzBC,YAAYP,IAAIQ,WAAW;QAC3BC,iBAAiBT,IAAIU,kBAAkB;QACvCC,kBAAkBX,IAAIY,kBAAkB;QACxCC,WAAWb,IAAIc,UAAU;QACzBC,WAAWf,IAAIgB,UAAU;IAC3B;AACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PendingInvitation } from '#core/membership.js';
|
|
2
2
|
export declare const listInvitationsQueryKey: (workspaceId: string) => readonly ["workspaces", string, "invitations"];
|
|
3
|
-
export declare function listInvitationsQueryOptions(workspaceId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<
|
|
4
|
-
queryFn?: import("@tanstack/react-query").QueryFunction<
|
|
3
|
+
export declare function listInvitationsQueryOptions(workspaceId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<PendingInvitation[], Error, PendingInvitation[], readonly ["workspaces", string, "invitations"]>, "queryFn"> & {
|
|
4
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<PendingInvitation[], readonly ["workspaces", string, "invitations"], never>;
|
|
5
5
|
} & {
|
|
6
6
|
queryKey: readonly ["workspaces", string, "invitations"] & {
|
|
7
|
-
[dataTagSymbol]:
|
|
7
|
+
[dataTagSymbol]: PendingInvitation[];
|
|
8
8
|
[dataTagErrorSymbol]: Error;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export declare function useListInvitations(workspaceId: string): import("@tanstack/react-query").UseQueryResult<NoInfer<
|
|
11
|
+
export declare function useListInvitations(workspaceId: string): import("@tanstack/react-query").UseQueryResult<NoInfer<PendingInvitation[]>, Error>;
|
|
12
12
|
//# sourceMappingURL=list-invitations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-invitations.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/list-invitations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"list-invitations.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/list-invitations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAG3D,eAAO,MAAM,uBAAuB,GAAI,aAAa,MAAM,mDACN,CAAC;AAUtD,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM;;;;;;;EAK9D;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,uFAErD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/api/list-invitations.ts"],"sourcesContent":["import {listInvitationsResponseSchema} from '@shipfox/api-workspaces-dto';\nimport {checkedApiRequest} from '@shipfox/client-api';\nimport {queryOptions, useQuery} from '@tanstack/react-query';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/list-invitations.ts"],"sourcesContent":["import {listInvitationsResponseSchema} from '@shipfox/api-workspaces-dto';\nimport {checkedApiRequest} from '@shipfox/client-api';\nimport {queryOptions, useQuery} from '@tanstack/react-query';\nimport type {PendingInvitation} from '#core/membership.js';\nimport {toInvitation} from './invitation-mapper.js';\n\nexport const listInvitationsQueryKey = (workspaceId: string) =>\n ['workspaces', workspaceId, 'invitations'] as const;\n\nasync function listInvitations(workspaceId: string): Promise<PendingInvitation[]> {\n const response = await checkedApiRequest(\n listInvitationsResponseSchema,\n `/workspaces/${workspaceId}/invitations`,\n );\n return response.invitations.map(toInvitation);\n}\n\nexport function listInvitationsQueryOptions(workspaceId: string) {\n return queryOptions({\n queryKey: listInvitationsQueryKey(workspaceId),\n queryFn: () => listInvitations(workspaceId),\n });\n}\n\nexport function useListInvitations(workspaceId: string) {\n return useQuery(listInvitationsQueryOptions(workspaceId));\n}\n"],"names":["listInvitationsResponseSchema","checkedApiRequest","queryOptions","useQuery","toInvitation","listInvitationsQueryKey","workspaceId","listInvitations","response","invitations","map","listInvitationsQueryOptions","queryKey","queryFn","useListInvitations"],"mappings":"AAAA,SAAQA,6BAA6B,QAAO,8BAA8B;AAC1E,SAAQC,iBAAiB,QAAO,sBAAsB;AACtD,SAAQC,YAAY,EAAEC,QAAQ,QAAO,wBAAwB;AAE7D,SAAQC,YAAY,QAAO,yBAAyB;AAEpD,OAAO,MAAMC,0BAA0B,CAACC,cACtC;QAAC;QAAcA;QAAa;KAAc,CAAU;AAEtD,eAAeC,gBAAgBD,WAAmB;IAChD,MAAME,WAAW,MAAMP,kBACrBD,+BACA,CAAC,YAAY,EAAEM,YAAY,YAAY,CAAC;IAE1C,OAAOE,SAASC,WAAW,CAACC,GAAG,CAACN;AAClC;AAEA,OAAO,SAASO,4BAA4BL,WAAmB;IAC7D,OAAOJ,aAAa;QAClBU,UAAUP,wBAAwBC;QAClCO,SAAS,IAAMN,gBAAgBD;IACjC;AACF;AAEA,OAAO,SAASQ,mBAAmBR,WAAmB;IACpD,OAAOH,SAASQ,4BAA4BL;AAC9C"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import type { WorkspaceMember } from '#core/membership.js';
|
|
1
2
|
export declare const listMembersQueryKey: (workspaceId: string) => readonly ["workspaces", string, "members"];
|
|
2
|
-
export declare function
|
|
3
|
-
members
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}[];
|
|
12
|
-
}>, Error>;
|
|
3
|
+
export declare function listMembersQueryOptions(workspaceId: string): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<WorkspaceMember[], Error, WorkspaceMember[], readonly ["workspaces", string, "members"]>, "queryFn"> & {
|
|
4
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<WorkspaceMember[], readonly ["workspaces", string, "members"], never>;
|
|
5
|
+
} & {
|
|
6
|
+
queryKey: readonly ["workspaces", string, "members"] & {
|
|
7
|
+
[dataTagSymbol]: WorkspaceMember[];
|
|
8
|
+
[dataTagErrorSymbol]: Error;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function useListMembers(workspaceId: string): import("@tanstack/react-query").UseQueryResult<NoInfer<WorkspaceMember[]>, Error>;
|
|
13
12
|
//# sourceMappingURL=list-members.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-members.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/list-members.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-members.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/list-members.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAGzD,eAAO,MAAM,mBAAmB,GAAI,aAAa,MAAM,+CACN,CAAC;AAUlD,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM;;;;;;;EAK1D;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,qFAEjD"}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { listMembersResponseSchema } from '@shipfox/api-workspaces-dto';
|
|
2
|
+
import { checkedApiRequest } from '@shipfox/client-api';
|
|
3
|
+
import { queryOptions, useQuery } from '@tanstack/react-query';
|
|
4
|
+
import { toWorkspaceMember } from './membership-mapper.js';
|
|
3
5
|
export const listMembersQueryKey = (workspaceId)=>[
|
|
4
6
|
'workspaces',
|
|
5
7
|
workspaceId,
|
|
6
8
|
'members'
|
|
7
9
|
];
|
|
8
10
|
async function listMembers(workspaceId) {
|
|
9
|
-
|
|
11
|
+
const response = await checkedApiRequest(listMembersResponseSchema, `/workspaces/${workspaceId}/members`);
|
|
12
|
+
return response.members.map(toWorkspaceMember);
|
|
10
13
|
}
|
|
11
|
-
export function
|
|
12
|
-
return
|
|
14
|
+
export function listMembersQueryOptions(workspaceId) {
|
|
15
|
+
return queryOptions({
|
|
13
16
|
queryKey: listMembersQueryKey(workspaceId),
|
|
14
17
|
queryFn: ()=>listMembers(workspaceId)
|
|
15
18
|
});
|
|
16
19
|
}
|
|
20
|
+
export function useListMembers(workspaceId) {
|
|
21
|
+
return useQuery(listMembersQueryOptions(workspaceId));
|
|
22
|
+
}
|
|
17
23
|
|
|
18
24
|
//# sourceMappingURL=list-members.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/api/list-members.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/list-members.ts"],"sourcesContent":["import {listMembersResponseSchema} from '@shipfox/api-workspaces-dto';\nimport {checkedApiRequest} from '@shipfox/client-api';\nimport {queryOptions, useQuery} from '@tanstack/react-query';\nimport type {WorkspaceMember} from '#core/membership.js';\nimport {toWorkspaceMember} from './membership-mapper.js';\n\nexport const listMembersQueryKey = (workspaceId: string) =>\n ['workspaces', workspaceId, 'members'] as const;\n\nasync function listMembers(workspaceId: string): Promise<WorkspaceMember[]> {\n const response = await checkedApiRequest(\n listMembersResponseSchema,\n `/workspaces/${workspaceId}/members`,\n );\n return response.members.map(toWorkspaceMember);\n}\n\nexport function listMembersQueryOptions(workspaceId: string) {\n return queryOptions({\n queryKey: listMembersQueryKey(workspaceId),\n queryFn: () => listMembers(workspaceId),\n });\n}\n\nexport function useListMembers(workspaceId: string) {\n return useQuery(listMembersQueryOptions(workspaceId));\n}\n"],"names":["listMembersResponseSchema","checkedApiRequest","queryOptions","useQuery","toWorkspaceMember","listMembersQueryKey","workspaceId","listMembers","response","members","map","listMembersQueryOptions","queryKey","queryFn","useListMembers"],"mappings":"AAAA,SAAQA,yBAAyB,QAAO,8BAA8B;AACtE,SAAQC,iBAAiB,QAAO,sBAAsB;AACtD,SAAQC,YAAY,EAAEC,QAAQ,QAAO,wBAAwB;AAE7D,SAAQC,iBAAiB,QAAO,yBAAyB;AAEzD,OAAO,MAAMC,sBAAsB,CAACC,cAClC;QAAC;QAAcA;QAAa;KAAU,CAAU;AAElD,eAAeC,YAAYD,WAAmB;IAC5C,MAAME,WAAW,MAAMP,kBACrBD,2BACA,CAAC,YAAY,EAAEM,YAAY,QAAQ,CAAC;IAEtC,OAAOE,SAASC,OAAO,CAACC,GAAG,CAACN;AAC9B;AAEA,OAAO,SAASO,wBAAwBL,WAAmB;IACzD,OAAOJ,aAAa;QAClBU,UAAUP,oBAAoBC;QAC9BO,SAAS,IAAMN,YAAYD;IAC7B;AACF;AAEA,OAAO,SAASQ,eAAeR,WAAmB;IAChD,OAAOH,SAASQ,wBAAwBL;AAC1C"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MembershipWithUserDto } from '@shipfox/api-workspaces-dto';
|
|
2
|
+
import type { WorkspaceMember } from '#core/membership.js';
|
|
3
|
+
export declare function toWorkspaceMember(dto: MembershipWithUserDto): WorkspaceMember;
|
|
4
|
+
//# sourceMappingURL=membership-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"membership-mapper.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/membership-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,GAAG,eAAe,CAW7E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function toWorkspaceMember(dto) {
|
|
2
|
+
return {
|
|
3
|
+
id: dto.id,
|
|
4
|
+
userId: dto.user_id,
|
|
5
|
+
workspaceId: dto.workspace_id,
|
|
6
|
+
email: dto.user_email,
|
|
7
|
+
name: dto.user_name,
|
|
8
|
+
role: 'admin',
|
|
9
|
+
joinedAt: dto.created_at,
|
|
10
|
+
updatedAt: dto.updated_at
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=membership-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/membership-mapper.ts"],"sourcesContent":["import type {MembershipWithUserDto} from '@shipfox/api-workspaces-dto';\nimport type {WorkspaceMember} from '#core/membership.js';\n\nexport function toWorkspaceMember(dto: MembershipWithUserDto): WorkspaceMember {\n return {\n id: dto.id,\n userId: dto.user_id,\n workspaceId: dto.workspace_id,\n email: dto.user_email,\n name: dto.user_name,\n role: 'admin',\n joinedAt: dto.created_at,\n updatedAt: dto.updated_at,\n };\n}\n"],"names":["toWorkspaceMember","dto","id","userId","user_id","workspaceId","workspace_id","email","user_email","name","user_name","role","joinedAt","created_at","updatedAt","updated_at"],"mappings":"AAGA,OAAO,SAASA,kBAAkBC,GAA0B;IAC1D,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,QAAQF,IAAIG,OAAO;QACnBC,aAAaJ,IAAIK,YAAY;QAC7BC,OAAON,IAAIO,UAAU;QACrBC,MAAMR,IAAIS,SAAS;QACnBC,MAAM;QACNC,UAAUX,IAAIY,UAAU;QACxBC,WAAWb,IAAIc,UAAU;IAC3B;AACF"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { RemoveWorkspaceMemberCommand } from '#core/membership.js';
|
|
2
|
+
export declare function useRemoveMember(workspaceId: string): import("@tanstack/react-query").UseMutationResult<void, Error, RemoveWorkspaceMemberCommand, unknown>;
|
|
2
3
|
//# sourceMappingURL=remove-member.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-member.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/remove-member.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remove-member.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/remove-member.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,qBAAqB,CAAC;AAWtE,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,yGAQlD"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { checkedApiRequest, emptyResponseSchema } from '@shipfox/client-api';
|
|
2
2
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
3
|
-
import {
|
|
3
|
+
import { listMembersQueryOptions } from './list-members.js';
|
|
4
4
|
async function removeMember(params) {
|
|
5
|
-
await
|
|
5
|
+
await checkedApiRequest(emptyResponseSchema, `/workspaces/${params.workspaceId}/members/${params.command.userId}`, {
|
|
6
6
|
method: 'DELETE'
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
9
|
export function useRemoveMember(workspaceId) {
|
|
10
10
|
const queryClient = useQueryClient();
|
|
11
11
|
return useMutation({
|
|
12
|
-
mutationFn: (
|
|
12
|
+
mutationFn: (command)=>removeMember({
|
|
13
13
|
workspaceId,
|
|
14
|
-
|
|
14
|
+
command
|
|
15
15
|
}),
|
|
16
16
|
onSuccess: async ()=>{
|
|
17
|
-
await queryClient.invalidateQueries(
|
|
18
|
-
queryKey: listMembersQueryKey(workspaceId)
|
|
19
|
-
});
|
|
17
|
+
await queryClient.invalidateQueries(listMembersQueryOptions(workspaceId));
|
|
20
18
|
}
|
|
21
19
|
});
|
|
22
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/api/remove-member.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/remove-member.ts"],"sourcesContent":["import {checkedApiRequest, emptyResponseSchema} from '@shipfox/client-api';\nimport {useMutation, useQueryClient} from '@tanstack/react-query';\nimport type {RemoveWorkspaceMemberCommand} from '#core/membership.js';\nimport {listMembersQueryOptions} from './list-members.js';\n\nasync function removeMember(params: {workspaceId: string; command: RemoveWorkspaceMemberCommand}) {\n await checkedApiRequest(\n emptyResponseSchema,\n `/workspaces/${params.workspaceId}/members/${params.command.userId}`,\n {method: 'DELETE'},\n );\n}\n\nexport function useRemoveMember(workspaceId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (command: RemoveWorkspaceMemberCommand) => removeMember({workspaceId, command}),\n onSuccess: async () => {\n await queryClient.invalidateQueries(listMembersQueryOptions(workspaceId));\n },\n });\n}\n"],"names":["checkedApiRequest","emptyResponseSchema","useMutation","useQueryClient","listMembersQueryOptions","removeMember","params","workspaceId","command","userId","method","useRemoveMember","queryClient","mutationFn","onSuccess","invalidateQueries"],"mappings":"AAAA,SAAQA,iBAAiB,EAAEC,mBAAmB,QAAO,sBAAsB;AAC3E,SAAQC,WAAW,EAAEC,cAAc,QAAO,wBAAwB;AAElE,SAAQC,uBAAuB,QAAO,oBAAoB;AAE1D,eAAeC,aAAaC,MAAoE;IAC9F,MAAMN,kBACJC,qBACA,CAAC,YAAY,EAAEK,OAAOC,WAAW,CAAC,SAAS,EAAED,OAAOE,OAAO,CAACC,MAAM,EAAE,EACpE;QAACC,QAAQ;IAAQ;AAErB;AAEA,OAAO,SAASC,gBAAgBJ,WAAmB;IACjD,MAAMK,cAAcT;IACpB,OAAOD,YAAY;QACjBW,YAAY,CAACL,UAA0CH,aAAa;gBAACE;gBAAaC;YAAO;QACzFM,WAAW;YACT,MAAMF,YAAYG,iBAAiB,CAACX,wBAAwBG;QAC9D;IACF;AACF"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { RevokeInvitationCommand } from '#core/membership.js';
|
|
2
|
+
export declare function useRevokeInvitation(workspaceId: string): import("@tanstack/react-query").UseMutationResult<void, Error, RevokeInvitationCommand, unknown>;
|
|
2
3
|
//# sourceMappingURL=revoke-invitation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revoke-invitation.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/revoke-invitation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"revoke-invitation.d.ts","sourceRoot":"","sources":["../../../src/hooks/api/revoke-invitation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AAajE,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,oGAQtD"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { checkedApiRequest, emptyResponseSchema } from '@shipfox/client-api';
|
|
2
2
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { listInvitationsQueryOptions } from './list-invitations.js';
|
|
4
4
|
async function revokeInvitation(params) {
|
|
5
|
-
await
|
|
5
|
+
await checkedApiRequest(emptyResponseSchema, `/workspaces/${params.workspaceId}/invitations/${params.command.invitationId}`, {
|
|
6
6
|
method: 'DELETE'
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
9
|
export function useRevokeInvitation(workspaceId) {
|
|
10
10
|
const queryClient = useQueryClient();
|
|
11
11
|
return useMutation({
|
|
12
|
-
mutationFn: (
|
|
12
|
+
mutationFn: (command)=>revokeInvitation({
|
|
13
13
|
workspaceId,
|
|
14
|
-
|
|
14
|
+
command
|
|
15
15
|
}),
|
|
16
16
|
onSuccess: async ()=>{
|
|
17
17
|
await queryClient.invalidateQueries(listInvitationsQueryOptions(workspaceId));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/api/revoke-invitation.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/api/revoke-invitation.ts"],"sourcesContent":["import {checkedApiRequest, emptyResponseSchema} from '@shipfox/client-api';\nimport {useMutation, useQueryClient} from '@tanstack/react-query';\nimport type {RevokeInvitationCommand} from '#core/membership.js';\nimport {listInvitationsQueryOptions} from './list-invitations.js';\n\nasync function revokeInvitation(params: {workspaceId: string; command: RevokeInvitationCommand}) {\n await checkedApiRequest(\n emptyResponseSchema,\n `/workspaces/${params.workspaceId}/invitations/${params.command.invitationId}`,\n {\n method: 'DELETE',\n },\n );\n}\n\nexport function useRevokeInvitation(workspaceId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (command: RevokeInvitationCommand) => revokeInvitation({workspaceId, command}),\n onSuccess: async () => {\n await queryClient.invalidateQueries(listInvitationsQueryOptions(workspaceId));\n },\n });\n}\n"],"names":["checkedApiRequest","emptyResponseSchema","useMutation","useQueryClient","listInvitationsQueryOptions","revokeInvitation","params","workspaceId","command","invitationId","method","useRevokeInvitation","queryClient","mutationFn","onSuccess","invalidateQueries"],"mappings":"AAAA,SAAQA,iBAAiB,EAAEC,mBAAmB,QAAO,sBAAsB;AAC3E,SAAQC,WAAW,EAAEC,cAAc,QAAO,wBAAwB;AAElE,SAAQC,2BAA2B,QAAO,wBAAwB;AAElE,eAAeC,iBAAiBC,MAA+D;IAC7F,MAAMN,kBACJC,qBACA,CAAC,YAAY,EAAEK,OAAOC,WAAW,CAAC,aAAa,EAAED,OAAOE,OAAO,CAACC,YAAY,EAAE,EAC9E;QACEC,QAAQ;IACV;AAEJ;AAEA,OAAO,SAASC,oBAAoBJ,WAAmB;IACrD,MAAMK,cAAcT;IACpB,OAAOD,YAAY;QACjBW,YAAY,CAACL,UAAqCH,iBAAiB;gBAACE;gBAAaC;YAAO;QACxFM,WAAW;YACT,MAAMF,YAAYG,iBAAiB,CAACX,4BAA4BG;QAClE;IACF;AACF"}
|