MCPcopy Index your code
hub / github.com/callstack/agent-device / resolveCloudConnectProfile

Function resolveCloudConnectProfile

src/cli/connection/cloud-profile.ts:19–62  ·  view source on GitHub ↗
(options: {
  flags: CliFlags;
  stateDir: string;
  cwd: string;
  env?: EnvMap;
  fetchImpl?: typeof fetch;
})

Source from the content-addressed store, hash-verified

17};
18
19export async function resolveCloudConnectProfile(options: {
20 flags: CliFlags;
21 stateDir: string;
22 cwd: string;
23 env?: EnvMap;
24 fetchImpl?: typeof fetch;
25}): Promise<{ flags: CliFlags; remoteConfigPath: string }> {
26 const auth = await resolveCloudAccessForConnect({
27 stateDir: options.stateDir,
28 flags: options.flags,
29 env: options.env,
30 io: {
31 env: options.env,
32 fetch: options.fetchImpl,
33 },
34 });
35 const profile = await fetchConnectionProfile({
36 cloudBaseUrl: auth.cloudBaseUrl,
37 accessToken: auth.accessToken,
38 fetchImpl: options.fetchImpl,
39 });
40 const clientId = buildCloudClientId({
41 stateDir: options.stateDir,
42 cloudBaseUrl: auth.cloudBaseUrl,
43 daemonBaseUrl: typeof profile.daemonBaseUrl === 'string' ? profile.daemonBaseUrl : '',
44 session: options.flags.session,
45 });
46 return persistAndResolveGeneratedProfile({
47 stateDir: options.stateDir,
48 provider: 'cloud',
49 profile: {
50 ...profile,
51 leaseProvider: profile.leaseProvider ?? 'cloud',
52 clientId: profile.clientId ?? clientId,
53 runId: profile.runId ?? `cloud-${clientId}`,
54 },
55 cwd: options.cwd,
56 env: options.env,
57 flags: options.flags,
58 extraFlags: {
59 daemonAuthToken: auth.accessToken,
60 },
61 });
62}
63
64async function fetchConnectionProfile(options: {
65 cloudBaseUrl: string;

Callers 1

resolveConnectProfileFunction · 0.90

Calls 4

fetchConnectionProfileFunction · 0.85
buildCloudClientIdFunction · 0.85

Tested by

no test coverage detected