mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 15:40:47 +00:00
App connection updates
This commit is contained in:
@@ -39,10 +39,10 @@ import {
|
||||
VercelConnectionMethod,
|
||||
WindmillConnectionMethod
|
||||
} from "@app/hooks/api/appConnections/types";
|
||||
import { BitBucketConnectionMethod } from "@app/hooks/api/appConnections/types/bitbucket-connection";
|
||||
import { HerokuConnectionMethod } from "@app/hooks/api/appConnections/types/heroku-connection";
|
||||
import { OCIConnectionMethod } from "@app/hooks/api/appConnections/types/oci-connection";
|
||||
import { RenderConnectionMethod } from "@app/hooks/api/appConnections/types/render-connection";
|
||||
import { BitBucketConnectionMethod } from "@app/hooks/api/appConnections/types/bitbucket-connection";
|
||||
|
||||
export const APP_CONNECTION_MAP: Record<
|
||||
AppConnection,
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { appConnectionKeys } from "../queries";
|
||||
import { TBitBucketConnectionListRepositoriesResponse, TBitBucketRepo } from "./types";
|
||||
|
||||
const bitBucketConnectionKeys = {
|
||||
all: [...appConnectionKeys.all, "bitbucket"] as const,
|
||||
listRepos: (connectionId: string) =>
|
||||
[...bitBucketConnectionKeys.all, "repos", connectionId] as const
|
||||
};
|
||||
|
||||
export const useBitBucketConnectionListRepositories = (
|
||||
connectionId: string,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
TBitBucketRepo[],
|
||||
unknown,
|
||||
TBitBucketRepo[],
|
||||
ReturnType<typeof bitBucketConnectionKeys.listRepos>
|
||||
>,
|
||||
"queryKey" | "queryFn"
|
||||
>
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: bitBucketConnectionKeys.listRepos(connectionId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<TBitBucketConnectionListRepositoriesResponse>(
|
||||
`/api/v1/app-connections/bitbucket/${connectionId}/repositories`
|
||||
);
|
||||
|
||||
return data.repositories;
|
||||
},
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
export type TBitBucketRepo = {
|
||||
id: string;
|
||||
name: string; // workspace-slug/repo-slug
|
||||
};
|
||||
|
||||
export type TBitBucketConnectionListRepositoriesResponse = {
|
||||
repositories: TBitBucketRepo[];
|
||||
};
|
||||
|
||||
@@ -38,6 +38,7 @@ export * from "./azure-app-configuration-connection";
|
||||
export * from "./azure-client-secrets-connection";
|
||||
export * from "./azure-devops-connection";
|
||||
export * from "./azure-key-vault-connection";
|
||||
export * from "./bitbucket-connection";
|
||||
export * from "./camunda-connection";
|
||||
export * from "./cloudflare-connection";
|
||||
export * from "./databricks-connection";
|
||||
@@ -60,7 +61,6 @@ export * from "./teamcity-connection";
|
||||
export * from "./terraform-cloud-connection";
|
||||
export * from "./vercel-connection";
|
||||
export * from "./windmill-connection";
|
||||
export * from "./bitbucket-connection";
|
||||
|
||||
export type TAppConnection =
|
||||
| TAwsConnection
|
||||
|
||||
+1
-1
@@ -16,6 +16,7 @@ import { AzureAppConfigurationConnectionForm } from "./AzureAppConfigurationConn
|
||||
import { AzureClientSecretsConnectionForm } from "./AzureClientSecretsConnectionForm";
|
||||
import { AzureDevOpsConnectionForm } from "./AzureDevOpsConnectionForm";
|
||||
import { AzureKeyVaultConnectionForm } from "./AzureKeyVaultConnectionForm";
|
||||
import { BitBucketConnectionForm } from "./BitBucketConnectionForm";
|
||||
import { CamundaConnectionForm } from "./CamundaConnectionForm";
|
||||
import { CloudflareConnectionForm } from "./CloudflareConnectionForm";
|
||||
import { DatabricksConnectionForm } from "./DatabricksConnectionForm";
|
||||
@@ -38,7 +39,6 @@ import { TeamCityConnectionForm } from "./TeamCityConnectionForm";
|
||||
import { TerraformCloudConnectionForm } from "./TerraformCloudConnectionForm";
|
||||
import { VercelConnectionForm } from "./VercelConnectionForm";
|
||||
import { WindmillConnectionForm } from "./WindmillConnectionForm";
|
||||
import { BitBucketConnectionForm } from "./BitBucketConnectionForm";
|
||||
|
||||
type FormProps = {
|
||||
onComplete: (appConnection: TAppConnection) => void;
|
||||
|
||||
Reference in New Issue
Block a user