App connection updates

This commit is contained in:
x032205
2025-07-03 00:00:50 -04:00
parent 62ad82f7b1
commit ae35a863bc
10 changed files with 127 additions and 22 deletions
@@ -1,9 +1,14 @@
import { z } from "zod";
import { readLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
import {
CreateBitBucketConnectionSchema,
SanitizedBitBucketConnectionSchema,
UpdateBitBucketConnectionSchema
} from "@app/services/app-connection/bitbucket";
import { AuthMode } from "@app/services/auth/auth-type";
import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
@@ -15,4 +20,32 @@ export const registerBitBucketConnectionRouter = async (server: FastifyZodProvid
createSchema: CreateBitBucketConnectionSchema,
updateSchema: UpdateBitBucketConnectionSchema
});
// The below endpoints are not exposed and for Infisical App use
server.route({
method: "GET",
url: `/:connectionId/repositories`,
config: {
rateLimit: readLimit
},
schema: {
params: z.object({
connectionId: z.string().uuid()
}),
response: {
200: z.object({
repositories: z.object({ id: z.string(), name: z.string() }).array()
})
}
},
onRequest: verifyAuth([AuthMode.JWT]),
handler: async (req) => {
const { connectionId } = req.params;
const repositories = await server.services.appConnection.bitbucket.listRepositories(connectionId, req.permission);
return { repositories };
}
});
};