Return JSON-safe per-integration runtime settings.
(settings: Any)
| 125 | |
| 126 | |
| 127 | def normalize_integration_settings(settings: Any) -> dict[str, dict[str, Any]]: |
| 128 | """Return JSON-safe per-integration runtime settings.""" |
| 129 | if not isinstance(settings, dict): |
| 130 | return {} |
| 131 | |
| 132 | normalized: dict[str, dict[str, Any]] = {} |
| 133 | for key, value in settings.items(): |
| 134 | if not isinstance(key, str) or not key.strip() or not isinstance(value, dict): |
| 135 | continue |
| 136 | |
| 137 | clean: dict[str, Any] = {} |
| 138 | script = value.get("script") |
| 139 | if isinstance(script, str) and script.strip(): |
| 140 | clean["script"] = script.strip() |
| 141 | |
| 142 | raw_options = value.get("raw_options") |
| 143 | if isinstance(raw_options, str): |
| 144 | clean["raw_options"] = raw_options |
| 145 | |
| 146 | parsed_options = value.get("parsed_options") |
| 147 | if isinstance(parsed_options, dict): |
| 148 | clean["parsed_options"] = parsed_options |
| 149 | |
| 150 | invoke_separator = value.get("invoke_separator") |
| 151 | if isinstance(invoke_separator, str) and invoke_separator.strip(): |
| 152 | clean["invoke_separator"] = invoke_separator.strip() |
| 153 | |
| 154 | if clean: |
| 155 | normalized[key.strip()] = clean |
| 156 | |
| 157 | return normalized |
| 158 | |
| 159 | |
| 160 | def _normalized_integration_state_schema(value: Any) -> int: |
no test coverage detected