Coverage for src / lexigram / admin / hooks.py: 0%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-11 02:25 +0800

1"""Root hook payload surface for lexigram-admin. 

2 

3Defines canonical payload dataclasses for admin-panel hook points. Actual 

4hook registration and invocation use the framework's string-keyed 

5``HookRegistryProtocol`` action/filter APIs. 

6""" 

7 

8from __future__ import annotations 

9 

10from dataclasses import dataclass 

11 

12__all__ = [ 

13 "AdminPanelStartedHook", 

14 "AdminPanelStoppedHook", 

15 "AdminResourceAccessedHook", 

16] 

17 

18 

19@dataclass(frozen=True, kw_only=True) 

20class AdminPanelStartedHook: 

21 """Payload fired after the admin panel has finished its startup sequence.""" 

22 

23 

24@dataclass(frozen=True, kw_only=True) 

25class AdminPanelStoppedHook: 

26 """Payload fired after an orderly admin panel shutdown completes.""" 

27 

28 

29@dataclass(frozen=True, kw_only=True) 

30class AdminResourceAccessedHook: 

31 """Payload fired when an admin resource page is accessed. 

32 

33 Attributes: 

34 resource_name: Registered name of the admin resource (e.g. ``"User"``). 

35 action: CRUD action being performed (e.g. ``"list"``, ``"change"``). 

36 user_id: Identifier of the admin user performing the action. 

37 """ 

38 

39 resource_name: str 

40 action: str 

41 user_id: str