Add Humanitec secret sync integration

This commit is contained in:
carlosmonastyrski
2025-03-12 16:23:59 -03:00
parent 765be2d99d
commit 79d8a9debb
57 changed files with 1117 additions and 28 deletions
@@ -0,0 +1,2 @@
export * from "./queries";
export * from "./types";
@@ -0,0 +1,37 @@
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { appConnectionKeys } from "../queries";
import { THumanitecOrganization } from "./types";
const humanitecConnectionKeys = {
all: [...appConnectionKeys.all, "humanitec"] as const,
listOrganizations: (connectionId: string) =>
[...humanitecConnectionKeys.all, "organizations", connectionId] as const
};
export const useHumanitecConnectionListOrganizations = (
connectionId: string,
options?: Omit<
UseQueryOptions<
THumanitecOrganization[],
unknown,
THumanitecOrganization[],
ReturnType<typeof humanitecConnectionKeys.listOrganizations>
>,
"queryKey" | "queryFn"
>
) => {
return useQuery({
queryKey: humanitecConnectionKeys.listOrganizations(connectionId),
queryFn: async () => {
const { data } = await apiRequest.get<THumanitecOrganization[]>(
`/api/v1/app-connections/humanitec/${connectionId}/organizations`
);
return data;
},
...options
});
};
@@ -0,0 +1,15 @@
export type THumanitecOrganization = {
name: string;
id: string;
apps: THumanitecApp[];
};
export type THumanitecApp = {
id: string;
name: string;
envs: { id: string; name: string }[];
};
export type THumanitecConnectionApp = {
id: string;
};