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

Function accountIdOf

e2e/cloud/support/session.ts:163–171  ·  view source on GitHub ↗
(target: TargetShape, identity: Identity)

Source from the content-addressed store, hash-verified

161/** The caller's own account id — the `externalId` the admin plane reports and
162 * the users page renders in mono. */
163export const accountIdOf = (target: TargetShape, identity: Identity): Effect.Effect<string> =>
164 Effect.promise(async () => {
165 const response = await fetch(new URL("/api/account/me", target.baseUrl), {
166 headers: { cookie: cookieOf(identity) },
167 });
168 if (!response.ok) throw new Error(`/api/account/me failed (${response.status})`);
169 const body = (await response.json()) as { user: { id: string } };
170 return body.user.id;
171 });
172
173/** The org this identity's session is currently bound to: id and URL slug. */
174export const activeOrg = (

Callers 2

Calls 3

cookieOfFunction · 0.70
jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected