MCPcopy Create free account
hub / github.com/cursor/community-plugins / getStarredPlugins

Function getStarredPlugins

apps/cursor/src/data/queries.ts:541–560  ·  view source on GitHub ↗
(userId: string)

Source from the content-addressed store, hash-verified

539}
540
541export async function getStarredPlugins(userId: string) {
542 "use cache";
543 cacheLife("hours");
544 cacheTag("plugins", `stars-${userId}`);
545
546 const supabase = await createClient();
547 const { data, error } = await supabase
548 .from("plugin_stars")
549 .select("plugin:plugin_id(*, plugin_components(*))")
550 .eq("user_id", userId);
551
552 // Without generated DB types, supabase-js can't tell this embedded
553 // resource is to-one, so the inferred shape needs correcting.
554 const rows = (data ?? []) as unknown as Array<{ plugin: PluginRow | null }>;
555 const plugins = rows
556 .map((row) => row.plugin)
557 .filter((plugin): plugin is PluginRow => Boolean(plugin));
558
559 return { data: plugins, error };
560}
561
562export async function hasUserStarredPlugin(pluginId: string, userId: string) {
563 const supabase = await createClient();

Callers 1

ProfileStarredPluginsFunction · 0.90

Calls 1

createClientFunction · 0.90

Tested by

no test coverage detected