Ziehe die Fähigkeiten von Paperless und IMAP in ihr Modul und entferne die unbenutzte Filterliste.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5e32ba547d
commit
2f7de33049
3 files changed
+62
-83
No files matched your search
@@ -1,86 +1,15 @@
|
||||
"""Declared source and editor capabilities.
|
||||
"""Declared editor capabilities and the payloads that carry them.
|
||||
|
||||
A common contract does not invent abilities the adapter does not have.
|
||||
A filter is offered only when that module implements it.
|
||||
The capabilities of a source belong to its module. A filter is offered only when that module implements it.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
PAPERLESS_CAPABILITIES = {
|
||||
"kind": "paperless",
|
||||
"navigate": False,
|
||||
"read_original": True,
|
||||
"read_preview": True,
|
||||
"read_attachment": False,
|
||||
"edit_content": False,
|
||||
"edit_metadata": False,
|
||||
"search": {
|
||||
"query": True,
|
||||
"mode": True,
|
||||
"title": True,
|
||||
"correspondent": True,
|
||||
"document_type": True,
|
||||
"storage_path": True,
|
||||
"tags": True,
|
||||
"tag_mode": True,
|
||||
"document_range": True,
|
||||
"added_range": True,
|
||||
"asn": True,
|
||||
"custom_fields": True,
|
||||
"sort": True,
|
||||
"continuation": True,
|
||||
"result_preview": True,
|
||||
},
|
||||
}
|
||||
|
||||
IMAP_CAPABILITIES = {
|
||||
"kind": "imap",
|
||||
"navigate": True,
|
||||
"read_original": True,
|
||||
"read_preview": True,
|
||||
"read_attachment": True,
|
||||
"edit_content": False,
|
||||
"edit_metadata": False,
|
||||
"search": {
|
||||
"query": True,
|
||||
"mode": False,
|
||||
"title": False,
|
||||
"correspondent": False,
|
||||
"document_type": False,
|
||||
"storage_path": False,
|
||||
"tags": False,
|
||||
"tag_mode": False,
|
||||
"document_range": False,
|
||||
"added_range": False,
|
||||
"asn": False,
|
||||
"custom_fields": False,
|
||||
"sort": False,
|
||||
"continuation": True,
|
||||
"result_preview": False,
|
||||
},
|
||||
}
|
||||
|
||||
CAPABILITIES = {
|
||||
"paperless": PAPERLESS_CAPABILITIES,
|
||||
"imap": IMAP_CAPABILITIES,
|
||||
}
|
||||
|
||||
EDITORS = {
|
||||
"note": True,
|
||||
"markdown_file": False,
|
||||
}
|
||||
|
||||
UNSUPPORTED_SEARCH = (
|
||||
"title",
|
||||
"correspondent",
|
||||
"document_type",
|
||||
"tag",
|
||||
"document_from",
|
||||
"document_to",
|
||||
"sort",
|
||||
"cursor",
|
||||
)
|
||||
|
||||
|
||||
def capability_payload() -> dict:
|
||||
from app.sourceregistry import registered_sources
|
||||
@@ -105,10 +34,6 @@ def capability_payload() -> dict:
|
||||
}
|
||||
|
||||
|
||||
def unsupported_filters(values: dict[str, str]) -> list[str]:
|
||||
return [name for name in UNSUPPORTED_SEARCH if str(values.get(name) or "").strip()]
|
||||
|
||||
|
||||
def with_capabilities(kind: str, connector_id: str, payload: dict) -> dict:
|
||||
from app.sourceregistry import require_source
|
||||
|
||||
|
||||
Reference in new issue
Block a user