• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive-studio / 23743484240

30 Mar 2026 11:56AM UTC coverage: 60.372% (+1.3%) from 59.052%
23743484240

Pull #1783

github

web-flow
Merge f53b61be9 into d88b4bdbd
Pull Request #1783: feat(registry): handle authentication for registry server api

2974 of 5204 branches covered (57.15%)

219 of 251 new or added lines in 25 files covered. (87.25%)

4 existing lines in 4 files now uncovered.

4855 of 7764 relevant lines covered (62.53%)

125.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.31
/renderer/src/common/components/settings/registry/utils.ts
1
/**
2
 * Form types used for UI selection and UPDATE request field names.
3
 * These map directly to the V1UpdateRegistryRequest field names.
4
 */
5
export const REGISTRY_FORM_TYPES = [
4✔
6
  'local_path',
7
  'url',
8
  'default',
9
  'api_url',
10
] as const
11

12
type RegistryFormType = (typeof REGISTRY_FORM_TYPES)[number]
13

14
export const REGISTRY_FORM_TYPE = {
4✔
15
  LOCAL_PATH: 'local_path',
16
  URL: 'url',
17
  DEFAULT: 'default',
18
  API_URL: 'api_url',
19
} as const satisfies Record<string, RegistryFormType>
20

21
export const REGISTRY_TYPE_OPTIONS = [
4✔
22
  { value: 'default', label: 'Default Registry' },
23
  { value: 'url', label: 'Remote Registry (JSON URL)' },
24
  { value: 'local_path', label: 'Local Registry (JSON File Path)' },
25
  { value: 'api_url', label: 'Registry Server API' },
26
] as const satisfies ReadonlyArray<{
27
  value: RegistryFormType
28
  label: string
29
}>
30

31
export type RegistryInputType = Exclude<RegistryFormType, 'default'>
32

33
import type { PkgApiV1RegistryInfo } from '@common/api/generated/types.gen'
34

35
export function registryAuthFromRegistryInfo(
36
  registry: PkgApiV1RegistryInfo | undefined
37
): { client_id: string; issuer_url: string } {
38
  const auth = registry?.auth_config
299✔
39
  return {
299✔
40
    client_id: auth?.client_id ?? '',
591✔
41
    issuer_url: auth?.issuer ?? '',
591✔
42
  }
43
}
44

45
/**
46
 * Maps GET response type to form type for populating the form from API data.
47
 */
48
export function mapResponseTypeToFormType(
49
  responseType: string | undefined
50
): (typeof REGISTRY_FORM_TYPES)[number] {
51
  switch (responseType) {
285!
52
    case 'api':
53
      return 'api_url'
7✔
54
    case 'file':
55
      return 'local_path'
×
56
    case 'url':
57
      return 'url'
×
58
    case 'default':
59
    default:
60
      return 'default'
278✔
61
  }
62
}
63

64
/**
65
 * Maps form type back to API response type for cache updates.
66
 * Inverse of mapResponseTypeToFormType.
67
 */
68
export function mapFormTypeToResponseType(
69
  formType: (typeof REGISTRY_FORM_TYPES)[number]
70
): string {
71
  switch (formType) {
4!
72
    case 'api_url':
UNCOV
73
      return 'api'
×
74
    case 'local_path':
75
      return 'file'
1✔
76
    case 'url':
77
      return 'url'
2✔
78
    case 'default':
79
    default:
80
      return 'default'
1✔
81
  }
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc