init repo
This commit is contained in:
22
app/middleware/base.py
Normal file
22
app/middleware/base.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""Middleware base class — before/after hooks around graph execution."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from app.graph.state import ReportState
|
||||
|
||||
|
||||
class Middleware(ABC):
|
||||
"""Base middleware. Subclasses override before() and/or after()."""
|
||||
|
||||
name: str = "base"
|
||||
enabled: bool = True
|
||||
|
||||
async def before(self, state: ReportState) -> ReportState:
|
||||
"""Called before graph execution. Modify state as needed."""
|
||||
return state
|
||||
|
||||
async def after(self, state: ReportState) -> ReportState:
|
||||
"""Called after graph execution. Modify state as needed."""
|
||||
return state
|
||||
Reference in New Issue
Block a user