- Implemented a new tool `stella-callgraph-node` that extracts call graphs from JavaScript/TypeScript projects using Babel AST. - Added command-line interface with options for JSON output and help. - Included functionality to analyze project structure, detect functions, and build call graphs. - Created a package.json file for dependency management. feat: introduce stella-callgraph-python for Python call graph extraction - Developed `stella-callgraph-python` to extract call graphs from Python projects using AST analysis. - Implemented command-line interface with options for JSON output and verbose logging. - Added framework detection to identify popular web frameworks and their entry points. - Created an AST analyzer to traverse Python code and extract function definitions and calls. - Included requirements.txt for project dependencies. chore: add framework detection for Python projects - Implemented framework detection logic to identify frameworks like Flask, FastAPI, Django, and others based on project files and import patterns. - Enhanced the AST analyzer to recognize entry points based on decorators and function definitions.
98 lines
3.6 KiB
C#
98 lines
3.6 KiB
C#
using StellaOps.Router.Gateway.Middleware;
|
|
using StellaOps.Router.Gateway.OpenApi;
|
|
using StellaOps.Router.Gateway.RateLimit;
|
|
|
|
namespace StellaOps.Router.Gateway;
|
|
|
|
/// <summary>
|
|
/// Extension methods for configuring the router gateway middleware pipeline.
|
|
/// </summary>
|
|
public static class ApplicationBuilderExtensions
|
|
{
|
|
/// <summary>
|
|
/// Adds the router gateway middleware pipeline.
|
|
/// </summary>
|
|
/// <param name="app">The application builder.</param>
|
|
/// <returns>The application builder for chaining.</returns>
|
|
public static IApplicationBuilder UseRouterGateway(this IApplicationBuilder app)
|
|
{
|
|
// Request logging and error handling wrap the full router pipeline.
|
|
app.UseMiddleware<RequestLoggingMiddleware>();
|
|
app.UseMiddleware<GlobalErrorHandlerMiddleware>();
|
|
|
|
// Enforce payload limits first
|
|
app.UseMiddleware<PayloadLimitsMiddleware>();
|
|
|
|
// Resolve endpoints from routing state
|
|
app.UseMiddleware<EndpointResolutionMiddleware>();
|
|
|
|
// Rate limiting (Sprint 1200_001_001)
|
|
// Runs after endpoint resolution so microservice identity is available.
|
|
app.UseRateLimiting();
|
|
|
|
// Make routing decisions (select instance)
|
|
app.UseMiddleware<RoutingDecisionMiddleware>();
|
|
|
|
// Dispatch to transport and return response
|
|
app.UseMiddleware<TransportDispatchMiddleware>();
|
|
|
|
return app;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Adds rate limiting middleware to the pipeline.
|
|
/// Sprint: SPRINT_1200_001_001_router_rate_limiting_core
|
|
/// Task: 1.6 - Wire into Router Pipeline
|
|
/// </summary>
|
|
/// <param name="app">The application builder.</param>
|
|
/// <returns>The application builder for chaining.</returns>
|
|
public static IApplicationBuilder UseRateLimiting(this IApplicationBuilder app)
|
|
{
|
|
// Only add if rate limit service is registered
|
|
var rateLimitService = app.ApplicationServices.GetService<RateLimitService>();
|
|
if (rateLimitService is not null)
|
|
{
|
|
app.UseMiddleware<RateLimitMiddleware>();
|
|
}
|
|
return app;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Adds the router gateway middleware pipeline without payload limiting.
|
|
/// </summary>
|
|
/// <param name="app">The application builder.</param>
|
|
/// <returns>The application builder for chaining.</returns>
|
|
public static IApplicationBuilder UseRouterGatewayCore(this IApplicationBuilder app)
|
|
{
|
|
// Request logging and error handling wrap the full router pipeline.
|
|
app.UseMiddleware<RequestLoggingMiddleware>();
|
|
app.UseMiddleware<GlobalErrorHandlerMiddleware>();
|
|
|
|
// Resolve endpoints from routing state
|
|
app.UseMiddleware<EndpointResolutionMiddleware>();
|
|
|
|
// Rate limiting (Sprint 1200_001_001)
|
|
// Runs after endpoint resolution so microservice identity is available.
|
|
app.UseRateLimiting();
|
|
|
|
// Make routing decisions (select instance)
|
|
app.UseMiddleware<RoutingDecisionMiddleware>();
|
|
|
|
// Dispatch to transport and return response
|
|
app.UseMiddleware<TransportDispatchMiddleware>();
|
|
|
|
return app;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Maps OpenAPI endpoints to the application.
|
|
/// Should be called before UseRouterGateway so OpenAPI requests are handled first.
|
|
/// </summary>
|
|
/// <param name="endpoints">The endpoint route builder.</param>
|
|
/// <returns>The endpoint route builder for chaining.</returns>
|
|
public static IEndpointRouteBuilder MapRouterOpenApi(this IEndpointRouteBuilder endpoints)
|
|
{
|
|
return endpoints.MapRouterOpenApiEndpoints();
|
|
}
|
|
}
|