File size: 687 Bytes
caf8059
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""Persistence port; SQL dialect and connection management belong to adapters."""
from typing import Protocol, ContextManager


class Transaction(Protocol):
    def get(self, tenant: str, kind: str, key: str) -> dict | None: ...
    def listing(self, tenant: str, kind: str) -> list[dict]: ...
    def create(self, tenant: str, kind: str, key: str, body: dict) -> dict: ...
    def update(self, tenant: str, kind: str, key: str, body: dict, expected_revision: int) -> dict: ...
    def audit(self, tenant: str, user: str, action: str, target: str, digest: str): ...


class SkillRepository(Protocol):
    def transaction(self, *, write: bool = False) -> ContextManager[Transaction]: ...