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

Function organizationDisplay

apps/cloud/src/auth/ssr-gate.ts:151–162  ·  view source on GitHub ↗
(
  organizationId: string,
)

Source from the content-addressed store, hash-verified

149// requests, which Cloudflare forbids. A miss or failure reads as empty strings
150// — display-only, corrected by the client's /account/me write.
151const organizationDisplay = async (
152 organizationId: string,
153): Promise<{ name: string; slug: string }> => {
154 const exit = await getRuntime().runPromiseExit(
155 Effect.flatMap(UserStoreService.asEffect(), (users) =>
156 users.use((store) => store.getOrganization(organizationId)),
157 ).pipe(Effect.provide(Layer.provide(makeUserStoreLayer(), makeDbLayer()))),
158 );
159 return Exit.isSuccess(exit)
160 ? { name: exit.value?.name ?? "", slug: exit.value?.slug ?? "" }
161 : { name: "", slug: "" };
162};
163
164// Live membership check for the last-org cookie's slug. Same authorize path
165// as any org selector — the cookie is a preference, so a slug the user can't

Callers 2

resolveAuthHintFunction · 0.85
ssr-gate.tsFile · 0.85

Calls 3

makeUserStoreLayerFunction · 0.90
makeDbLayerFunction · 0.90
getRuntimeFunction · 0.85

Tested by

no test coverage detected