mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 21:51:56 +00:00
feat(infisical-pg): fixing minor compatiability issues with frontend and backend on identity
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
export enum IdentityAuthMethod {
|
||||
UNIVERSAL_AUTH = "universal-auth"
|
||||
}
|
||||
UNIVERSAL_AUTH = "universal"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export type IntegrationAuth = {
|
||||
id: string;
|
||||
integration: string;
|
||||
workspace: string;
|
||||
projectId: string;
|
||||
__v: number;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
|
||||
@@ -11,8 +11,9 @@ export type TCloudIntegration = {
|
||||
|
||||
export type TIntegration = {
|
||||
id: string;
|
||||
workspace: string;
|
||||
environment: string;
|
||||
projectId: string;
|
||||
envId: string;
|
||||
environment: { slug: string; name: string; id: string };
|
||||
isActive: boolean;
|
||||
url: any;
|
||||
app: string;
|
||||
|
||||
@@ -15,7 +15,7 @@ const serviceTokenKeys = {
|
||||
|
||||
const fetchWorkspaceServiceTokens = async (workspaceID: string) => {
|
||||
const { data } = await apiRequest.get<{ serviceTokenData: ServiceToken[] }>(
|
||||
`/api/v2/workspace/${workspaceID}/service-token-data`
|
||||
`/api/v1/workspace/${workspaceID}/service-token-data`
|
||||
);
|
||||
|
||||
return data.serviceTokenData;
|
||||
@@ -29,10 +29,11 @@ export const useGetUserWsServiceTokens = ({ workspaceID }: UseGetWorkspaceServic
|
||||
queryFn: () => fetchWorkspaceServiceTokens(workspaceID),
|
||||
enabled: Boolean(workspaceID)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// mutation
|
||||
export const useCreateServiceToken = () => { // TODO: deprecate
|
||||
export const useCreateServiceToken = () => {
|
||||
// TODO: deprecate
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<CreateServiceTokenRes, {}, CreateServiceTokenDTO>({
|
||||
@@ -41,8 +42,8 @@ export const useCreateServiceToken = () => { // TODO: deprecate
|
||||
data.serviceToken += `.${body.randomBytes}`;
|
||||
return data;
|
||||
},
|
||||
onSuccess: ({ serviceTokenData: { workspace } }) => {
|
||||
queryClient.invalidateQueries(serviceTokenKeys.getAllWorkspaceServiceToken(workspace));
|
||||
onSuccess: ({ serviceTokenData: { projectId } }) => {
|
||||
queryClient.invalidateQueries(serviceTokenKeys.getAllWorkspaceServiceToken(projectId));
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -55,8 +56,8 @@ export const useDeleteServiceToken = () => {
|
||||
const { data } = await apiRequest.delete(`/api/v2/service-token/${serviceTokenId}`);
|
||||
return data;
|
||||
},
|
||||
onSuccess: ({ serviceTokenData: { workspace } }) => {
|
||||
queryClient.invalidateQueries(serviceTokenKeys.getAllWorkspaceServiceToken(workspace));
|
||||
onSuccess: ({ serviceTokenData: { projectId } }) => {
|
||||
queryClient.invalidateQueries(serviceTokenKeys.getAllWorkspaceServiceToken(projectId));
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ export type ServiceTokenScope = {
|
||||
export type ServiceToken = {
|
||||
id: string;
|
||||
name: string;
|
||||
workspace: string;
|
||||
projectId: string;
|
||||
scopes: ServiceTokenScope[];
|
||||
user: string;
|
||||
expiresAt: string;
|
||||
|
||||
@@ -2,13 +2,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import {
|
||||
CreateTagDTO,
|
||||
CreateTagRes,
|
||||
DeleteTagDTO,
|
||||
DeleteWsTagRes,
|
||||
UserWsTags,
|
||||
} from "./types";
|
||||
import { CreateTagDTO, DeleteTagDTO, UserWsTags, WsTag } from "./types";
|
||||
|
||||
const workspaceTags = {
|
||||
getWsTags: (workspaceID: string) => ["workspace-tags", { workspaceID }] as const
|
||||
@@ -16,7 +10,7 @@ const workspaceTags = {
|
||||
|
||||
const fetchWsTag = async (workspaceID: string) => {
|
||||
const { data } = await apiRequest.get<{ workspaceTags: UserWsTags }>(
|
||||
`/api/v2/workspace/${workspaceID}/tags`
|
||||
`/api/v1/workspace/${workspaceID}/tags`
|
||||
);
|
||||
|
||||
return data.workspaceTags;
|
||||
@@ -28,38 +22,41 @@ export const useGetWsTags = (workspaceID: string) => {
|
||||
queryFn: () => fetchWsTag(workspaceID),
|
||||
enabled: Boolean(workspaceID)
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const useCreateWsTag = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<CreateTagRes, {}, CreateTagDTO>({
|
||||
return useMutation<WsTag, {}, CreateTagDTO>({
|
||||
mutationFn: async ({ workspaceID, tagName, tagColor, tagSlug }) => {
|
||||
const { data } = await apiRequest.post(`/api/v2/workspace/${workspaceID}/tags`, {
|
||||
name: tagName,
|
||||
tagColor: tagColor || "",
|
||||
slug: tagSlug
|
||||
})
|
||||
return data;
|
||||
const { data } = await apiRequest.post<{ workspaceTag: WsTag }>(
|
||||
`/api/v1/workspace/${workspaceID}/tags`,
|
||||
{
|
||||
name: tagName,
|
||||
color: tagColor || "",
|
||||
slug: tagSlug
|
||||
}
|
||||
);
|
||||
return data.workspaceTag;
|
||||
},
|
||||
onSuccess: (tagData) => {
|
||||
queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.workspace));
|
||||
queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.projectId));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export const useDeleteWsTag = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation<DeleteWsTagRes, {}, DeleteTagDTO>({
|
||||
mutationFn: async ({ tagID }) => {
|
||||
const { data } = await apiRequest.delete(`/api/v2/workspace/tags/${tagID}`);
|
||||
return data
|
||||
return useMutation<WsTag, {}, DeleteTagDTO>({
|
||||
mutationFn: async ({ tagID, projectId }) => {
|
||||
const { data } = await apiRequest.delete<{ workspaceTag: WsTag }>(
|
||||
`/api/v1/workspace/${projectId}/tags/${tagID}`
|
||||
);
|
||||
return data.workspaceTag;
|
||||
},
|
||||
onSuccess: (tagData) => {
|
||||
queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.workspace));
|
||||
queryClient.invalidateQueries(workspaceTags.getWsTags(tagData?.projectId));
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -4,8 +4,8 @@ export type WsTag = {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
tagColor?: string;
|
||||
workspace: string;
|
||||
color?: string;
|
||||
projectId: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
__v: number;
|
||||
@@ -20,26 +20,7 @@ export type CreateTagDTO = {
|
||||
tagColor: string;
|
||||
};
|
||||
|
||||
export type CreateTagRes = {
|
||||
name: string;
|
||||
slug: string;
|
||||
workspace: string;
|
||||
createdAt: string;
|
||||
tagColor?: string;
|
||||
user: string;
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type DeleteTagDTO = { tagID: string };
|
||||
|
||||
export type DeleteWsTagRes = {
|
||||
name: string;
|
||||
slug: string;
|
||||
workspace: string;
|
||||
createdAt: string;
|
||||
user: string;
|
||||
id: string;
|
||||
};
|
||||
export type DeleteTagDTO = { tagID: string; projectId: string };
|
||||
|
||||
export type SecretTags = {
|
||||
id: string;
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
export type TWebhook = {
|
||||
id: string;
|
||||
workspace: string;
|
||||
environment: string;
|
||||
projectId: string;
|
||||
environment: {
|
||||
slug: string;
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
envId: string;
|
||||
secretPath: string;
|
||||
url: string;
|
||||
lastStatus: "success" | "failed";
|
||||
|
||||
Reference in New Issue
Block a user