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

Function makeAccountApiLive

apps/cloud/src/account/account-api.ts:98–113  ·  view source on GitHub ↗
(rsLive: Layer.Layer<DbService | UserStoreService>)

Source from the content-addressed store, hash-verified

96 AccountProviderMiddleware.combine(requestScopedMiddleware(rsLive)).layer;
97
98export const makeAccountApiLive = (rsLive: Layer.Layer<DbService | UserStoreService>) => {
99 // Cloud builds the WorkOS `AccountProvider` INSIDE the request body (so it
100 // closes over the per-request postgres socket), so it can't be a self-
101 // contained `Layer<AccountProvider>` — it combines its own middleware with
102 // `requestScopedMiddleware(rsLive)` and passes that to the shared mount
103 // helper. Cloud serves the account API at root (no prefixed router), matching
104 // the rest of the cloud router.
105 //
106 // `AutumnService.Default` is provided HERE because the account provider's
107 // seat-gate (`reserveMemberSlot` / member-limits) reads it — one of the few
108 // app-only billing touchpoints. It is NOT on the neutral boot core.
109 const accountMiddleware = AccountProviderMiddleware.combine(
110 requestScopedMiddleware(rsLive),
111 ).layer;
112 return makeAccountApiLayer(accountMiddleware).pipe(Layer.provideMerge(AutumnService.Default));
113};

Callers 1

makeApiLiveFunction · 0.90

Calls 2

requestScopedMiddlewareFunction · 0.90
makeAccountApiLayerFunction · 0.90

Tested by

no test coverage detected