(specificField?: keyof PluginConfig)
| 11 | } from '../../types' |
| 12 | |
| 13 | function 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 | |
| 39 | export async function getPluginRows(hub: Hub): Promise<Plugin[]> { |
| 40 | const { rows }: { rows: Plugin[] } = await hub.db.postgresQuery( |
no outgoing calls
no test coverage detected
searching dependent graphs…