0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/frontend/scripts/print_property_name_aliases.ts
Manoel Aranda Neto d26aa00438
chore: Add "Latest" prefix to person properties + refactor KEY_MAPPING (#20106)
* fix: change us to app API missing onboarding pages

* fix

* Update UI snapshots for `chromium` (2)

* chore: append latest to the properties that are overwritten for every event

* fix

* Update UI snapshots for `chromium` (2)

* rest

* Resolve the `keyMapping` mess once and for all

* Fix some rendering

* Add `type` to more places

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (2)

* fix: add groups to taxonomy

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Michael Matloka <michal@matloka.com>
Co-authored-by: Neil Kakkar <neilkakkar@gmail.com>
Co-authored-by: Michael Matloka <dev@twixes.com>
2024-02-07 18:01:10 +01:00

36 lines
1.2 KiB
TypeScript

import { CORE_FILTER_DEFINITIONS_BY_GROUP } from 'lib/taxonomy'
// Creates PROPERTY_NAME_ALIASES in posthog/api/property_definition.py
// eslint-disable-next-line no-console
console.log(
JSON.stringify(
Object.fromEntries(
Array.from(Object.entries(CORE_FILTER_DEFINITIONS_BY_GROUP.event_properties))
.map(([key, value]) => [key, value.label])
.filter(([key, label]) => {
if (!key) {
return false
}
if (!label || label.includes('deprecated')) {
return false
}
const keyLower = key.toLowerCase()
const labelLower = label.toLowerCase()
if (keyLower.includes(labelLower)) {
return false
}
const keyLowerNoSpecial = keyLower.replace(/[$_]+/g, ' ')
const labelWords = labelLower.split(/\s+/)
return !labelWords.every((word) => keyLowerNoSpecial.includes(word))
})
.sort()
),
null,
4
)
)