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

Function connectionCreateHandoffUrl

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

Source from the content-addressed store, hash-verified

462};
463
464const connectionCreateHandoffUrl = (
465 webBaseUrl: string | undefined,
466 orgSlug: string | undefined,
467 input: typeof ConnectionCreateHandoffInput.Type,
468): string => {
469 const search = new URLSearchParams({ addAccount: "1" });
470 if (input.owner !== undefined) search.set("owner", input.owner);
471 if (input.template !== undefined) search.set("template", input.template);
472 if (input.label !== undefined) search.set("label", input.label);
473 // Org-scoped hosts (cloud, self-host, cloudflare) serve the console under an
474 // optional `/<org-slug>` segment. Pin the URL to the executor's bound org so
475 // it opens that org directly instead of relying on the browser's last-active
476 // org (which `OrgSlugGate` would otherwise canonicalize a bare URL to). When
477 // no slug is known (CLI, local, non-request callers) we emit the bare path.
478 const orgPrefix = orgSlug !== undefined && orgSlug.length > 0 ? `/${orgSlug}` : "";
479 const path = `${orgPrefix}/integrations/${encodeURIComponent(input.integration)}?${search.toString()}`;
480 if (webBaseUrl === undefined || webBaseUrl.length === 0) return path;
481 return new URL(path, webBaseUrl.endsWith("/") ? webBaseUrl : `${webBaseUrl}/`).toString();
482};
483
484const oauthClientCreateHandoffUrl = (
485 webBaseUrl: string | undefined,

Callers 1

core-tools.tsFile · 0.85

Calls 2

setMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected