:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { ReadOnlyGroupTypeManager } from '~/common/groups/readonly-group-type-manager'
import { ok } from '~/ingestion/framework/results'
import { ProcessingStep } from '~/ingestion/framework/steps'
import { PreIngestionEvent, Team } from '~/types'
import { enrichPropertiesWithGroupTypes } from './groups'
export interface ReadOnlyProcessGroupsStepInput {
preparedEvent: PreIngestionEvent
team: Team
processPerson: boolean
}
export type ReadOnlyProcessGroupsStepResult<TInput> = TInput
export function createReadOnlyProcessGroupsStep<TInput extends ReadOnlyProcessGroupsStepInput>(
groupTypeManager: ReadOnlyGroupTypeManager
): ProcessingStep<TInput, ReadOnlyProcessGroupsStepResult<TInput>> {
return async function readOnlyProcessGroupsStep(input: TInput) {
const { preparedEvent, team, processPerson } = input
if (processPerson && preparedEvent.properties.$groups) {
const groupTypes = await groupTypeManager.fetchGroupTypes(team.project_id)
enrichPropertiesWithGroupTypes(preparedEvent.properties, groupTypes)
}
return ok(input)
}
}