MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / connectionCreateHandoffUrl

Function connectionCreateHandoffUrl

packages/core/sdk/src/core-tools.ts:498–516  ·  view source on GitHub ↗
(
  webBaseUrl: string | undefined,
  orgSlug: string | undefined,
  input: typeof ConnectionCreateHandoffInput.Type,
)

Source from the content-addressed store, hash-verified

496};
497
498const connectionCreateHandoffUrl = (
499 webBaseUrl: string | undefined,
500 orgSlug: string | undefined,
501 input: typeof ConnectionCreateHandoffInput.Type,
502): string => {
503 const search = new URLSearchParams({ addAccount: "1" });
504 if (input.owner !== undefined) search.set("owner", input.owner);
505 if (input.template !== undefined) search.set("template", input.template);
506 if (input.label !== undefined) search.set("label", input.label);
507 // Org-scoped hosts (cloud, self-host, cloudflare) serve the console under an
508 // optional `/<org-slug>` segment. Pin the URL to the executor's bound org so
509 // it opens that org directly instead of relying on the browser's last-active
510 // org (which `OrgSlugGate` would otherwise canonicalize a bare URL to). When
511 // no slug is known (CLI, local, non-request callers) we emit the bare path.
512 const orgPrefix = orgSlug !== undefined && orgSlug.length > 0 ? `/${orgSlug}` : "";
513 const path = `${orgPrefix}/integrations/${encodeURIComponent(input.integration)}?${search.toString()}`;
514 if (webBaseUrl === undefined || webBaseUrl.length === 0) return path;
515 return new URL(path, webBaseUrl.endsWith("/") ? webBaseUrl : `${webBaseUrl}/`).toString();
516};
517
518const oauthClientCreateHandoffUrl = (
519 webBaseUrl: string | undefined,

Callers 1

core-tools.tsFile · 0.85

Calls 2

toStringMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected