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

Function accountIdOf

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

Source from the content-addressed store, hash-verified

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

Callers 2

Calls 3

cookieOfFunction · 0.70
jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected