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

Function joinOrg

e2e/cloud/spec-update-convergence.test.ts:150–163  ·  view source on GitHub ↗
(target: TargetShape, admin: Identity, member: Identity)

Source from the content-addressed store, hash-verified

148 * The member's requests inherit the admin's org selector (org-scoped reads
149 * fail closed without the header). */
150const joinOrg = (target: TargetShape, admin: Identity, member: Identity) =>
151 Effect.gen(function* () {
152 const adminSelector = admin.headers?.[ORG_SELECTOR_HEADER];
153 if (!adminSelector) throw new Error("admin identity carries no org selector header");
154 const verifiedAdmin = yield* verifyAdmin(target.baseUrl, admin);
155 const inviteResponse = yield* postJson(target, "/api/account/members/invite", verifiedAdmin, {
156 email: member.credentials?.email,
157 });
158 const invitation = (yield* Effect.promise(() => inviteResponse.json())) as { id: string };
159 const acceptResponse = yield* postJson(target, "/api/auth/accept-invitation", member, {
160 invitationId: invitation.id,
161 });
162 return withRefreshedSession(member, acceptResponse, adminSelector);
163 });
164
165const apiKeyTemplate = [
166 {

Callers 1

Calls 4

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

Tested by

no test coverage detected