feat(api): master-login stub + WorkspacePrismaPool (Frente E)

- Prisma 7: prisma.config.ts com datasource.url (API correta); schema gerado em CJS
- WorkspacePrismaPool: LRU cache (max 10) de PrismaClient por workspace (ADR 0006)
  PrismaPg adapter + pg.Pool por workspace; getOrCreate/health/onModuleDestroy
- JwtAuthGuard: global APP_GUARD, jose HS256, popula CLS com workspace_id/userId/prisma
  @Public() decorator marca ping/health/dev-auth como rotas abertas
- DevAuthController: POST /auth/dev/token — emite JWT dev (404 em produção)
- AuthTokenResponseSchema + DevTokenRequestSchema em @sar/api-interface
- WorkspacePoolHealthIndicator: health/ready reporta amostra LRU top-3 (nunca O(N))
- .npmrc: hoist @prisma/client-runtime-utils (requerido pelo Prisma 7 isolated mode)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 22:36:00 +00:00
parent bca2e3ebb3
commit 2a8be3fd82
22 changed files with 1204 additions and 39 deletions

View File

@@ -47,6 +47,7 @@
"@nx/webpack": "22.7.4",
"@nx/workspace": "^22.7.4",
"@playwright/test": "^1.36.0",
"@prisma/client-runtime-utils": "7.8.0",
"@swc-node/register": "~1.11.1",
"@swc/cli": "~0.8.0",
"@swc/core": "~1.15.5",
@@ -57,6 +58,7 @@
"@types/express": "^5.0.6",
"@types/jest": "~30.0.0",
"@types/node": "catalog:",
"@types/pg": "^8.20.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^6.0.0",
@@ -97,15 +99,21 @@
"@nestjs/core": "^11.0.0",
"@nestjs/platform-express": "^11.0.0",
"@nestjs/terminus": "^11.1.1",
"@prisma/adapter-pg": "^7.8.0",
"@prisma/client": "^7.8.0",
"axios": "^1.6.0",
"compression": "^1.8.1",
"helmet": "^8.2.0",
"jose": "^6.2.3",
"lru-cache": "^11.5.0",
"nestjs-cls": "^5.4.3",
"nestjs-pino": "^4.6.1",
"nestjs-zod": "^4.3.1",
"pg": "^8.21.0",
"pino": "^9.14.0",
"pino-http": "^10.5.0",
"pino-pretty": "^13.1.3",
"prisma": "^7.8.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"reflect-metadata": "^0.1.13",