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

Function joinOrg

e2e/cloud/connection-owner-isolation.test.ts:116–126  ·  view source on GitHub ↗
(target: TargetShape, admin: Identity, member: Identity)

Source from the content-addressed store, hash-verified

114/** Invite `member` into `admin`'s org and accept — the real invite flow.
115 * Returns the member identity with its requests scoped to that org. */
116const joinOrg = (target: TargetShape, admin: Identity, member: Identity) =>
117 Effect.gen(function* () {
118 const inviteResponse = yield* postJson(target, "/api/account/members/invite", admin, {
119 email: member.credentials?.email,
120 });
121 const invitation = (yield* Effect.promise(() => inviteResponse.json())) as { id: string };
122 const acceptResponse = yield* postJson(target, "/api/auth/accept-invitation", member, {
123 invitationId: invitation.id,
124 });
125 return withRefreshedSession(member, acceptResponse, orgSelectorOf(admin));
126 });
127
128/** Create another org for this account; returns the identity bound to it. */
129const createAnotherOrg = (target: TargetShape, identity: Identity, name: string) =>

Calls 4

postJsonFunction · 0.70
withRefreshedSessionFunction · 0.70
orgSelectorOfFunction · 0.70
jsonMethod · 0.65

Tested by

no test coverage detected