mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
refactor(auth): guards, auth decorators and ephemeral tokens move into an auth-core kernel
JwtAuthGuard, OptionalJwtAuthGuard, CookieAuthGuard, AdminGuard, the global and MFA guards, @CurrentUser, @Public, JWT verification and the ephemeral token service lived in the auth domain, so every controller that checked a session depended on the whole account module and its imports. They import no domain themselves; under src/nest/auth-core they are shared kernel like common/, every importer points there directly, and AtlasModule and NotificationsModule stop importing AuthModule, which they only did for the demo gate. lint:boundaries counts auth-core as kernel: 57 fewer cyclic domain edges, the largest cycle shrinks from 46 to 40 domains.
This commit is contained in:
@@ -2,12 +2,10 @@
|
||||
"fileCycles": [],
|
||||
"domainCycles": [
|
||||
"accommodations -> assignments",
|
||||
"accommodations -> auth",
|
||||
"accommodations -> mcp-shared",
|
||||
"accommodations -> places",
|
||||
"accommodations -> plugins",
|
||||
"accommodations -> realtime",
|
||||
"addons -> auth",
|
||||
"addons -> memories",
|
||||
"addons -> settings",
|
||||
"addons -> transit",
|
||||
@@ -22,30 +20,21 @@
|
||||
"admin -> plugins",
|
||||
"admin -> realtime",
|
||||
"admin -> settings",
|
||||
"admin -> tokens",
|
||||
"airports -> auth",
|
||||
"assignments -> auth",
|
||||
"assignments -> days",
|
||||
"assignments -> journey",
|
||||
"assignments -> mcp-shared",
|
||||
"assignments -> plugins",
|
||||
"assignments -> realtime",
|
||||
"atlas -> addons",
|
||||
"atlas -> auth",
|
||||
"atlas -> geo",
|
||||
"atlas -> plugins",
|
||||
"atlas -> public-api",
|
||||
"atlas -> tokens",
|
||||
"auth -> budget",
|
||||
"auth -> files",
|
||||
"auth -> maps",
|
||||
"auth -> notifications",
|
||||
"auth -> plugins",
|
||||
"auth -> settings",
|
||||
"auth -> storage",
|
||||
"auth -> tokens",
|
||||
"booking-import -> addons",
|
||||
"booking-import -> airports",
|
||||
"booking-import -> budget",
|
||||
"booking-import -> llm-parse",
|
||||
"booking-import -> maps",
|
||||
@@ -53,52 +42,40 @@
|
||||
"booking-import -> realtime",
|
||||
"booking-import -> reservations",
|
||||
"budget -> addons",
|
||||
"budget -> auth",
|
||||
"budget -> mcp-shared",
|
||||
"budget -> plugins",
|
||||
"budget -> realtime",
|
||||
"calendar -> days",
|
||||
"calendar -> reservations",
|
||||
"categories -> auth",
|
||||
"categories -> mcp-shared",
|
||||
"categories -> plugins",
|
||||
"collab -> addons",
|
||||
"collab -> auth",
|
||||
"collab -> files",
|
||||
"collab -> mcp-shared",
|
||||
"collab -> notifications",
|
||||
"collab -> plugins",
|
||||
"collab -> realtime",
|
||||
"collab -> storage",
|
||||
"collections -> addons",
|
||||
"collections -> auth",
|
||||
"collections -> notifications",
|
||||
"collections -> places",
|
||||
"collections -> plugins",
|
||||
"collections -> realtime",
|
||||
"collections -> storage",
|
||||
"day-notes -> auth",
|
||||
"day-notes -> mcp-shared",
|
||||
"day-notes -> plugins",
|
||||
"day-notes -> realtime",
|
||||
"days -> accommodations",
|
||||
"days -> assignments",
|
||||
"days -> auth",
|
||||
"days -> mcp-shared",
|
||||
"days -> places",
|
||||
"days -> plugins",
|
||||
"days -> realtime",
|
||||
"files -> auth",
|
||||
"files -> mcp-shared",
|
||||
"files -> plugins",
|
||||
"files -> realtime",
|
||||
"files -> storage",
|
||||
"geo -> maps",
|
||||
"google-quota -> auth",
|
||||
"integrations -> addons",
|
||||
"integrations -> assignments",
|
||||
"integrations -> atlas",
|
||||
"integrations -> auth",
|
||||
"integrations -> journey",
|
||||
"integrations -> mcp-shared",
|
||||
"integrations -> places",
|
||||
@@ -106,7 +83,6 @@
|
||||
"integrations -> reservations",
|
||||
"journey -> addons",
|
||||
"journey -> atlas",
|
||||
"journey -> auth",
|
||||
"journey -> files",
|
||||
"journey -> maps",
|
||||
"journey -> memories",
|
||||
@@ -114,56 +90,38 @@
|
||||
"journey -> plugins",
|
||||
"journey -> realtime",
|
||||
"journey -> settings",
|
||||
"journey -> storage",
|
||||
"llm-parse -> addons",
|
||||
"llm-parse -> auth",
|
||||
"llm-parse -> settings",
|
||||
"maps -> auth",
|
||||
"maps -> geo",
|
||||
"maps -> google-quota",
|
||||
"maps -> place-photos",
|
||||
"maps -> settings",
|
||||
"maps -> storage",
|
||||
"mcp-shared -> realtime",
|
||||
"memories -> addons",
|
||||
"memories -> auth",
|
||||
"memories -> notifications",
|
||||
"memories -> photos",
|
||||
"memories -> realtime",
|
||||
"memories -> storage",
|
||||
"notifications -> admin",
|
||||
"notifications -> auth",
|
||||
"notifications -> realtime",
|
||||
"notifications -> storage",
|
||||
"oauth -> addons",
|
||||
"oauth -> auth",
|
||||
"packing -> addons",
|
||||
"packing -> admin",
|
||||
"packing -> auth",
|
||||
"packing -> mcp-shared",
|
||||
"packing -> notifications",
|
||||
"packing -> plugins",
|
||||
"packing -> realtime",
|
||||
"photos -> auth",
|
||||
"photos -> memories",
|
||||
"place-photos -> storage",
|
||||
"places -> accommodations",
|
||||
"places -> assignments",
|
||||
"places -> atlas",
|
||||
"places -> auth",
|
||||
"places -> journey",
|
||||
"places -> maps",
|
||||
"places -> mcp-shared",
|
||||
"places -> place-photos",
|
||||
"places -> plugins",
|
||||
"places -> realtime",
|
||||
"places -> storage",
|
||||
"places -> unsplash",
|
||||
"plugins -> accommodations",
|
||||
"plugins -> addons",
|
||||
"plugins -> assignments",
|
||||
"plugins -> atlas",
|
||||
"plugins -> auth",
|
||||
"plugins -> budget",
|
||||
"plugins -> categories",
|
||||
"plugins -> collab",
|
||||
@@ -184,14 +142,10 @@
|
||||
"plugins -> trips",
|
||||
"plugins -> vacay",
|
||||
"plugins -> weather",
|
||||
"public-api -> tokens",
|
||||
"realtime -> auth",
|
||||
"realtime -> journey",
|
||||
"realtime -> plugins",
|
||||
"reservations -> accommodations",
|
||||
"reservations -> airports",
|
||||
"reservations -> assignments",
|
||||
"reservations -> auth",
|
||||
"reservations -> budget",
|
||||
"reservations -> days",
|
||||
"reservations -> integrations",
|
||||
@@ -200,19 +154,12 @@
|
||||
"reservations -> plugins",
|
||||
"reservations -> realtime",
|
||||
"settings -> admin",
|
||||
"settings -> auth",
|
||||
"storage -> auth",
|
||||
"tags -> auth",
|
||||
"tags -> plugins",
|
||||
"todo -> addons",
|
||||
"todo -> auth",
|
||||
"todo -> mcp-shared",
|
||||
"todo -> plugins",
|
||||
"todo -> realtime",
|
||||
"tokens -> auth",
|
||||
"transit -> auth",
|
||||
"transit -> days",
|
||||
"transit -> google-quota",
|
||||
"transit -> maps",
|
||||
"transit -> mcp-shared",
|
||||
"transit -> reservations",
|
||||
@@ -235,7 +182,6 @@
|
||||
"trip-read-model -> trips",
|
||||
"trips -> accommodations",
|
||||
"trips -> addons",
|
||||
"trips -> auth",
|
||||
"trips -> budget",
|
||||
"trips -> calendar",
|
||||
"trips -> collab",
|
||||
@@ -248,30 +194,23 @@
|
||||
"trips -> realtime",
|
||||
"trips -> reservations",
|
||||
"trips -> settings",
|
||||
"trips -> storage",
|
||||
"trips -> todo",
|
||||
"trips -> trip-members",
|
||||
"trips -> trip-read-model",
|
||||
"trips -> unsplash",
|
||||
"trips -> vacay",
|
||||
"unsplash -> settings",
|
||||
"unsplash -> storage",
|
||||
"vacay -> addons",
|
||||
"vacay -> auth",
|
||||
"vacay -> notifications",
|
||||
"vacay -> plugins",
|
||||
"vacay -> realtime",
|
||||
"weather -> auth",
|
||||
"weather -> plugins"
|
||||
],
|
||||
"sharedImportsDomain": [
|
||||
"nest/common/idempotency-cleanup.job.ts -> nest/audit/audit-log.logger.ts",
|
||||
"nest/common/idempotency-cleanup.job.ts -> nest/scheduling/cron-registrar.service.ts",
|
||||
"nest/common/rowShape.ts -> nest/query-helpers/query-helpers.service.ts",
|
||||
"nest/common/validate-route-guards.ts -> nest/auth/cookie-auth.guard.ts",
|
||||
"nest/common/validate-route-guards.ts -> nest/auth/jwt-auth.guard.ts",
|
||||
"nest/common/validate-route-guards.ts -> nest/auth/optional-jwt.guard.ts",
|
||||
"nest/common/validate-route-guards.ts -> nest/auth/public.decorator.ts",
|
||||
"nest/common/validate-route-guards.ts -> nest/public-api/api-token.guard.ts"
|
||||
],
|
||||
"domainInternals": [
|
||||
@@ -301,7 +240,6 @@
|
||||
"collections -> storage/storage-upload.factory.ts",
|
||||
"days -> accommodations/night-seat.ts",
|
||||
"doc-sync -> storage/content-type.ts",
|
||||
"files -> auth/jwt-verify.ts",
|
||||
"files -> storage/content-type.ts",
|
||||
"files -> storage/storage-upload.factory.ts",
|
||||
"geo -> maps/maps.helpers.ts",
|
||||
@@ -318,8 +256,6 @@
|
||||
"place-enrichment -> maps/trek-places.client.ts",
|
||||
"places -> atlas/atlas-geo.ts",
|
||||
"places -> storage/storage-upload.factory.ts",
|
||||
"platform -> auth/jwt-verify.ts",
|
||||
"plugins -> auth/jwt-verify.ts",
|
||||
"plugins -> llm-parse/clients/openai-compatible.client.ts",
|
||||
"plugins -> llm-parse/llm-client.factory.ts",
|
||||
"plugins -> llm-parse/llm-config.resolver.ts",
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
* the next rule instead.
|
||||
* sharedImportsDomain
|
||||
* a file of the shared kernel (src/nest/common, database,
|
||||
* app-config), which every domain imports, importing from a
|
||||
* domain. That ties the domain into every other one.
|
||||
* app-config, auth-core), which every domain imports,
|
||||
* importing from a domain. That ties the domain into every other one.
|
||||
* domainInternals a file in src/nest/<A>/ importing (value or type) a
|
||||
* file of src/nest/<B>/ that is not B's public surface.
|
||||
* Public is what the codebase already treats that way: the
|
||||
@@ -58,8 +58,12 @@ const ts = require('typescript');
|
||||
|
||||
export const RULES = ['fileCycles', 'domainCycles', 'sharedImportsDomain', 'domainInternals', 'dbImportsNest'];
|
||||
|
||||
/** Folders under src/nest whose every file is shared infrastructure, open to all domains. */
|
||||
export const SHARED_DOMAINS = new Set(['common', 'database', 'app-config']);
|
||||
/**
|
||||
* Folders under src/nest whose every file is shared infrastructure, open to all domains.
|
||||
* auth-core holds the request-auth primitives (the guards, the decorators, JWT
|
||||
* verification, ephemeral tokens) every controller needs; it imports no domain.
|
||||
*/
|
||||
export const SHARED_DOMAINS = new Set(['common', 'database', 'app-config', 'auth-core']);
|
||||
|
||||
/** File name suffixes that make up a domain's public surface. */
|
||||
export const PUBLIC_SUFFIXES = [
|
||||
|
||||
Reference in New Issue
Block a user