MCPcopy Index your code
hub / github.com/simstudioai/sim / resolveCloudId

Function resolveCloudId

apps/sim/tools/jira/bulk_read.ts:71–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69 }
70
71 const resolveCloudId = async () => {
72 if (params?.cloudId) return params.cloudId
73 const accessibleResources = await response.json()
74 if (!Array.isArray(accessibleResources) || accessibleResources.length === 0) {
75 throw new Error('No Jira resources found')
76 }
77 const normalizedInput = normalizeDomain(params?.domain ?? '')
78 const matchedResource = accessibleResources.find(
79 (r: { url: string }) => r.url.toLowerCase().replace(/\/+$/, '') === normalizedInput
80 )
81 if (matchedResource) return matchedResource.id
82 if (accessibleResources.length === 1) return accessibleResources[0].id
83 throw new Error(
84 `Could not match Jira domain "${params?.domain}" to any accessible resource. ` +
85 `Available sites: ${accessibleResources.map((r: { url: string }) => r.url).join(', ')}`
86 )
87 }
88
89 const cloudId = await resolveCloudId()
90 const projectKey = await resolveProjectKey(cloudId, params!.accessToken, params!.projectId)

Callers 1

bulk_read.tsFile · 0.70

Calls 3

normalizeDomainFunction · 0.90
joinMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected