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

Function organizationDisplay

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

Source from the content-addressed store, hash-verified

146// requests, which Cloudflare forbids. A miss or failure reads as empty strings
147// — display-only, corrected by the client's /account/me write.
148const organizationDisplay = async (
149 organizationId: string,
150): Promise<{ name: string; slug: string }> => {
151 const exit = await getRuntime().runPromiseExit(
152 Effect.flatMap(UserStoreService.asEffect(), (users) =>
153 users.use((store) => store.getOrganization(organizationId)),
154 ).pipe(Effect.provide(Layer.provide(makeUserStoreLayer(), makeDbLayer()))),
155 );
156 return Exit.isSuccess(exit)
157 ? { name: exit.value?.name ?? "", slug: exit.value?.slug ?? "" }
158 : { name: "", slug: "" };
159};
160
161const hintSetCookie = (hint: AuthHint) =>
162 `${AUTH_HINT_COOKIE}=${encodeAuthHint(hint)}; ${HINT_COOKIE_ATTRIBUTES}; Max-Age=${AUTH_HINT_MAX_AGE_SECONDS}`;

Callers 1

resolveAuthHintFunction · 0.85

Calls 3

makeUserStoreLayerFunction · 0.90
makeDbLayerFunction · 0.90
getRuntimeFunction · 0.85

Tested by

no test coverage detected