Release govoplan-docs v0.1.23: unify help discovery and batch semantic reads
Module Package Release / publish-packages (push) Successful in 12s
Module Package Release / publish-packages (push) Successful in 12s
This commit is contained in:
@@ -40,6 +40,7 @@ from govoplan_docs.backend.sources import (
|
||||
)
|
||||
from govoplan_docs.backend.semantic_service import (
|
||||
list_semantic_entries,
|
||||
prefetch_semantic_revisions,
|
||||
select_locale_entries,
|
||||
semantic_entry_payload,
|
||||
)
|
||||
@@ -830,6 +831,11 @@ def _classify_documentation(
|
||||
) -> dict[str, list[dict[str, Any]]]:
|
||||
layers: dict[str, list[dict[str, Any]]] = {"always": [], "configured": [], "available": [], "evidence": []}
|
||||
installed = {manifest.id for manifest in registry.manifests()}
|
||||
visible_area_modules = frozenset(
|
||||
str(item["module_id"])
|
||||
for item in _route_items(registry.manifests(), principal)
|
||||
if item["visible"]
|
||||
) if documentation_type == "user" else frozenset(installed)
|
||||
visible_runtime_paths = frozenset([
|
||||
"/settings", # Authenticated shell route, not contributed by a module manifest.
|
||||
*(
|
||||
@@ -909,6 +915,7 @@ def _classify_documentation(
|
||||
visible_runtime_paths=visible_runtime_paths,
|
||||
configuration=configuration,
|
||||
resolved_version=resolved_version,
|
||||
visible_area_modules=visible_area_modules,
|
||||
))
|
||||
return layers
|
||||
|
||||
@@ -1011,6 +1018,7 @@ def _semantic_documentation_topics(
|
||||
list_semantic_entries(session, principal),
|
||||
locale=locale,
|
||||
)
|
||||
revisions = prefetch_semantic_revisions(session, principal, entries=entries, editor=False)
|
||||
topics: list[DocumentationTopic] = []
|
||||
for entry in entries:
|
||||
payload = semantic_entry_payload(
|
||||
@@ -1020,6 +1028,7 @@ def _semantic_documentation_topics(
|
||||
entry=entry,
|
||||
editor=False,
|
||||
requested_locale=locale,
|
||||
revisions=revisions,
|
||||
)
|
||||
if payload is None:
|
||||
continue
|
||||
@@ -1430,6 +1439,7 @@ def _documentation_topic_payload(
|
||||
visible_runtime_paths: frozenset[str],
|
||||
configuration: Mapping[str, DocumentationConfigurationDecision],
|
||||
resolved_version: str,
|
||||
visible_area_modules: frozenset[str] = frozenset(),
|
||||
) -> dict[str, Any]:
|
||||
module_id = topic.source_module_id or source_module_id
|
||||
translation_locale, translation = _translation_for_locale(topic, locale)
|
||||
@@ -1484,6 +1494,16 @@ def _documentation_topic_payload(
|
||||
"conditions": [_documentation_condition_payload(condition) for condition in topic.conditions],
|
||||
"links": [_documentation_link_payload(link) for link in topic.links],
|
||||
"related_modules": list(topic.related_modules),
|
||||
"area_module_ids": sorted({
|
||||
module_id,
|
||||
*(
|
||||
area for area in (
|
||||
*topic.related_modules,
|
||||
*_bounded_string_list(localized_metadata.get("areas"), maximum_items=32, maximum_length=255),
|
||||
)
|
||||
if area in visible_area_modules
|
||||
),
|
||||
}),
|
||||
"unlocks": list(topic.unlocks),
|
||||
"configuration_keys": sorted({*topic.configuration_keys, *(key for condition in topic.conditions for key in condition.configuration_keys)}),
|
||||
"configuration_states": [
|
||||
@@ -1497,6 +1517,7 @@ def _documentation_topic_payload(
|
||||
return {
|
||||
"id": payload["id"],
|
||||
"source_module_id": payload["source_module_id"],
|
||||
"area_module_ids": payload["area_module_ids"],
|
||||
"kind": payload["kind"],
|
||||
"anchor_id": payload["anchor_id"],
|
||||
"title": payload["title"],
|
||||
@@ -1555,6 +1576,9 @@ def _user_topic_metadata(kind: str, metadata: Mapping[str, Any]) -> dict[str, An
|
||||
value = _bounded_string(metadata.get(key), maximum=255)
|
||||
if value:
|
||||
projected[key] = value
|
||||
tags = _bounded_string_list(metadata.get("tags"), maximum_items=32, maximum_length=80)
|
||||
if tags:
|
||||
projected["tags"] = tags
|
||||
if kind == "reference" and isinstance(metadata.get("fields"), list):
|
||||
fields = [_user_field_metadata(item) for item in metadata["fields"][:64] if isinstance(item, Mapping)]
|
||||
if fields:
|
||||
|
||||
Reference in New Issue
Block a user