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

Function joinOrg

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

Source from the content-addressed store, hash-verified

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

Calls 5

verifyAdminFunction · 0.90
postJsonFunction · 0.70
withRefreshedSessionFunction · 0.70
orgSelectorOfFunction · 0.70
jsonMethod · 0.65

Tested by

no test coverage detected