| 248 | } |
| 249 | |
| 250 | std::unique_ptr<proc::DataProcessor> DataProcessorService::makeRestoredProcessor( |
| 251 | const std::string& id, const std::string& params_json, const std::string& source_fallback) const { |
| 252 | // 1. Live catalogue by id (the common case — bundled filters always resolve here). |
| 253 | if (filter_catalogue_ && filter_catalogue_->find(id) != nullptr) { |
| 254 | if (auto made = filter_catalogue_->makeProcessor(id, params_json); made.has_value()) { |
| 255 | return std::move(made).value(); |
| 256 | } |
| 257 | } |
| 258 | // 2. The layout's embedded source — self-sufficient, so it must restore even with |
| 259 | // NO catalogue installed (a layout that carries its own filter source). Compile |
| 260 | // it through the installed catalogue's engine when present, else a transient one |
| 261 | // (the built LuaSisoTransform shares ownership of the engine, so it outlives the |
| 262 | // temporary catalogue). |
| 263 | if (!source_fallback.empty()) { |
| 264 | auto made = filter_catalogue_ ? filter_catalogue_->makeProcessorFromSource(source_fallback, id, params_json) |
| 265 | : scripting::FilterCatalogue(scripting::makeLuauEngine()) |
| 266 | .makeProcessorFromSource(source_fallback, id, params_json); |
| 267 | if (made.has_value()) { |
| 268 | return std::move(made).value(); |
| 269 | } |
| 270 | } |
| 271 | // Unresolved: the caller logs a skip-with-diagnostic. |
| 272 | return nullptr; |
| 273 | } |
| 274 | |
| 275 | // --- Plugin-created transforms (pj.data_processors.v1 host side) --- |
| 276 | |