(
userId: string,
{ includeInactive = false }: { includeInactive?: boolean } = {},
)
| 152 | } |
| 153 | |
| 154 | async function fetchUserPlugins( |
| 155 | userId: string, |
| 156 | { includeInactive = false }: { includeInactive?: boolean } = {}, |
| 157 | ) { |
| 158 | const supabase = await createClient(); |
| 159 | let query = supabase |
| 160 | .from("plugins") |
| 161 | .select("*, plugin_components(*)") |
| 162 | .eq("owner_id", userId); |
| 163 | |
| 164 | if (!includeInactive) { |
| 165 | query = query.eq("active", true); |
| 166 | } |
| 167 | |
| 168 | const { data, error } = await query |
| 169 | .order("install_count", { ascending: false }) |
| 170 | .order("created_at", { ascending: false }); |
| 171 | |
| 172 | return { data: data as PluginRow[] | null, error }; |
| 173 | } |
| 174 | |
| 175 | async function getPublicUserPlugins(userId: string) { |
| 176 | "use cache"; |
no test coverage detected