MCPcopy Create free account
hub / github.com/cloudnative-pg/plugin-barman-cloud / useCurrentVersion

Function useCurrentVersion

web/src/hooks/versions.ts:4–17  ·  view source on GitHub ↗
(fallback: 'latest' | 'latestReleased' = 'latest')

Source from the content-addressed store, hash-verified

2
3
4export function useCurrentVersion(fallback: 'latest' | 'latestReleased' = 'latest'): string {
5 switch (fallback) {
6 case 'latestReleased':
7 return useLatestReleasedVersion();
8 case 'latest': {
9 const version = useActiveVersion('default');
10 return version?.name ?? useLatestVersion('default')?.name;
11 }
12 default:
13 // The following line ensures that if `fallback` is not 'latest' or 'latestReleased',
14 // an error is thrown. This can be useful for catching unexpected states.
15 throw new Error(`Unhandled fallback type: ${fallback}`);
16 }
17}
18
19export function useLatestReleasedVersion(): string {
20 const allVersions = useVersions('default');

Callers 1

InstallationSnippetFunction · 0.90

Calls 1

useLatestReleasedVersionFunction · 0.85

Tested by

no test coverage detected