MCPcopy
hub / github.com/PostHog/posthog / getPluginRows

Function getPluginRows

plugin-server/src/utils/db/sql.ts:39–82  ·  view source on GitHub ↗
(hub: Hub)

Source from the content-addressed store, hash-verified

37}
38
39export async function getPluginRows(hub: Hub): Promise<Plugin[]> {
40 const { rows }: { rows: Plugin[] } = await hub.db.postgresQuery(
41 // `posthog_plugin` columns have to be listed individually, as we want to exclude a few columns
42 // and Postgres syntax unfortunately doesn't have a column exclusion feature. The excluded columns are:
43 // - archive - this is a potentially large blob, only extracted in Django as a plugin server optimization
44 // - latest_tag - not used in this service
45 // - latest_tag_checked_at - not used in this service
46 `SELECT
47 posthog_plugin.id,
48 posthog_plugin.name,
49 posthog_plugin.url,
50 posthog_plugin.tag,
51 posthog_plugin.from_json,
52 posthog_plugin.from_web,
53 posthog_plugin.error,
54 posthog_plugin.plugin_type,
55 posthog_plugin.organization_id,
56 posthog_plugin.is_global,
57 posthog_plugin.capabilities,
58 posthog_plugin.public_jobs,
59 posthog_plugin.is_stateless,
60 posthog_plugin.log_level,
61 posthog_plugin.updated_at,
62 psf__plugin_json.source as source__plugin_json,
63 psf__index_ts.source as source__index_ts,
64 psf__frontend_tsx.source as source__frontend_tsx,
65 psf__site_ts.source as source__site_ts
66 FROM posthog_plugin
67 LEFT JOIN posthog_pluginsourcefile psf__plugin_json
68 ON (psf__plugin_json.plugin_id = posthog_plugin.id AND psf__plugin_json.filename = 'plugin.json')
69 LEFT JOIN posthog_pluginsourcefile psf__index_ts
70 ON (psf__index_ts.plugin_id = posthog_plugin.id AND psf__index_ts.filename = 'index.ts')
71 LEFT JOIN posthog_pluginsourcefile psf__frontend_tsx
72 ON (psf__frontend_tsx.plugin_id = posthog_plugin.id AND psf__frontend_tsx.filename = 'frontend.tsx')
73 LEFT JOIN posthog_pluginsourcefile psf__site_ts
74 ON (psf__site_ts.plugin_id = posthog_plugin.id AND psf__site_ts.filename = 'site.ts')
75 WHERE posthog_plugin.id IN (${pluginConfigsInForceQuery('plugin_id')}
76 GROUP BY posthog_pluginconfig.plugin_id)`,
77 undefined,
78 'getPluginRows'
79 )
80
81 return rows
82}
83
84export async function getPluginAttachmentRows(hub: Hub): Promise<PluginAttachmentDB[]> {
85 const { rows }: { rows: PluginAttachmentDB[] } = await hub.db.postgresQuery(

Callers 2

loadPluginsFromDBFunction · 0.90
sql.test.tsFile · 0.90

Calls 2

postgresQueryMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…