* Top-N active plugins with a name trigram-similar to this one.
( pluginId: string, )
| 240 | * Top-N active plugins with a name trigram-similar to this one. |
| 241 | */ |
| 242 | async function findSimilarPlugins( |
| 243 | pluginId: string, |
| 244 | ): Promise<SimilarPluginRow[]> { |
| 245 | const supabase = await createClient(); |
| 246 | const { data, error } = await supabase.rpc("find_similar_plugins", { |
| 247 | p_plugin_id: pluginId, |
| 248 | p_threshold: SIMILAR_THRESHOLD, |
| 249 | p_limit: SIMILAR_LIMIT, |
| 250 | }); |
| 251 | |
| 252 | if (error) { |
| 253 | logError( |
| 254 | pluginId, |
| 255 | "find_similar_plugins failed (continuing without)", |
| 256 | error, |
| 257 | ); |
| 258 | return []; |
| 259 | } |
| 260 | |
| 261 | return (data ?? []) as SimilarPluginRow[]; |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * Exported so the drain route can reuse it for the "exceeded MAX_ATTEMPTS" |
no test coverage detected