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

Function connection

packages/react/src/lib/oauth-client-usage.test.ts:29–53  ·  view source on GitHub ↗
(
  integration: string,
  name: string,
  opts?: {
    readonly owner?: Owner;
    readonly oauthClient?: string | null;
    readonly oauthClientOwner?: Owner | null;
  },
)

Source from the content-addressed store, hash-verified

27
28// A connection optionally minted by an app (its `oauthClient` slug).
29const connection = (
30 integration: string,
31 name: string,
32 opts?: {
33 readonly owner?: Owner;
34 readonly oauthClient?: string | null;
35 readonly oauthClientOwner?: Owner | null;
36 },
37): Connection => ({
38 owner: opts?.owner ?? "user",
39 name: ConnectionName.make(name),
40 integration: IntegrationSlug.make(integration),
41 template: AuthTemplateSlug.make("oauth"),
42 provider: ProviderKey.make("default"),
43 address: ConnectionAddress.make(`tools.${integration}.user.${name}`),
44 identityLabel: null,
45 expiresAt: null,
46 oauthClient:
47 opts?.oauthClient === undefined
48 ? null
49 : opts.oauthClient === null
50 ? null
51 : OAuthClientSlug.make(opts.oauthClient),
52 oauthClientOwner: opts?.oauthClientOwner ?? null,
53});
54
55describe("buildUsageMap / connectionsUsingClient", () => {
56 it("maps connections to the app slug that minted them", () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected