style: auto-fix lint and format
This commit is contained in:
1 parent
77884a3179
commit
8c51a3769e
3 files changed
+30
-25
No files matched your search
@@ -11,10 +11,7 @@ import { throwIfActionForbiddenAsync } from "../board/board-access";
|
||||
|
||||
const secretKindSchema = z.enum(releaseProviderKinds);
|
||||
|
||||
const resolveItemWithBoardAccess = async (
|
||||
ctx: { db: any; session: any },
|
||||
itemId: string,
|
||||
) => {
|
||||
const resolveItemWithBoardAccess = async (ctx: { db: any; session: any }, itemId: string) => {
|
||||
const item = await ctx.db.query.items.findFirst({ where: eq(items.id, itemId) });
|
||||
if (!item || item.kind !== "releases") throw new TRPCError({ code: "NOT_FOUND" });
|
||||
await throwIfActionForbiddenAsync(ctx, eq(boards.id, item.boardId), "modify");
|
||||
@@ -49,15 +46,13 @@ export const widgetSecretsRouter = createTRPCRouter({
|
||||
.where(and(eq(widgetSecrets.itemId, input.itemId), eq(widgetSecrets.kind, input.kind)));
|
||||
}),
|
||||
|
||||
getConfiguredKinds: protectedProcedure
|
||||
.input(z.object({ itemId: z.string() }))
|
||||
.query(async ({ ctx, input }) => {
|
||||
await resolveItemWithBoardAccess(ctx, input.itemId);
|
||||
getConfiguredKinds: protectedProcedure.input(z.object({ itemId: z.string() })).query(async ({ ctx, input }) => {
|
||||
await resolveItemWithBoardAccess(ctx, input.itemId);
|
||||
|
||||
const secrets = await ctx.db.query.widgetSecrets.findMany({
|
||||
where: eq(widgetSecrets.itemId, input.itemId),
|
||||
columns: { kind: true },
|
||||
});
|
||||
return secrets.map((s: { kind: string }) => s.kind);
|
||||
}),
|
||||
const secrets = await ctx.db.query.widgetSecrets.findMany({
|
||||
where: eq(widgetSecrets.itemId, input.itemId),
|
||||
columns: { kind: true },
|
||||
});
|
||||
return secrets.map((s: { kind: string }) => s.kind);
|
||||
}),
|
||||
});
|
||||
@@ -174,7 +174,7 @@ const getGitHubContainerRegistryReleaseAsync = async (
|
||||
try {
|
||||
const repositoryName = `${parsed.owner}/${parsed.name}`;
|
||||
const registryUrl = new URL(baseUrl);
|
||||
const registryToken = token ?? await getGitHubContainerRegistryTokenAsync(registryUrl, repositoryName);
|
||||
const registryToken = token ?? (await getGitHubContainerRegistryTokenAsync(registryUrl, repositoryName));
|
||||
const tags = await getGitHubContainerRegistryTagsAsync(registryUrl, repositoryName, registryToken);
|
||||
const matchingTags = versionRegex ? tags.filter((tag) => new RegExp(versionRegex).test(tag)) : tags;
|
||||
const tagsToCheck = versionRegex
|
||||
@@ -187,7 +187,12 @@ const getGitHubContainerRegistryReleaseAsync = async (
|
||||
const releases = await Promise.all(
|
||||
tagsToCheck.map(async (tag) => ({
|
||||
latestRelease: tag,
|
||||
latestReleaseAt: await getGitHubContainerRegistryTagCreatedAtAsync(registryUrl, repositoryName, tag, registryToken),
|
||||
latestReleaseAt: await getGitHubContainerRegistryTagCreatedAtAsync(
|
||||
registryUrl,
|
||||
repositoryName,
|
||||
tag,
|
||||
registryToken,
|
||||
),
|
||||
releaseUrl: `https://github.com/${repositoryName}/pkgs/container/${encodeURIComponent(parsed.name)}`,
|
||||
})),
|
||||
);
|
||||
@@ -445,7 +450,11 @@ const getGitlabReleaseAsync = async (
|
||||
return { success: true, data: { ...details, ...latestRelease } };
|
||||
};
|
||||
|
||||
const getGitlabDetailsAsync = async (baseUrl: string, encodedIdentifier: string, token?: string): Promise<DetailsProviderResponse> => {
|
||||
const getGitlabDetailsAsync = async (
|
||||
baseUrl: string,
|
||||
encodedIdentifier: string,
|
||||
token?: string,
|
||||
): Promise<DetailsProviderResponse> => {
|
||||
const headers: Record<string, string> = {};
|
||||
if (token) headers["PRIVATE-TOKEN"] = token;
|
||||
|
||||
|
||||
@@ -257,15 +257,16 @@ export const WidgetMultiReleasesRepositoriesInput = ({
|
||||
);
|
||||
};
|
||||
|
||||
const providersWithAuth: ReleaseProviderKind[] = ["github", "gitHubContainerRegistry", "dockerHub", "gitlab", "npm", "codeberg"];
|
||||
const providersWithAuth: ReleaseProviderKind[] = [
|
||||
"github",
|
||||
"gitHubContainerRegistry",
|
||||
"dockerHub",
|
||||
"gitlab",
|
||||
"npm",
|
||||
"codeberg",
|
||||
];
|
||||
|
||||
const ProviderTokensSection = ({
|
||||
itemId,
|
||||
repositories,
|
||||
}: {
|
||||
itemId: string;
|
||||
repositories: ReleasesRepository[];
|
||||
}) => {
|
||||
const ProviderTokensSection = ({ itemId, repositories }: { itemId: string; repositories: ReleasesRepository[] }) => {
|
||||
const tRepository = useScopedI18n("widget.releases.option.repositories");
|
||||
const { data: configuredKinds = [], refetch } = clientApi.widget.secrets.getConfiguredKinds.useQuery({ itemId });
|
||||
const setSecret = clientApi.widget.secrets.setSecret.useMutation({ onSuccess: () => refetch() });
|
||||
|
||||
Reference in new issue
Block a user