MCPcopy Index your code
hub / github.com/PostHog/posthog / pluginConfigsInForceQuery

Function pluginConfigsInForceQuery

plugin-server/src/utils/db/sql.ts:13–37  ·  view source on GitHub ↗
(specificField?: keyof PluginConfig)

Source from the content-addressed store, hash-verified

11} from '../../types'
12
13function pluginConfigsInForceQuery(specificField?: keyof PluginConfig): string {
14 const fields = specificField
15 ? `posthog_pluginconfig.${specificField}`
16 : `
17 posthog_pluginconfig.id,
18 posthog_pluginconfig.team_id,
19 posthog_pluginconfig.plugin_id,
20 posthog_pluginconfig.enabled,
21 posthog_pluginconfig.order,
22 posthog_pluginconfig.config,
23 posthog_pluginconfig.updated_at,
24 posthog_pluginconfig.created_at,
25 posthog_pluginconfig.error IS NOT NULL AS has_error
26 `
27
28 return `SELECT ${fields}
29 FROM posthog_pluginconfig
30 LEFT JOIN posthog_team ON posthog_team.id = posthog_pluginconfig.team_id
31 LEFT JOIN posthog_organization ON posthog_organization.id = posthog_team.organization_id
32 LEFT JOIN posthog_plugin ON posthog_plugin.id = posthog_pluginconfig.plugin_id
33 WHERE (
34 posthog_pluginconfig.enabled='t' AND posthog_organization.plugins_access_level > 0
35 AND (posthog_plugin.organization_id = posthog_organization.id OR posthog_plugin.is_global)
36 )`
37}
38
39export async function getPluginRows(hub: Hub): Promise<Plugin[]> {
40 const { rows }: { rows: Plugin[] } = await hub.db.postgresQuery(

Callers 3

getPluginRowsFunction · 0.85
getPluginAttachmentRowsFunction · 0.85
getPluginConfigRowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…