(rsLive: Layer.Layer<DbService | UserStoreService>)
| 96 | AccountProviderMiddleware.combine(requestScopedMiddleware(rsLive)).layer; |
| 97 | |
| 98 | export 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 | }; |
no test coverage detected