Newer
Older
gnexus-book / server / app / storage / protocols.py
from __future__ import annotations

from typing import Any, Protocol


class DocsRepositoryProtocol(Protocol):
    def list_docs(self) -> list[dict[str, object]]: ...

    def read_doc(self, path: str) -> dict[str, object]: ...

    def search(self, query: str) -> list[dict[str, object]]: ...


class InventoryRepositoryProtocol(Protocol):
    def list_types(self) -> list[str]: ...

    def read_raw(self, inventory_type: str) -> str: ...

    def read_parsed(self, inventory_type: str) -> Any: ...

    def read_item(self, inventory_type: str, item_id: str) -> dict[str, Any]: ...


class PendingChangeRepositoryProtocol(Protocol):
    def list(self) -> list[dict[str, Any]]: ...

    def get(self, change_id: str) -> dict[str, Any]: ...

    def create(self, request: Any, actor: Any = None) -> dict[str, Any]: ...

    def apply(self, change_id: str, actor: Any = None) -> dict[str, Any]: ...

    def delete(self, change_id: str) -> dict[str, Any]: ...