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

Function joinOrg

e2e/cloud/support/session.ts:123–139  ·  view source on GitHub ↗
(
  target: TargetShape,
  admin: Identity,
  member: Identity,
  options: { readonly roleSlug?: string } = {},
)

Source from the content-addressed store, hash-verified

121 * and both the session and the selector point at the later one.
122 */
123export const joinOrg = (
124 target: TargetShape,
125 admin: Identity,
126 member: Identity,
127 options: { readonly roleSlug?: string } = {},
128): Effect.Effect<Identity> =>
129 Effect.gen(function* () {
130 const inviteResponse = yield* postJson(target, "/api/account/members/invite", admin, {
131 email: member.credentials?.email,
132 ...(options.roleSlug === undefined ? {} : { roleSlug: options.roleSlug }),
133 });
134 const invitation = (yield* Effect.promise(() => inviteResponse.json())) as { id: string };
135 const acceptResponse = yield* postJson(target, "/api/auth/accept-invitation", member, {
136 invitationId: invitation.id,
137 });
138 return withRefreshedSession(member, acceptResponse, orgSelectorOf(admin));
139 });
140
141/** Create another org for this account; returns the identity bound to it. */
142export const createOrg = (

Calls 4

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

Tested by

no test coverage detected