| 184 | } |
| 185 | |
| 186 | static Result<Value> getJsModulePropertyWithSchema( |
| 187 | Runtime* runtime, |
| 188 | const std::shared_ptr<snap::valdi_core::JSRuntimeNativeObjectsManager>& nativeObjectsManager, |
| 189 | ValueSchemaRegistry* registry, |
| 190 | std::string_view moduleName, |
| 191 | std::string_view propertyName, |
| 192 | std::string_view propertySchema) { |
| 193 | auto propertySchemaResult = ValueSchema::parse(propertySchema); |
| 194 | if (!propertySchemaResult) { |
| 195 | return propertySchemaResult.moveError(); |
| 196 | } |
| 197 | |
| 198 | auto schema = ValueSchema::cls( |
| 199 | STRING_LITERAL("JSModule"), |
| 200 | false, |
| 201 | {ClassPropertySchema(StringCache::getGlobal().makeString(propertyName), propertySchemaResult.value())}); |
| 202 | |
| 203 | auto unmarshalledJsModule = getJsModuleWithSchema(runtime, nativeObjectsManager, registry, moduleName, schema); |
| 204 | if (!unmarshalledJsModule) { |
| 205 | return unmarshalledJsModule.moveError(); |
| 206 | } |
| 207 | |
| 208 | return unmarshalledJsModule.value().getTypedObject()->getProperty(0); |
| 209 | } |
| 210 | |
| 211 | static Result<Value> getJsModulePropertyWithSchema(Runtime* runtime, |
| 212 | std::string_view moduleName, |
no test coverage detected