feat: expand module workflows, dynamic config, notifications and console API
This commit is contained in:
1 parent
8df5266abb
commit
b124d757b0
309 files changed
+89357
-6231
No files matched your search
@@ -14,6 +14,8 @@ from pathlib import Path, PurePosixPath
|
||||
from types import MappingProxyType
|
||||
from typing import Iterable, Literal, Mapping
|
||||
|
||||
from gyxx_flow.notification_routing import NOTIFICATION_CAPABILITIES
|
||||
|
||||
CommandKind = Literal["python", "batch", "powershell"]
|
||||
|
||||
_COMMAND_ID_PATTERN = re.compile(
|
||||
@@ -48,6 +50,7 @@ class ScriptEntry:
|
||||
kind: CommandKind
|
||||
path: Path
|
||||
default_args: tuple[str, ...] = ()
|
||||
notification_workflow_id: str | None = None
|
||||
|
||||
@property
|
||||
def legacy_script_id(self) -> str:
|
||||
@@ -189,6 +192,7 @@ def _load_entry(
|
||||
entry = record.get("entry")
|
||||
kind = record.get("kind")
|
||||
default_args = record.get("default_args", [])
|
||||
notification_workflow_id = record.get("notification_workflow_id")
|
||||
if not isinstance(command_id, str) or not _COMMAND_ID_PATTERN.fullmatch(command_id):
|
||||
raise ScriptCatalogError(f"invalid command id at index {index}: {command_id!r}")
|
||||
if not isinstance(module, str) or module not in roots:
|
||||
@@ -203,6 +207,14 @@ def _load_entry(
|
||||
raise ScriptCatalogError(
|
||||
f"invalid command default_args at index {index}: {default_args!r}"
|
||||
)
|
||||
if (
|
||||
notification_workflow_id is not None
|
||||
and notification_workflow_id not in NOTIFICATION_CAPABILITIES
|
||||
):
|
||||
raise ScriptCatalogError(
|
||||
"invalid command notification_workflow_id at index "
|
||||
f"{index}: {notification_workflow_id!r}"
|
||||
)
|
||||
suffixes = _KIND_SUFFIXES[kind]
|
||||
if PurePosixPath(entry).suffix.casefold() not in suffixes:
|
||||
raise ScriptCatalogError(
|
||||
@@ -223,6 +235,7 @@ def _load_entry(
|
||||
kind,
|
||||
target,
|
||||
tuple(default_args),
|
||||
notification_workflow_id,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user