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

Function joinOrg

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 3

postJsonFunction · 0.70
withRefreshedSessionFunction · 0.70
jsonMethod · 0.65

Tested by

no test coverage detected