mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 15:36:33 +00:00
724c88c201
A mechanical prettier --write over server/src, server/tests, server/scripts and shared/src with the workspaces' .prettierrc; nothing but layout and import order changes, and every file keeps the same set of imports. shared is formatted throughout and its format baseline is empty. The server baseline keeps the 35 files that Prettier would grow past their lint:size limit (they need a split first, which is not a formatting change), and the generated entity files stay as their generator writes them.
36 lines
1.8 KiB
TypeScript
36 lines
1.8 KiB
TypeScript
import { AddonsModule } from '../addons/addons.module';
|
|
import { ConsentCoopMiddleware } from './consent-coop.middleware';
|
|
import { DiscoveryMetadataService } from './discovery-metadata.service';
|
|
import { DiscoveryController, McpResourceDiscoveryController } from './discovery.controller';
|
|
import { mcpMetadataMiddlewareProvider } from './mcp-metadata.middleware';
|
|
import { Module, type MiddlewareConsumer, type NestModule } from '@nestjs/common';
|
|
|
|
/**
|
|
* The platform surface that lives behind the container: OAuth/OIDC discovery
|
|
* (controller + SDK metadata middleware) and the /oauth/consent COOP override.
|
|
* What remains pre-init in platform.routes.ts is path-prefixed static serving
|
|
* (uploads, built client) plus — until the /mcp migration lands — the OAuth SDK
|
|
* and /mcp transport mounts.
|
|
*
|
|
* This module is the repo's first MiddlewareConsumer. Express middleware that
|
|
* needs DI has exactly two honest mounts:
|
|
* - consumer.apply(...).forRoutes('<concrete path>') — an Express prefix
|
|
* mount, identical semantics to the legacy app.use('/path', fn) calls
|
|
* (ConsentCoopMiddleware below);
|
|
* - a pathless app.use in bootstrap for middleware that must see the
|
|
* original req.url (MCP_METADATA_MIDDLEWARE — a wildcard forRoutes()
|
|
* would strip the matched prefix and break the SDK router's matching).
|
|
*/
|
|
@Module({
|
|
imports: [AddonsModule],
|
|
controllers: [DiscoveryController, McpResourceDiscoveryController],
|
|
providers: [DiscoveryMetadataService, DiscoveryController, mcpMetadataMiddlewareProvider, ConsentCoopMiddleware],
|
|
})
|
|
export class PlatformModule implements NestModule {
|
|
configure(consumer: MiddlewareConsumer): void {
|
|
// Prefix mount: covers /oauth/consent and any sub-path, like the legacy
|
|
// app.use('/oauth/consent', ...) it replaces.
|
|
consumer.apply(ConsentCoopMiddleware).forRoutes('oauth/consent');
|
|
}
|
|
}
|