Files
StommerandClaude Sonnet 5.5 2f7de33049
Deploy Development / deploy (push) Successful in 46s
Test Suite / pytest-backend (push) Successful in 5m58s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 22s
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>
2026-10-24 22:23:46 +02:00

51 lines
1.6 KiB
Python

"""Declared editor capabilities and the payloads that carry them.
The capabilities of a source belong to its module. A filter is offered only when that module implements it.
"""
from __future__ import annotations
EDITORS = {
"note": True,
"markdown_file": False,
}
def capability_payload() -> dict:
from app.sourceregistry import registered_sources
return {
"sources": [module.capabilities for module in registered_sources()],
"modules": [
{
"kind": module.kind,
"label": module.label,
"representation": module.representation,
"config_fields": [item.public() for item in module.config_fields],
}
for module in registered_sources()
],
"editors": EDITORS,
"protection_profiles": {
"legacy-plaintext": "cleartext",
"managed-encrypted": "locked",
"client-encrypted": "locked",
},
}
def with_capabilities(kind: str, connector_id: str, payload: dict) -> dict:
from app.sourceregistry import require_source
body = dict(payload)
spec = require_source(kind).capabilities
body["connector_id"] = connector_id
body["capabilities"] = spec
body["unsupported"] = [name for name, enabled in spec["search"].items() if not enabled]
if spec["search"].get("continuation"):
body["continuation"] = body.get("next_before") if body.get("next_before") is not None else body.get("next_page")
else:
body["continuation"] = None
body["incomplete"] = bool(body.get("incomplete"))
return body