Files
homarr/packages/request-handler/src/releases.ts
T
Thomas Camlong e9611e8098 chore: temporarily restore deleted files for CodeRabbit review
Restoring 27 deleted files and 26 trivially-changed request handlers
to bring the PR under CodeRabbit's 150-file review limit.
These will be re-deleted in the next commit.
2026-06-27 11:49:15 +02:00

21 lines
805 B
TypeScript

import dayjs from "dayjs";
import type { IntegrationKindByCategory } from "@homarr/definitions";
import type { ReleaseResponse, ReleasesRepository } from "@homarr/integrations";
import { createIntegrationAsync } from "@homarr/integrations";
import { createCachedIntegrationRequestHandler } from "./lib/cached-integration-request-handler";
export const releasesRequestHandler = createCachedIntegrationRequestHandler<
ReleaseResponse,
IntegrationKindByCategory<"releasesProvider">,
ReleasesRepository
>({
requestAsync: async (integration, input) => {
const instance = await createIntegrationAsync(integration);
return instance.getLatestMatchingReleaseAsync(input.identifier, input.versionRegex);
},
cacheDuration: dayjs.duration(5, "minutes"),
queryKey: "repositoriesReleases",
});