Skip to content

Commit

Permalink
feat: add ee licensed replay transformer (#18874)
Browse files Browse the repository at this point in the history
first pass through using the EE licensed replay transformer in playback

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: David Newell <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2023
1 parent bda9166 commit 1632395
Show file tree
Hide file tree
Showing 27 changed files with 2,983 additions and 599 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.eslintrc.js
jest.config.ts
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module.exports = {
'compat',
'posthog',
'simple-import-sort',
'import',
],
rules: {
'no-console': ['error', { allow: ['warn', 'error'] }],
Expand Down Expand Up @@ -261,6 +262,19 @@ module.exports = {
'no-constant-condition': 'off',
'no-prototype-builtins': 'off',
'no-irregular-whitespace': 'off',
'import/no-restricted-paths': [
'error',
{
zones: [
{
target: './frontend/**',
from: './ee/frontend/**',
message:
"EE licensed TypeScript should only be accessed via the posthogEE objects. Use `import posthogEE from '@posthog/ee/exports'`",
},
],
},
],
},
overrides: [
{
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ jobs:
if: needs.changes.outputs.frontend == 'true'
run: pnpm schema:build:json && git diff --exit-code

- name: Check if mobile replay "schema.json" is up to date
if: needs.changes.outputs.frontend == 'true'
run: pnpm mobile-replay:schema:build:json && git diff --exit-code

- name: Check toolbar bundle size
if: needs.changes.outputs.frontend == 'true'
uses: preactjs/compressed-size-action@v2
Expand Down
4 changes: 2 additions & 2 deletions .run/PostHog.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<env name="PYTHONUNBUFFERED" value="1" />
<env name="SESSION_RECORDING_KAFKA_COMPRESSION" value="gzip" />
<env name="SESSION_RECORDING_KAFKA_HOSTS" value="localhost" />
<env name="SESSION_RECORDING_KAFKA_MAX_REQUEST_SIZE_BYTES" value="524288" />
<env name="SESSION_RECORDING_KAFKA_MAX_REQUEST_SIZE_BYTES" value="20971520" />
<env name="SKIP_SERVICE_VERSION_REQUIREMENTS" value="1" />
<env name="REPLAY_EVENTS_NEW_CONSUMER_RATIO" value="1" />
</envs>
Expand Down Expand Up @@ -48,4 +48,4 @@
<option name="customRunCommand" value="" />
<method v="2" />
</configuration>
</component>
</component>
19 changes: 9 additions & 10 deletions ee/frontend/exports.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { PostHogEE } from '@posthog/ee/types'

const myTestCode = (): void => {
// eslint-disable-next-line no-console
console.log('it works!')
}
import { transformEventToWeb, transformToWeb } from './mobile-replay'

const postHogEE: PostHogEE = {
enabled: true,
myTestCode,
}

export default postHogEE
export default async (): Promise<PostHogEE> =>
Promise.resolve({
enabled: true,
mobileReplay: {
transformEventToWeb,
transformToWeb,
},
})
Loading

0 comments on commit 1632395

Please sign in to comment.