From cfa779f89debff5bda4ac7cd5c01b04bceca331b Mon Sep 17 00:00:00 2001 From: Ben White Date: Mon, 9 Dec 2024 14:23:50 +0100 Subject: [PATCH] feat: Cache remote config (#26719) Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- posthog/api/remote_config.py | 34 +- .../api/test/__snapshots__/test_decide.ambr | 740 ++++++++++++------ .../test_early_access_feature.ambr | 260 ++++-- .../test_organization_feature_flag.ambr | 364 +++++---- .../api/test/__snapshots__/test_survey.ambr | 445 +++++++---- posthog/api/test/test_remote_config.py | 96 +++ posthog/models/remote_config.py | 84 +- posthog/models/test/test_hog_function.py | 4 +- posthog/models/test/test_remote_config.py | 69 +- .../test_process_scheduled_changes.ambr | 555 +++++++------ .../test/__snapshots__/test_feature_flag.ambr | 477 ++++++++--- 11 files changed, 2108 insertions(+), 1020 deletions(-) create mode 100644 posthog/api/test/test_remote_config.py diff --git a/posthog/api/remote_config.py b/posthog/api/remote_config.py index fc4ce74bc864f..3802001dcd2b6 100644 --- a/posthog/api/remote_config.py +++ b/posthog/api/remote_config.py @@ -1,4 +1,6 @@ +import re from django.http import JsonResponse, Http404, HttpResponse +from rest_framework.exceptions import ValidationError from rest_framework.views import APIView from posthog.models.remote_config import RemoteConfig @@ -11,28 +13,38 @@ class BaseRemoteConfigAPIView(APIView): authentication_classes = [] permission_classes = [] - def get_object(self, token: str) -> RemoteConfig: - try: - return RemoteConfig.objects.get(team__api_token=token) - except RemoteConfig.DoesNotExist: - raise Http404() + def check_token(self, token: str): + # Simple check rather than involving a whole serializer + if len(token) > 200 or not re.match(r"^[a-zA-Z0-9_]+$", token): + raise ValidationError("Invalid token") + return token class RemoteConfigAPIView(BaseRemoteConfigAPIView): def get(self, request, token: str, *args, **kwargs): - resource = self.get_object(token) - return JsonResponse(resource.config) + try: + resource = RemoteConfig.get_config_via_token(self.check_token(token)) + except RemoteConfig.DoesNotExist: + raise Http404() + + return JsonResponse(resource) class RemoteConfigJSAPIView(BaseRemoteConfigAPIView): def get(self, request, token: str, *args, **kwargs): - resource = self.get_object(token) - script_content = resource.build_js_config() + try: + script_content = RemoteConfig.get_config_js_via_token(self.check_token(token)) + except RemoteConfig.DoesNotExist: + raise Http404() + return HttpResponse(script_content, content_type="application/javascript") class RemoteConfigArrayJSAPIView(BaseRemoteConfigAPIView): def get(self, request, token: str, *args, **kwargs): - resource = self.get_object(token) - script_content = resource.build_array_js_config() + try: + script_content = RemoteConfig.get_array_js_via_token(self.check_token(token)) + except RemoteConfig.DoesNotExist: + raise Http404() + return HttpResponse(script_content, content_type="application/javascript") diff --git a/posthog/api/test/__snapshots__/test_decide.ambr b/posthog/api/test/__snapshots__/test_decide.ambr index ac1ce18e6fc8a..bb98b5da34e98 100644 --- a/posthog/api/test/__snapshots__/test_decide.ambr +++ b/posthog/api/test/__snapshots__/test_decide.ambr @@ -516,6 +516,51 @@ ''' # --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.23 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.24 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.25 ''' SELECT 1 AS "a" FROM "posthog_grouptypemapping" @@ -523,7 +568,7 @@ LIMIT 1 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.24 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.26 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -586,7 +631,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.25 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.27 ''' SELECT "posthog_productintent"."id", "posthog_productintent"."team_id", @@ -600,7 +645,7 @@ WHERE "posthog_productintent"."team_id" = 99999 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.26 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.28 ''' SELECT "posthog_productintent"."product_type", "posthog_productintent"."created_at", @@ -610,7 +655,7 @@ WHERE "posthog_productintent"."team_id" = 99999 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.27 +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.29 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -642,45 +687,6 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.28 - ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "posthog_featureflag"."rollback_conditions", - "posthog_featureflag"."performed_rollback", - "posthog_featureflag"."ensure_experience_continuity", - "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."active" - AND NOT "posthog_featureflag"."deleted" - AND "posthog_featureflag"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.29 - ''' - SELECT "posthog_pluginconfig"."id", - "posthog_pluginconfig"."web_token", - "posthog_pluginsourcefile"."updated_at", - "posthog_plugin"."updated_at", - "posthog_pluginconfig"."updated_at" - FROM "posthog_pluginconfig" - INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") - INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") - WHERE ("posthog_pluginconfig"."enabled" - AND "posthog_pluginsourcefile"."filename" = 'site.ts' - AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' - AND "posthog_pluginconfig"."team_id" = 99999) - ''' -# --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.3 ''' SELECT "posthog_team"."id", @@ -753,15 +759,41 @@ # --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.30 ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."type" - FROM "posthog_hogfunction" - WHERE ("posthog_hogfunction"."enabled" - AND "posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."transpiled" IS NOT NULL - AND "posthog_hogfunction"."type" IN ('site_destination', - 'site_app')) + SELECT "posthog_featureflag"."id", + "posthog_featureflag"."key", + "posthog_featureflag"."name", + "posthog_featureflag"."filters", + "posthog_featureflag"."rollout_percentage", + "posthog_featureflag"."team_id", + "posthog_featureflag"."created_by_id", + "posthog_featureflag"."created_at", + "posthog_featureflag"."deleted", + "posthog_featureflag"."active", + "posthog_featureflag"."rollback_conditions", + "posthog_featureflag"."performed_rollback", + "posthog_featureflag"."ensure_experience_continuity", + "posthog_featureflag"."usage_dashboard_id", + "posthog_featureflag"."has_enriched_analytics" + FROM "posthog_featureflag" + WHERE ("posthog_featureflag"."active" + AND NOT "posthog_featureflag"."deleted" + AND "posthog_featureflag"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.31 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginconfig"."web_token", + "posthog_pluginsourcefile"."updated_at", + "posthog_plugin"."updated_at", + "posthog_pluginconfig"."updated_at" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) ''' # --- # name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.4 @@ -1109,6 +1141,81 @@ ''' # --- # name: TestDecide.test_flag_with_behavioural_cohorts.10 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_id", + "posthog_team"."project_id", + "posthog_team"."api_token", + "posthog_team"."app_urls", + "posthog_team"."name", + "posthog_team"."slack_incoming_webhook", + "posthog_team"."created_at", + "posthog_team"."updated_at", + "posthog_team"."anonymize_ips", + "posthog_team"."completed_snippet_onboarding", + "posthog_team"."has_completed_onboarding_for", + "posthog_team"."ingested_event", + "posthog_team"."autocapture_opt_out", + "posthog_team"."autocapture_web_vitals_opt_in", + "posthog_team"."autocapture_web_vitals_allowed_metrics", + "posthog_team"."autocapture_exceptions_opt_in", + "posthog_team"."autocapture_exceptions_errors_to_ignore", + "posthog_team"."person_processing_opt_out", + "posthog_team"."session_recording_opt_in", + "posthog_team"."session_recording_sample_rate", + "posthog_team"."session_recording_minimum_duration_milliseconds", + "posthog_team"."session_recording_linked_flag", + "posthog_team"."session_recording_network_payload_capture_config", + "posthog_team"."session_recording_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "posthog_team"."session_recording_version", + "posthog_team"."signup_token", + "posthog_team"."is_demo", + "posthog_team"."access_control", + "posthog_team"."week_start_day", + "posthog_team"."inject_web_apps", + "posthog_team"."test_account_filters", + "posthog_team"."test_account_filters_default_checked", + "posthog_team"."path_cleaning_filters", + "posthog_team"."timezone", + "posthog_team"."data_attributes", + "posthog_team"."person_display_name_properties", + "posthog_team"."live_events_columns", + "posthog_team"."recording_domains", + "posthog_team"."primary_dashboard_id", + "posthog_team"."extra_settings", + "posthog_team"."modifiers", + "posthog_team"."correlation_config", + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id", + "posthog_team"."external_data_workspace_last_synced_at" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.11 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.12 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1178,7 +1285,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.11 +# name: TestDecide.test_flag_with_behavioural_cohorts.13 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -1187,7 +1294,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.12 +# name: TestDecide.test_flag_with_behavioural_cohorts.14 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.15 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.16 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1212,7 +1364,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.13 +# name: TestDecide.test_flag_with_behavioural_cohorts.17 ''' SELECT "posthog_group"."id", "posthog_group"."team_id", @@ -1228,7 +1380,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.14 +# name: TestDecide.test_flag_with_behavioural_cohorts.18 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1253,7 +1405,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.15 +# name: TestDecide.test_flag_with_behavioural_cohorts.19 ''' SELECT "posthog_group"."id", "posthog_group"."team_id", @@ -1361,6 +1513,51 @@ ''' # --- # name: TestDecide.test_flag_with_behavioural_cohorts.5 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.6 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_flag_with_behavioural_cohorts.7 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -1392,7 +1589,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.6 +# name: TestDecide.test_flag_with_behavioural_cohorts.8 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1462,7 +1659,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.7 +# name: TestDecide.test_flag_with_behavioural_cohorts.9 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -1485,9 +1682,29 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_behavioural_cohorts.8 +# name: TestDecide.test_flag_with_regular_cohorts ''' - SELECT "posthog_team"."id", + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id", + "posthog_team"."id", "posthog_team"."uuid", "posthog_team"."organization_id", "posthog_team"."project_id", @@ -1541,48 +1758,24 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestDecide.test_flag_with_behavioural_cohorts.9 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 + FROM "posthog_hogfunction" + INNER JOIN "posthog_team" ON ("posthog_hogfunction"."team_id" = "posthog_team"."id") + WHERE ("posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."filters" @> '{"filter_test_accounts": true}'::jsonb) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts +# name: TestDecide.test_flag_with_regular_cohorts.1 ''' - SELECT "posthog_hogfunction"."id", - "posthog_hogfunction"."team_id", - "posthog_hogfunction"."name", - "posthog_hogfunction"."description", - "posthog_hogfunction"."created_at", - "posthog_hogfunction"."created_by_id", - "posthog_hogfunction"."deleted", - "posthog_hogfunction"."updated_at", - "posthog_hogfunction"."enabled", - "posthog_hogfunction"."type", - "posthog_hogfunction"."icon_url", - "posthog_hogfunction"."hog", - "posthog_hogfunction"."bytecode", - "posthog_hogfunction"."transpiled", - "posthog_hogfunction"."inputs_schema", - "posthog_hogfunction"."inputs", - "posthog_hogfunction"."encrypted_inputs", - "posthog_hogfunction"."filters", - "posthog_hogfunction"."masking", - "posthog_hogfunction"."template_id", - "posthog_team"."id", + SELECT "posthog_team"."id", "posthog_team"."uuid", "posthog_team"."organization_id", "posthog_team"."project_id", @@ -1636,22 +1829,14 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_hogfunction" - INNER JOIN "posthog_team" ON ("posthog_hogfunction"."team_id" = "posthog_team"."id") - WHERE ("posthog_hogfunction"."team_id" = 99999 - AND "posthog_hogfunction"."filters" @> '{"filter_test_accounts": true}'::jsonb) + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.1 +# name: TestDecide.test_flag_with_regular_cohorts.10 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1714,7 +1899,19 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.10 +# name: TestDecide.test_flag_with_regular_cohorts.11 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts.12 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1784,7 +1981,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.11 +# name: TestDecide.test_flag_with_regular_cohorts.13 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -1793,7 +1990,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.12 +# name: TestDecide.test_flag_with_regular_cohorts.14 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts.15 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts.16 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1818,7 +2060,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.13 +# name: TestDecide.test_flag_with_regular_cohorts.17 ''' SELECT (("posthog_person"."properties" -> '$some_prop_1') = '"something_1"'::jsonb AND "posthog_person"."properties" ? '$some_prop_1' @@ -1830,7 +2072,7 @@ AND "posthog_person"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.14 +# name: TestDecide.test_flag_with_regular_cohorts.18 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1855,7 +2097,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.15 +# name: TestDecide.test_flag_with_regular_cohorts.19 ''' SELECT (("posthog_person"."properties" -> '$some_prop_1') = '"something_1"'::jsonb AND "posthog_person"."properties" ? '$some_prop_1' @@ -1959,6 +2201,51 @@ ''' # --- # name: TestDecide.test_flag_with_regular_cohorts.5 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts.6 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_flag_with_regular_cohorts.7 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -1990,7 +2277,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.6 +# name: TestDecide.test_flag_with_regular_cohorts.8 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -2060,7 +2347,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.7 +# name: TestDecide.test_flag_with_regular_cohorts.9 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -2083,7 +2370,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.8 +# name: TestDecide.test_web_app_queries ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -2142,23 +2429,63 @@ "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 + WHERE "posthog_team"."api_token" = 'token123' LIMIT 21 ''' # --- -# name: TestDecide.test_flag_with_regular_cohorts.9 +# name: TestDecide.test_web_app_queries.1 ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 + SELECT "posthog_featureflag"."id", + "posthog_featureflag"."key", + "posthog_featureflag"."name", + "posthog_featureflag"."filters", + "posthog_featureflag"."rollout_percentage", + "posthog_featureflag"."team_id", + "posthog_featureflag"."created_by_id", + "posthog_featureflag"."created_at", + "posthog_featureflag"."deleted", + "posthog_featureflag"."active", + "posthog_featureflag"."rollback_conditions", + "posthog_featureflag"."performed_rollback", + "posthog_featureflag"."ensure_experience_continuity", + "posthog_featureflag"."usage_dashboard_id", + "posthog_featureflag"."has_enriched_analytics" + FROM "posthog_featureflag" + WHERE ("posthog_featureflag"."active" + AND NOT "posthog_featureflag"."deleted" + AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_web_app_queries +# name: TestDecide.test_web_app_queries.10 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_web_app_queries.11 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -2217,34 +2544,11 @@ "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" - WHERE "posthog_team"."api_token" = 'token123' + WHERE "posthog_team"."id" = 99999 LIMIT 21 ''' # --- -# name: TestDecide.test_web_app_queries.1 - ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "posthog_featureflag"."rollback_conditions", - "posthog_featureflag"."performed_rollback", - "posthog_featureflag"."ensure_experience_continuity", - "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."active" - AND NOT "posthog_featureflag"."deleted" - AND "posthog_featureflag"."team_id" = 99999) - ''' -# --- -# name: TestDecide.test_web_app_queries.10 +# name: TestDecide.test_web_app_queries.12 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -2256,7 +2560,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_web_app_queries.11 +# name: TestDecide.test_web_app_queries.13 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -2326,7 +2630,7 @@ LIMIT 21 ''' # --- -# name: TestDecide.test_web_app_queries.12 +# name: TestDecide.test_web_app_queries.14 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -2335,7 +2639,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestDecide.test_web_app_queries.13 +# name: TestDecide.test_web_app_queries.15 ''' SELECT "posthog_pluginconfig"."id", "posthog_pluginconfig"."web_token", @@ -2351,7 +2655,52 @@ AND "posthog_pluginconfig"."team_id" = 99999) ''' # --- -# name: TestDecide.test_web_app_queries.14 +# name: TestDecide.test_web_app_queries.16 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestDecide.test_web_app_queries.17 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestDecide.test_web_app_queries.18 ''' SELECT "posthog_pluginconfig"."id", "posthog_pluginconfig"."web_token", @@ -2367,7 +2716,7 @@ AND "posthog_pluginconfig"."team_id" = 99999) ''' # --- -# name: TestDecide.test_web_app_queries.15 +# name: TestDecide.test_web_app_queries.19 ''' SELECT "posthog_pluginconfig"."id", "posthog_pluginconfig"."web_token", @@ -2662,64 +3011,17 @@ # --- # name: TestDecide.test_web_app_queries.9 ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_id", - "posthog_team"."project_id", - "posthog_team"."api_token", - "posthog_team"."app_urls", - "posthog_team"."name", - "posthog_team"."slack_incoming_webhook", - "posthog_team"."created_at", - "posthog_team"."updated_at", - "posthog_team"."anonymize_ips", - "posthog_team"."completed_snippet_onboarding", - "posthog_team"."has_completed_onboarding_for", - "posthog_team"."ingested_event", - "posthog_team"."autocapture_opt_out", - "posthog_team"."autocapture_web_vitals_opt_in", - "posthog_team"."autocapture_web_vitals_allowed_metrics", - "posthog_team"."autocapture_exceptions_opt_in", - "posthog_team"."autocapture_exceptions_errors_to_ignore", - "posthog_team"."person_processing_opt_out", - "posthog_team"."session_recording_opt_in", - "posthog_team"."session_recording_sample_rate", - "posthog_team"."session_recording_minimum_duration_milliseconds", - "posthog_team"."session_recording_linked_flag", - "posthog_team"."session_recording_network_payload_capture_config", - "posthog_team"."session_recording_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "posthog_team"."session_recording_version", - "posthog_team"."signup_token", - "posthog_team"."is_demo", - "posthog_team"."access_control", - "posthog_team"."week_start_day", - "posthog_team"."inject_web_apps", - "posthog_team"."test_account_filters", - "posthog_team"."test_account_filters_default_checked", - "posthog_team"."path_cleaning_filters", - "posthog_team"."timezone", - "posthog_team"."data_attributes", - "posthog_team"."person_display_name_properties", - "posthog_team"."live_events_columns", - "posthog_team"."recording_domains", - "posthog_team"."primary_dashboard_id", - "posthog_team"."extra_settings", - "posthog_team"."modifiers", - "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days", - "posthog_team"."external_data_workspace_id", - "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) ''' # --- diff --git a/posthog/api/test/__snapshots__/test_early_access_feature.ambr b/posthog/api/test/__snapshots__/test_early_access_feature.ambr index 608eb81e1b382..401bb26d24a9a 100644 --- a/posthog/api/test/__snapshots__/test_early_access_feature.ambr +++ b/posthog/api/test/__snapshots__/test_early_access_feature.ambr @@ -93,6 +93,88 @@ ''' # --- # name: TestPreviewList.test_early_access_features.10 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestPreviewList.test_early_access_features.11 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_id", + "posthog_team"."project_id", + "posthog_team"."api_token", + "posthog_team"."app_urls", + "posthog_team"."name", + "posthog_team"."slack_incoming_webhook", + "posthog_team"."created_at", + "posthog_team"."updated_at", + "posthog_team"."anonymize_ips", + "posthog_team"."completed_snippet_onboarding", + "posthog_team"."has_completed_onboarding_for", + "posthog_team"."ingested_event", + "posthog_team"."autocapture_opt_out", + "posthog_team"."autocapture_web_vitals_opt_in", + "posthog_team"."autocapture_web_vitals_allowed_metrics", + "posthog_team"."autocapture_exceptions_opt_in", + "posthog_team"."autocapture_exceptions_errors_to_ignore", + "posthog_team"."person_processing_opt_out", + "posthog_team"."session_recording_opt_in", + "posthog_team"."session_recording_sample_rate", + "posthog_team"."session_recording_minimum_duration_milliseconds", + "posthog_team"."session_recording_linked_flag", + "posthog_team"."session_recording_network_payload_capture_config", + "posthog_team"."session_recording_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "posthog_team"."session_recording_version", + "posthog_team"."signup_token", + "posthog_team"."is_demo", + "posthog_team"."access_control", + "posthog_team"."week_start_day", + "posthog_team"."inject_web_apps", + "posthog_team"."test_account_filters", + "posthog_team"."test_account_filters_default_checked", + "posthog_team"."path_cleaning_filters", + "posthog_team"."timezone", + "posthog_team"."data_attributes", + "posthog_team"."person_display_name_properties", + "posthog_team"."live_events_columns", + "posthog_team"."recording_domains", + "posthog_team"."primary_dashboard_id", + "posthog_team"."extra_settings", + "posthog_team"."modifiers", + "posthog_team"."correlation_config", + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", + "posthog_team"."external_data_workspace_last_synced_at" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestPreviewList.test_early_access_features.12 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -101,7 +183,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestPreviewList.test_early_access_features.11 +# name: TestPreviewList.test_early_access_features.13 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestPreviewList.test_early_access_features.14 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestPreviewList.test_early_access_features.15 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -133,7 +260,7 @@ LIMIT 21 ''' # --- -# name: TestPreviewList.test_early_access_features.12 +# name: TestPreviewList.test_early_access_features.16 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -196,7 +323,7 @@ LIMIT 21 ''' # --- -# name: TestPreviewList.test_early_access_features.13 +# name: TestPreviewList.test_early_access_features.17 ''' SELECT "posthog_earlyaccessfeature"."id", "posthog_earlyaccessfeature"."team_id", @@ -382,6 +509,51 @@ ''' # --- # name: TestPreviewList.test_early_access_features.6 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestPreviewList.test_early_access_features.7 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestPreviewList.test_early_access_features.8 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -404,81 +576,6 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestPreviewList.test_early_access_features.7 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_id", - "posthog_team"."project_id", - "posthog_team"."api_token", - "posthog_team"."app_urls", - "posthog_team"."name", - "posthog_team"."slack_incoming_webhook", - "posthog_team"."created_at", - "posthog_team"."updated_at", - "posthog_team"."anonymize_ips", - "posthog_team"."completed_snippet_onboarding", - "posthog_team"."has_completed_onboarding_for", - "posthog_team"."ingested_event", - "posthog_team"."autocapture_opt_out", - "posthog_team"."autocapture_web_vitals_opt_in", - "posthog_team"."autocapture_web_vitals_allowed_metrics", - "posthog_team"."autocapture_exceptions_opt_in", - "posthog_team"."autocapture_exceptions_errors_to_ignore", - "posthog_team"."person_processing_opt_out", - "posthog_team"."session_recording_opt_in", - "posthog_team"."session_recording_sample_rate", - "posthog_team"."session_recording_minimum_duration_milliseconds", - "posthog_team"."session_recording_linked_flag", - "posthog_team"."session_recording_network_payload_capture_config", - "posthog_team"."session_recording_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "posthog_team"."session_recording_version", - "posthog_team"."signup_token", - "posthog_team"."is_demo", - "posthog_team"."access_control", - "posthog_team"."week_start_day", - "posthog_team"."inject_web_apps", - "posthog_team"."test_account_filters", - "posthog_team"."test_account_filters_default_checked", - "posthog_team"."path_cleaning_filters", - "posthog_team"."timezone", - "posthog_team"."data_attributes", - "posthog_team"."person_display_name_properties", - "posthog_team"."live_events_columns", - "posthog_team"."recording_domains", - "posthog_team"."primary_dashboard_id", - "posthog_team"."extra_settings", - "posthog_team"."modifiers", - "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days", - "posthog_team"."external_data_workspace_id", - "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestPreviewList.test_early_access_features.8 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- # name: TestPreviewList.test_early_access_features.9 ''' SELECT "posthog_team"."id", @@ -535,13 +632,6 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" diff --git a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr index 4be955c775a21..1fb0fcefbf20e 100644 --- a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr @@ -235,6 +235,51 @@ ''' # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.15 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.16 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.17 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -304,7 +349,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.16 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.18 ''' SELECT "posthog_dashboardtile"."id" FROM "posthog_dashboardtile" @@ -315,7 +360,7 @@ AND "posthog_dashboardtile"."dashboard_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.17 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.19 ''' SELECT "posthog_organization"."id", "posthog_organization"."name", @@ -341,7 +386,16 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.18 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.2 + ''' + SELECT 1 AS "a" + FROM "posthog_organizationmembership" + WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid + AND "posthog_organizationmembership"."user_id" = 99999) + LIMIT 1 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.20 ''' SELECT "posthog_dashboardtile"."id" FROM "posthog_dashboardtile" @@ -352,7 +406,7 @@ AND "posthog_dashboardtile"."dashboard_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.19 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.21 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -415,16 +469,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.2 - ''' - SELECT 1 AS "a" - FROM "posthog_organizationmembership" - WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid - AND "posthog_organizationmembership"."user_id" = 99999) - LIMIT 1 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.20 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.22 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -459,7 +504,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.21 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.23 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -529,7 +574,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.22 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.24 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -592,7 +637,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.23 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.25 ''' SELECT "posthog_dashboardtile"."id", "posthog_dashboardtile"."dashboard_id", @@ -610,7 +655,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.24 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.26 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -645,7 +690,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.25 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.27 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -669,7 +714,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.26 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.28 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -739,7 +784,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.27 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.29 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -802,7 +847,30 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.28 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.3 + ''' + SELECT "posthog_featureflag"."id", + "posthog_featureflag"."key", + "posthog_featureflag"."name", + "posthog_featureflag"."filters", + "posthog_featureflag"."rollout_percentage", + "posthog_featureflag"."team_id", + "posthog_featureflag"."created_by_id", + "posthog_featureflag"."created_at", + "posthog_featureflag"."deleted", + "posthog_featureflag"."active", + "posthog_featureflag"."rollback_conditions", + "posthog_featureflag"."performed_rollback", + "posthog_featureflag"."ensure_experience_continuity", + "posthog_featureflag"."usage_dashboard_id", + "posthog_featureflag"."has_enriched_analytics" + FROM "posthog_featureflag" + WHERE ("posthog_featureflag"."key" = 'copied-flag-key' + AND "posthog_featureflag"."team_id" = 99999) + LIMIT 21 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.30 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -837,7 +905,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.29 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.31 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -907,30 +975,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.3 - ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "posthog_featureflag"."rollback_conditions", - "posthog_featureflag"."performed_rollback", - "posthog_featureflag"."ensure_experience_continuity", - "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."key" = 'copied-flag-key' - AND "posthog_featureflag"."team_id" = 99999) - LIMIT 21 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.30 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.32 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -993,7 +1038,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.31 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.33 ''' SELECT "posthog_dashboardtile"."id", "posthog_dashboardtile"."dashboard_id", @@ -1011,7 +1056,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.32 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.34 ''' SELECT "posthog_dashboarditem"."id", "posthog_dashboarditem"."name", @@ -1046,7 +1091,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.33 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.35 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -1070,7 +1115,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.34 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.36 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1140,7 +1185,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.35 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.37 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -1163,7 +1208,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.36 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.38 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1226,7 +1271,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.37 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.39 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -1238,7 +1283,33 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.38 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.4 + ''' + SELECT "posthog_organization"."id", + "posthog_organization"."name", + "posthog_organization"."slug", + "posthog_organization"."logo_media_id", + "posthog_organization"."created_at", + "posthog_organization"."updated_at", + "posthog_organization"."plugins_access_level", + "posthog_organization"."for_internal_metrics", + "posthog_organization"."is_member_join_email_enabled", + "posthog_organization"."enforce_2fa", + "posthog_organization"."is_hipaa", + "posthog_organization"."customer_id", + "posthog_organization"."available_product_features", + "posthog_organization"."usage", + "posthog_organization"."never_drop_data", + "posthog_organization"."customer_trust_scores", + "posthog_organization"."setup_section_2_completed", + "posthog_organization"."personalization", + "posthog_organization"."domain_whitelist" + FROM "posthog_organization" + WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid + LIMIT 21 + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.40 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1308,7 +1379,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.39 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.41 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -1317,33 +1388,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.4 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.42 ''' - SELECT "posthog_organization"."id", - "posthog_organization"."name", - "posthog_organization"."slug", - "posthog_organization"."logo_media_id", - "posthog_organization"."created_at", - "posthog_organization"."updated_at", - "posthog_organization"."plugins_access_level", - "posthog_organization"."for_internal_metrics", - "posthog_organization"."is_member_join_email_enabled", - "posthog_organization"."enforce_2fa", - "posthog_organization"."is_hipaa", - "posthog_organization"."customer_id", - "posthog_organization"."available_product_features", - "posthog_organization"."usage", - "posthog_organization"."never_drop_data", - "posthog_organization"."customer_trust_scores", - "posthog_organization"."setup_section_2_completed", - "posthog_organization"."personalization", - "posthog_organization"."domain_whitelist" - FROM "posthog_organization" - WHERE "posthog_organization"."id" = '00000000-0000-0000-0000-000000000000'::uuid - LIMIT 21 + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.40 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.43 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.44 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -1413,7 +1503,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.41 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.45 ''' SELECT "posthog_experiment"."id", "posthog_experiment"."name", @@ -1439,7 +1529,7 @@ WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.42 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.46 ''' SELECT "posthog_survey"."id", "posthog_survey"."team_id", @@ -1474,7 +1564,7 @@ WHERE "posthog_survey"."linked_flag_id" = 99999 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.43 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.47 ''' SELECT "posthog_earlyaccessfeature"."id", "posthog_earlyaccessfeature"."team_id", @@ -1488,7 +1578,7 @@ WHERE "posthog_earlyaccessfeature"."feature_flag_id" = 99999 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.44 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.48 ''' SELECT "posthog_organizationmembership"."id", "posthog_organizationmembership"."organization_id", @@ -1522,7 +1612,7 @@ LIMIT 21 ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.45 +# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.49 ''' SELECT "posthog_dashboard"."id", "posthog_dashboard"."name", @@ -1547,73 +1637,6 @@ AND "posthog_featureflagdashboards"."feature_flag_id" = 99999) ''' # --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.46 - ''' - SELECT "posthog_organizationmembership"."id", - "posthog_organizationmembership"."organization_id", - "posthog_organizationmembership"."user_id", - "posthog_organizationmembership"."level", - "posthog_organizationmembership"."joined_at", - "posthog_organizationmembership"."updated_at", - "posthog_organization"."id", - "posthog_organization"."name", - "posthog_organization"."slug", - "posthog_organization"."logo_media_id", - "posthog_organization"."created_at", - "posthog_organization"."updated_at", - "posthog_organization"."plugins_access_level", - "posthog_organization"."for_internal_metrics", - "posthog_organization"."is_member_join_email_enabled", - "posthog_organization"."enforce_2fa", - "posthog_organization"."is_hipaa", - "posthog_organization"."customer_id", - "posthog_organization"."available_product_features", - "posthog_organization"."usage", - "posthog_organization"."never_drop_data", - "posthog_organization"."customer_trust_scores", - "posthog_organization"."setup_section_2_completed", - "posthog_organization"."personalization", - "posthog_organization"."domain_whitelist" - FROM "posthog_organizationmembership" - INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id") - WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid - AND "posthog_organizationmembership"."user_id" = 99999) - LIMIT 21 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.47 - ''' - SELECT "posthog_instancesetting"."id", - "posthog_instancesetting"."key", - "posthog_instancesetting"."raw_value" - FROM "posthog_instancesetting" - WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_V2_ENABLED' - ORDER BY "posthog_instancesetting"."id" ASC - LIMIT 1 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.48 - ''' - SELECT "posthog_instancesetting"."id", - "posthog_instancesetting"."key", - "posthog_instancesetting"."raw_value" - FROM "posthog_instancesetting" - WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_ENABLED' - ORDER BY "posthog_instancesetting"."id" ASC - LIMIT 1 - ''' -# --- -# name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.49 - ''' - SELECT "posthog_instancesetting"."id", - "posthog_instancesetting"."key", - "posthog_instancesetting"."raw_value" - FROM "posthog_instancesetting" - WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_V2_ENABLED' - ORDER BY "posthog_instancesetting"."id" ASC - LIMIT 1 - ''' -# --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.5 ''' SELECT "posthog_team"."id", @@ -1679,13 +1702,36 @@ # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.50 ''' - SELECT "posthog_instancesetting"."id", - "posthog_instancesetting"."key", - "posthog_instancesetting"."raw_value" - FROM "posthog_instancesetting" - WHERE "posthog_instancesetting"."key" = 'constance:posthog:PERSON_ON_EVENTS_ENABLED' - ORDER BY "posthog_instancesetting"."id" ASC - LIMIT 1 + SELECT "posthog_organizationmembership"."id", + "posthog_organizationmembership"."organization_id", + "posthog_organizationmembership"."user_id", + "posthog_organizationmembership"."level", + "posthog_organizationmembership"."joined_at", + "posthog_organizationmembership"."updated_at", + "posthog_organization"."id", + "posthog_organization"."name", + "posthog_organization"."slug", + "posthog_organization"."logo_media_id", + "posthog_organization"."created_at", + "posthog_organization"."updated_at", + "posthog_organization"."plugins_access_level", + "posthog_organization"."for_internal_metrics", + "posthog_organization"."is_member_join_email_enabled", + "posthog_organization"."enforce_2fa", + "posthog_organization"."is_hipaa", + "posthog_organization"."customer_id", + "posthog_organization"."available_product_features", + "posthog_organization"."usage", + "posthog_organization"."never_drop_data", + "posthog_organization"."customer_trust_scores", + "posthog_organization"."setup_section_2_completed", + "posthog_organization"."personalization", + "posthog_organization"."domain_whitelist" + FROM "posthog_organizationmembership" + INNER JOIN "posthog_organization" ON ("posthog_organizationmembership"."organization_id" = "posthog_organization"."id") + WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid + AND "posthog_organizationmembership"."user_id" = 99999) + LIMIT 21 ''' # --- # name: TestOrganizationFeatureFlagCopy.test_copy_feature_flag_create_new.51 diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr index d7913780c7035..71dd2da339498 100644 --- a/posthog/api/test/__snapshots__/test_survey.ambr +++ b/posthog/api/test/__snapshots__/test_survey.ambr @@ -58,6 +58,88 @@ ''' # --- # name: TestSurveysAPIList.test_list_surveys.10 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.11 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_id", + "posthog_team"."project_id", + "posthog_team"."api_token", + "posthog_team"."app_urls", + "posthog_team"."name", + "posthog_team"."slack_incoming_webhook", + "posthog_team"."created_at", + "posthog_team"."updated_at", + "posthog_team"."anonymize_ips", + "posthog_team"."completed_snippet_onboarding", + "posthog_team"."has_completed_onboarding_for", + "posthog_team"."ingested_event", + "posthog_team"."autocapture_opt_out", + "posthog_team"."autocapture_web_vitals_opt_in", + "posthog_team"."autocapture_web_vitals_allowed_metrics", + "posthog_team"."autocapture_exceptions_opt_in", + "posthog_team"."autocapture_exceptions_errors_to_ignore", + "posthog_team"."person_processing_opt_out", + "posthog_team"."session_recording_opt_in", + "posthog_team"."session_recording_sample_rate", + "posthog_team"."session_recording_minimum_duration_milliseconds", + "posthog_team"."session_recording_linked_flag", + "posthog_team"."session_recording_network_payload_capture_config", + "posthog_team"."session_recording_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "posthog_team"."session_recording_version", + "posthog_team"."signup_token", + "posthog_team"."is_demo", + "posthog_team"."access_control", + "posthog_team"."week_start_day", + "posthog_team"."inject_web_apps", + "posthog_team"."test_account_filters", + "posthog_team"."test_account_filters_default_checked", + "posthog_team"."path_cleaning_filters", + "posthog_team"."timezone", + "posthog_team"."data_attributes", + "posthog_team"."person_display_name_properties", + "posthog_team"."live_events_columns", + "posthog_team"."recording_domains", + "posthog_team"."primary_dashboard_id", + "posthog_team"."extra_settings", + "posthog_team"."modifiers", + "posthog_team"."correlation_config", + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", + "posthog_team"."external_data_workspace_last_synced_at" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.12 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -66,7 +148,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.11 +# name: TestSurveysAPIList.test_list_surveys.13 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.14 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.15 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -89,7 +216,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.12 +# name: TestSurveysAPIList.test_list_surveys.16 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -152,7 +279,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.13 +# name: TestSurveysAPIList.test_list_surveys.17 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -164,7 +291,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.14 +# name: TestSurveysAPIList.test_list_surveys.18 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -234,7 +361,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.15 +# name: TestSurveysAPIList.test_list_surveys.19 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -243,7 +370,115 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.16 +# name: TestSurveysAPIList.test_list_surveys.2 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_id", + "posthog_team"."project_id", + "posthog_team"."api_token", + "posthog_team"."app_urls", + "posthog_team"."name", + "posthog_team"."slack_incoming_webhook", + "posthog_team"."created_at", + "posthog_team"."updated_at", + "posthog_team"."anonymize_ips", + "posthog_team"."completed_snippet_onboarding", + "posthog_team"."has_completed_onboarding_for", + "posthog_team"."ingested_event", + "posthog_team"."autocapture_opt_out", + "posthog_team"."autocapture_web_vitals_opt_in", + "posthog_team"."autocapture_web_vitals_allowed_metrics", + "posthog_team"."autocapture_exceptions_opt_in", + "posthog_team"."autocapture_exceptions_errors_to_ignore", + "posthog_team"."person_processing_opt_out", + "posthog_team"."session_recording_opt_in", + "posthog_team"."session_recording_sample_rate", + "posthog_team"."session_recording_minimum_duration_milliseconds", + "posthog_team"."session_recording_linked_flag", + "posthog_team"."session_recording_network_payload_capture_config", + "posthog_team"."session_recording_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "posthog_team"."session_recording_version", + "posthog_team"."signup_token", + "posthog_team"."is_demo", + "posthog_team"."access_control", + "posthog_team"."week_start_day", + "posthog_team"."inject_web_apps", + "posthog_team"."test_account_filters", + "posthog_team"."test_account_filters_default_checked", + "posthog_team"."path_cleaning_filters", + "posthog_team"."timezone", + "posthog_team"."data_attributes", + "posthog_team"."person_display_name_properties", + "posthog_team"."live_events_columns", + "posthog_team"."recording_domains", + "posthog_team"."primary_dashboard_id", + "posthog_team"."extra_settings", + "posthog_team"."modifiers", + "posthog_team"."correlation_config", + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id", + "posthog_team"."external_data_workspace_last_synced_at" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.20 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.21 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.22 ''' SELECT COUNT(*) AS "__count" FROM "posthog_survey" @@ -254,7 +489,7 @@ AND NOT ("posthog_survey"."type" = 'api')) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.17 +# name: TestSurveysAPIList.test_list_surveys.23 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -286,7 +521,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.18 +# name: TestSurveysAPIList.test_list_surveys.24 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -349,7 +584,7 @@ LIMIT 21 ''' # --- -# name: TestSurveysAPIList.test_list_surveys.19 +# name: TestSurveysAPIList.test_list_surveys.25 ''' SELECT "posthog_survey"."id", "posthog_survey"."team_id", @@ -433,70 +668,7 @@ AND NOT ("posthog_survey"."archived")) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.2 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_id", - "posthog_team"."project_id", - "posthog_team"."api_token", - "posthog_team"."app_urls", - "posthog_team"."name", - "posthog_team"."slack_incoming_webhook", - "posthog_team"."created_at", - "posthog_team"."updated_at", - "posthog_team"."anonymize_ips", - "posthog_team"."completed_snippet_onboarding", - "posthog_team"."has_completed_onboarding_for", - "posthog_team"."ingested_event", - "posthog_team"."autocapture_opt_out", - "posthog_team"."autocapture_web_vitals_opt_in", - "posthog_team"."autocapture_web_vitals_allowed_metrics", - "posthog_team"."autocapture_exceptions_opt_in", - "posthog_team"."autocapture_exceptions_errors_to_ignore", - "posthog_team"."person_processing_opt_out", - "posthog_team"."session_recording_opt_in", - "posthog_team"."session_recording_sample_rate", - "posthog_team"."session_recording_minimum_duration_milliseconds", - "posthog_team"."session_recording_linked_flag", - "posthog_team"."session_recording_network_payload_capture_config", - "posthog_team"."session_recording_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "posthog_team"."session_recording_version", - "posthog_team"."signup_token", - "posthog_team"."is_demo", - "posthog_team"."access_control", - "posthog_team"."week_start_day", - "posthog_team"."inject_web_apps", - "posthog_team"."test_account_filters", - "posthog_team"."test_account_filters_default_checked", - "posthog_team"."path_cleaning_filters", - "posthog_team"."timezone", - "posthog_team"."data_attributes", - "posthog_team"."person_display_name_properties", - "posthog_team"."live_events_columns", - "posthog_team"."recording_domains", - "posthog_team"."primary_dashboard_id", - "posthog_team"."extra_settings", - "posthog_team"."modifiers", - "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days", - "posthog_team"."external_data_workspace_id", - "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.20 +# name: TestSurveysAPIList.test_list_surveys.26 ''' SELECT ("posthog_survey_actions"."survey_id") AS "_prefetch_related_val_survey_id", "posthog_action"."id", @@ -613,6 +785,51 @@ ''' # --- # name: TestSurveysAPIList.test_list_surveys.6 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.7 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestSurveysAPIList.test_list_surveys.8 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -635,81 +852,6 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestSurveysAPIList.test_list_surveys.7 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_id", - "posthog_team"."project_id", - "posthog_team"."api_token", - "posthog_team"."app_urls", - "posthog_team"."name", - "posthog_team"."slack_incoming_webhook", - "posthog_team"."created_at", - "posthog_team"."updated_at", - "posthog_team"."anonymize_ips", - "posthog_team"."completed_snippet_onboarding", - "posthog_team"."has_completed_onboarding_for", - "posthog_team"."ingested_event", - "posthog_team"."autocapture_opt_out", - "posthog_team"."autocapture_web_vitals_opt_in", - "posthog_team"."autocapture_web_vitals_allowed_metrics", - "posthog_team"."autocapture_exceptions_opt_in", - "posthog_team"."autocapture_exceptions_errors_to_ignore", - "posthog_team"."person_processing_opt_out", - "posthog_team"."session_recording_opt_in", - "posthog_team"."session_recording_sample_rate", - "posthog_team"."session_recording_minimum_duration_milliseconds", - "posthog_team"."session_recording_linked_flag", - "posthog_team"."session_recording_network_payload_capture_config", - "posthog_team"."session_recording_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "posthog_team"."session_recording_version", - "posthog_team"."signup_token", - "posthog_team"."is_demo", - "posthog_team"."access_control", - "posthog_team"."week_start_day", - "posthog_team"."inject_web_apps", - "posthog_team"."test_account_filters", - "posthog_team"."test_account_filters_default_checked", - "posthog_team"."path_cleaning_filters", - "posthog_team"."timezone", - "posthog_team"."data_attributes", - "posthog_team"."person_display_name_properties", - "posthog_team"."live_events_columns", - "posthog_team"."recording_domains", - "posthog_team"."primary_dashboard_id", - "posthog_team"."extra_settings", - "posthog_team"."modifiers", - "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days", - "posthog_team"."external_data_workspace_id", - "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestSurveysAPIList.test_list_surveys.8 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- # name: TestSurveysAPIList.test_list_surveys.9 ''' SELECT "posthog_team"."id", @@ -766,13 +908,6 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" diff --git a/posthog/api/test/test_remote_config.py b/posthog/api/test/test_remote_config.py new file mode 100644 index 0000000000000..0dc9c298d07f9 --- /dev/null +++ b/posthog/api/test/test_remote_config.py @@ -0,0 +1,96 @@ +from unittest.mock import patch +from inline_snapshot import snapshot +from rest_framework import status +from django.core.cache import cache + +from posthog.test.base import APIBaseTest, QueryMatchingTest + +# array.js isn't typically built when running tests so we mock it (posthog.models.remote_config.get_array_js_content) + + +class TestRemoteConfig(APIBaseTest, QueryMatchingTest): + def setUp(self): + self.client.logout() + + cache.clear() + + def test_missing_tokens(self): + with self.assertNumQueries(1): + response = self.client.get("/array/missing/config") + assert response.status_code == status.HTTP_404_NOT_FOUND + + with self.assertNumQueries(0): + response = self.client.get("/array/missing/config") + assert response.status_code == status.HTTP_404_NOT_FOUND + + def test_invalid_tokens(self): + response = self.client.get("/array/§$%$&----/config") + assert response.status_code == status.HTTP_400_BAD_REQUEST + assert response.json()["detail"] == "Invalid token" + + def test_valid_config(self): + with self.assertNumQueries(2): + response = self.client.get(f"/array/{self.team.api_token}/config") + + with self.assertNumQueries(0): + response = self.client.get(f"/array/{self.team.api_token}/config") + + assert response.status_code == status.HTTP_200_OK + assert response.headers["Content-Type"] == "application/json" + assert response.json() == snapshot( + { + "token": "token123", + "supportedCompression": ["gzip", "gzip-js"], + "hasFeatureFlags": False, + "captureDeadClicks": False, + "capturePerformance": {"network_timing": True, "web_vitals": False, "web_vitals_allowed_metrics": None}, + "autocapture_opt_out": False, + "autocaptureExceptions": False, + "analytics": {"endpoint": "/i/v0/e/"}, + "elementsChainAsString": True, + "sessionRecording": False, + "surveys": False, + "heatmaps": False, + "defaultIdentifiedOnly": False, + "siteApps": [], + } + ) + + def test_valid_config_js(self): + with self.assertNumQueries(3): + response = self.client.get(f"/array/{self.team.api_token}/config.js") + + with self.assertNumQueries(0): + response = self.client.get(f"/array/{self.team.api_token}/config.js") + + assert response.status_code == status.HTTP_200_OK + assert response.headers["Content-Type"] == "application/javascript" + assert response.content == snapshot( + b'(function() {\n window._POSTHOG_CONFIG = {"token": "token123", "surveys": false, "heatmaps": false, "siteApps": [], "analytics": {"endpoint": "/i/v0/e/"}, "hasFeatureFlags": false, "sessionRecording": false, "captureDeadClicks": false, "capturePerformance": {"web_vitals": false, "network_timing": true, "web_vitals_allowed_metrics": null}, "autocapture_opt_out": false, "supportedCompression": ["gzip", "gzip-js"], "autocaptureExceptions": false, "defaultIdentifiedOnly": false, "elementsChainAsString": true};\n window._POSTHOG_JS_APPS = [];\n})();' + ) + + @patch("posthog.models.remote_config.get_array_js_content", return_value="[MOCKED_ARRAY_JS_CONTENT]") + def test_valid_array_js(self, mock_get_array_js_content): + with self.assertNumQueries(3): + response = self.client.get(f"/array/{self.team.api_token}/array.js") + + with self.assertNumQueries(0): + response = self.client.get(f"/array/{self.team.api_token}/array.js") + assert response.status_code == status.HTTP_200_OK + assert response.headers["Content-Type"] == "application/javascript" + assert response.content + + assert response.content == snapshot( + b'\n [MOCKED_ARRAY_JS_CONTENT]\n\n (function() {\n window._POSTHOG_CONFIG = {"token": "token123", "surveys": false, "heatmaps": false, "siteApps": [], "analytics": {"endpoint": "/i/v0/e/"}, "hasFeatureFlags": false, "sessionRecording": false, "captureDeadClicks": false, "capturePerformance": {"web_vitals": false, "network_timing": true, "web_vitals_allowed_metrics": null}, "autocapture_opt_out": false, "supportedCompression": ["gzip", "gzip-js"], "autocaptureExceptions": false, "defaultIdentifiedOnly": false, "elementsChainAsString": true};\n window._POSTHOG_JS_APPS = [];\n})();\n ' + ) + + # NOT actually testing the content here as it will change dynamically + + @patch("posthog.models.remote_config.get_array_js_content", return_value="[MOCKED_ARRAY_JS_CONTENT]") + def test_valid_array_uses_config_js_cache(self, mock_get_array_js_content): + with self.assertNumQueries(3): + response = self.client.get(f"/array/{self.team.api_token}/config.js") + + with self.assertNumQueries(0): + response = self.client.get(f"/array/{self.team.api_token}/array.js") + assert response.status_code == status.HTTP_200_OK diff --git a/posthog/models/remote_config.py b/posthog/models/remote_config.py index 1bc1141f350c9..f57a3d90a1ddd 100644 --- a/posthog/models/remote_config.py +++ b/posthog/models/remote_config.py @@ -1,6 +1,7 @@ import json import os -from typing import Optional +from typing import Any, Optional +from collections.abc import Callable from django.conf import settings from django.db import models from django.utils import timezone @@ -15,22 +16,31 @@ from posthog.models.team.team import Team from posthog.models.utils import UUIDModel, execute_with_timeout +from django.core.cache import cache from django.db.models.signals import post_save from django.dispatch.dispatcher import receiver +CACHE_TIMEOUT = 60 * 60 * 24 # 1 day - it will be invalidated by the daily sync + + CELERY_TASK_REMOTE_CONFIG_SYNC = Counter( "posthog_remote_config_sync", "Number of times the remote config sync task has been run", labelnames=["result"], ) -logger = structlog.get_logger(__name__) +REMOTE_CONFIG_CACHE_COUNTER = Counter( + "posthog_remote_config_via_cache", + "Metric tracking whether a remote config was fetched from cache or not", + labelnames=["result"], +) -# Load the JS content from the frontend build +logger = structlog.get_logger(__name__) +# Load the JS content from the frontend build _array_js_content: Optional[str] = None @@ -50,6 +60,10 @@ def indent_js(js_content: str, indent: int = 4) -> str: return joined +def cache_key_for_team_token(team_token: str, suffix: str) -> str: + return f"remote_config/{team_token}/{suffix}" + + class RemoteConfig(UUIDModel): """ RemoteConfig is a helper model. There is one per team and stores a highly cacheable JSON object @@ -230,36 +244,70 @@ def build_js_config(self): return js_content - def build_array_js_config(self): - # NOTE: This is the JS that will be loaded by the SDK. - # It includes the dist JS for the frontend and the JSON config + @classmethod + def _get_via_cache(cls, token: str, suffix: str, fn: Callable[["RemoteConfig"], dict | str]) -> Any: + key = cache_key_for_team_token(token, suffix) - js_content = self.build_js_config() + data = cache.get(key) + if data == "404": + REMOTE_CONFIG_CACHE_COUNTER.labels(result="hit_but_missing").inc() + raise cls.DoesNotExist() - js_content = f""" + if data: + REMOTE_CONFIG_CACHE_COUNTER.labels(result="hit").inc() + return data + + REMOTE_CONFIG_CACHE_COUNTER.labels(result="miss").inc() + try: + remote_config = cls.objects.select_related("team").get(team__api_token=token) + except cls.DoesNotExist: + cache.set(key, "404", timeout=CACHE_TIMEOUT) + REMOTE_CONFIG_CACHE_COUNTER.labels(result="miss_but_missing").inc() + raise + + data = fn(remote_config) + cache.set(key, data, timeout=CACHE_TIMEOUT) + + return data + + @classmethod + def get_config_via_token(cls, token: str) -> dict: + return cls._get_via_cache(token, "config", lambda remote_config: remote_config.build_config()) + + @classmethod + def get_config_js_via_token(cls, token: str) -> str: + return cls._get_via_cache(token, "config.js", lambda remote_config: remote_config.build_js_config()) + + @classmethod + @classmethod + def get_array_js_via_token(cls, token: str) -> str: + # NOTE: Unlike the other methods we dont store this in the cache as it is cheap to build at runtime + data = cls.get_config_js_via_token(token) + + return f""" {get_array_js_content()} - {js_content} + {data} """ - return js_content - - def sync(self, force=False): + def sync(self): """ When called we sync to any configured CDNs as well as redis for the /decide endpoint """ logger.info(f"Syncing RemoteConfig for team {self.team_id}") - # TODO: We might still want to invalidate certain caches here due to site apps changing try: config = self.build_config() - # Compare the config to the current one and only update if it has changed - if config == self.config and not force: - logger.info(f"RemoteConfig for team {self.team_id} has not changed. Skipping sync.") - return - self.config = config + + cache.set(cache_key_for_team_token(self.team.api_token, "config"), config, timeout=CACHE_TIMEOUT) + cache.set( + cache_key_for_team_token(self.team.api_token, "config.js"), + self.build_js_config(), + timeout=CACHE_TIMEOUT, + ) + # TODO: Invalidate caches - in particular this will be the Cloudflare CDN cache self.synced_at = timezone.now() self.save() diff --git a/posthog/models/test/test_hog_function.py b/posthog/models/test/test_hog_function.py index 6f659e2ac405f..45f1bb25c680e 100644 --- a/posthog/models/test/test_hog_function.py +++ b/posthog/models/test/test_hog_function.py @@ -275,8 +275,8 @@ def test_hog_functions_reload_on_team_saved(self): {"key": "$pageview", "operator": "regex", "value": "test"}, ] # 1 update team, 1 load hog functions, 1 update hog functions - # 4 unrelated due to RemoteConfig refresh - with self.assertNumQueries(3 + 4): + # 7 unrelated due to RemoteConfig refresh + with self.assertNumQueries(3 + 7): self.team.save() hog_function_1.refresh_from_db() hog_function_2.refresh_from_db() diff --git a/posthog/models/test/test_remote_config.py b/posthog/models/test/test_remote_config.py index 2f6cb299bf9ee..bd314578d3476 100644 --- a/posthog/models/test/test_remote_config.py +++ b/posthog/models/test/test_remote_config.py @@ -1,12 +1,14 @@ from decimal import Decimal +from unittest.mock import patch from inline_snapshot import snapshot +import pytest from posthog.models.feature_flag.feature_flag import FeatureFlag from posthog.models.hog_functions.hog_function import HogFunction, HogFunctionType from posthog.models.plugin import Plugin, PluginConfig, PluginSourceFile from posthog.models.project import Project -from posthog.models.remote_config import RemoteConfig +from posthog.models.remote_config import RemoteConfig, cache_key_for_team_token from posthog.test.base import BaseTest -from django.utils import timezone +from django.core.cache import cache class _RemoteConfigBase(BaseTest): @@ -108,19 +110,13 @@ def test_session_recording_sample_rate(self): assert self.remote_config.config["sessionRecording"]["sampleRate"] == "0.50" -class TestRemoteConfigSync(_RemoteConfigBase): - def test_does_not_sync_if_no_changes(self): - synced_at = self.remote_config.synced_at - - assert synced_at - assert synced_at < timezone.now() - self.remote_config.config["surveys"] = False - self.remote_config.sync() - assert synced_at == self.remote_config.synced_at - - self.remote_config.refresh_from_db() # Ensure the config object is not referentially the same - self.remote_config.sync() - assert synced_at == self.remote_config.synced_at +class TestRemoteConfigCaching(_RemoteConfigBase): + def setUp(self): + super().setUp() + self.remote_config.refresh_from_db() + # Clear the cache so we are properly testing each flow + assert cache.delete(cache_key_for_team_token(self.team.api_token, "config")) + assert cache.delete(cache_key_for_team_token(self.team.api_token, "config.js")) def test_syncs_if_changes(self): synced_at = self.remote_config.synced_at @@ -128,6 +124,49 @@ def test_syncs_if_changes(self): self.remote_config.sync() assert synced_at < self.remote_config.synced_at # type: ignore + def test_persists_data_to_redis_on_sync(self): + self.remote_config.config["surveys"] = True + self.remote_config.sync() + assert cache.get(cache_key_for_team_token(self.team.api_token, "config")) + assert cache.get(cache_key_for_team_token(self.team.api_token, "config.js")) + + def test_gets_via_redis_cache(self): + with self.assertNumQueries(2): + data = RemoteConfig.get_config_via_token(self.team.api_token) + assert data == self.remote_config.config + + with self.assertNumQueries(0): + data = RemoteConfig.get_config_via_token(self.team.api_token) + assert data == self.remote_config.config + + def test_gets_js_via_redis_cache(self): + with self.assertNumQueries(3): + data = RemoteConfig.get_config_js_via_token(self.team.api_token) + + assert data == self.remote_config.build_js_config() + + with self.assertNumQueries(0): + data = RemoteConfig.get_config_js_via_token(self.team.api_token) + + assert data == self.remote_config.build_js_config() + + @patch("posthog.models.remote_config.get_array_js_content", return_value="[MOCKED_ARRAY_JS_CONTENT]") + def test_gets_array_js_via_redis_cache(self, mock_get_array_js_content): + with self.assertNumQueries(3): + RemoteConfig.get_array_js_via_token(self.team.api_token) + + with self.assertNumQueries(0): + RemoteConfig.get_array_js_via_token(self.team.api_token) + + def test_caches_missing_response(self): + with self.assertNumQueries(1): + with pytest.raises(RemoteConfig.DoesNotExist): + RemoteConfig.get_array_js_via_token("missing-token") + + with self.assertNumQueries(0): + with pytest.raises(RemoteConfig.DoesNotExist): + RemoteConfig.get_array_js_via_token("missing-token") + class TestRemoteConfigJS(_RemoteConfigBase): def test_renders_js_including_config(self): diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr index 1630ec4265914..46fad47a49142 100644 --- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr +++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr @@ -86,6 +86,92 @@ ''' # --- # name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.10 + ''' + SELECT "posthog_featureflag"."id", + "posthog_featureflag"."key", + "posthog_featureflag"."name", + "posthog_featureflag"."filters", + "posthog_featureflag"."rollout_percentage", + "posthog_featureflag"."team_id", + "posthog_featureflag"."created_by_id", + "posthog_featureflag"."created_at", + "posthog_featureflag"."deleted", + "posthog_featureflag"."active", + "posthog_featureflag"."rollback_conditions", + "posthog_featureflag"."performed_rollback", + "posthog_featureflag"."ensure_experience_continuity", + "posthog_featureflag"."usage_dashboard_id", + "posthog_featureflag"."has_enriched_analytics" + FROM "posthog_featureflag" + WHERE ("posthog_featureflag"."active" + AND NOT "posthog_featureflag"."deleted" + AND "posthog_featureflag"."team_id" = 99999) + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.11 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_id", + "posthog_team"."project_id", + "posthog_team"."api_token", + "posthog_team"."app_urls", + "posthog_team"."name", + "posthog_team"."slack_incoming_webhook", + "posthog_team"."created_at", + "posthog_team"."updated_at", + "posthog_team"."anonymize_ips", + "posthog_team"."completed_snippet_onboarding", + "posthog_team"."has_completed_onboarding_for", + "posthog_team"."ingested_event", + "posthog_team"."autocapture_opt_out", + "posthog_team"."autocapture_web_vitals_opt_in", + "posthog_team"."autocapture_web_vitals_allowed_metrics", + "posthog_team"."autocapture_exceptions_opt_in", + "posthog_team"."autocapture_exceptions_errors_to_ignore", + "posthog_team"."person_processing_opt_out", + "posthog_team"."session_recording_opt_in", + "posthog_team"."session_recording_sample_rate", + "posthog_team"."session_recording_minimum_duration_milliseconds", + "posthog_team"."session_recording_linked_flag", + "posthog_team"."session_recording_network_payload_capture_config", + "posthog_team"."session_recording_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "posthog_team"."session_recording_version", + "posthog_team"."signup_token", + "posthog_team"."is_demo", + "posthog_team"."access_control", + "posthog_team"."week_start_day", + "posthog_team"."inject_web_apps", + "posthog_team"."test_account_filters", + "posthog_team"."test_account_filters_default_checked", + "posthog_team"."path_cleaning_filters", + "posthog_team"."timezone", + "posthog_team"."data_attributes", + "posthog_team"."person_display_name_properties", + "posthog_team"."live_events_columns", + "posthog_team"."recording_domains", + "posthog_team"."primary_dashboard_id", + "posthog_team"."extra_settings", + "posthog_team"."modifiers", + "posthog_team"."correlation_config", + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id", + "posthog_team"."external_data_workspace_last_synced_at" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.12 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -97,7 +183,7 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.11 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.13 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -167,7 +253,7 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.12 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.14 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -176,7 +262,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.13 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.15 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.16 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.17 ''' SELECT "posthog_organization"."id", "posthog_organization"."name", @@ -202,7 +333,7 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.14 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.18 ''' SELECT "posthog_experiment"."id", "posthog_experiment"."name", @@ -228,7 +359,7 @@ WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.15 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.19 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -298,7 +429,19 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.16 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.2 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.20 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -320,7 +463,7 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.17 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.21 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -353,7 +496,7 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.18 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.22 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -376,7 +519,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.19 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.23 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -439,19 +582,7 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.2 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.20 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.24 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -463,7 +594,7 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.21 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.25 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -533,7 +664,7 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.22 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.26 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -542,7 +673,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.23 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.27 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.28 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.29 ''' SELECT "posthog_organization"."id", "posthog_organization"."name", @@ -568,33 +744,7 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.24 - ''' - SELECT "posthog_experiment"."id", - "posthog_experiment"."name", - "posthog_experiment"."description", - "posthog_experiment"."team_id", - "posthog_experiment"."filters", - "posthog_experiment"."parameters", - "posthog_experiment"."secondary_metrics", - "posthog_experiment"."created_by_id", - "posthog_experiment"."feature_flag_id", - "posthog_experiment"."exposure_cohort_id", - "posthog_experiment"."holdout_id", - "posthog_experiment"."start_date", - "posthog_experiment"."end_date", - "posthog_experiment"."created_at", - "posthog_experiment"."updated_at", - "posthog_experiment"."archived", - "posthog_experiment"."type", - "posthog_experiment"."variants", - "posthog_experiment"."metrics", - "posthog_experiment"."metrics_secondary" - FROM "posthog_experiment" - WHERE "posthog_experiment"."feature_flag_id" = 99999 - ''' -# --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.25 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.3 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -664,79 +814,33 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.26 - ''' - SELECT "posthog_scheduledchange"."id", - "posthog_scheduledchange"."record_id", - "posthog_scheduledchange"."model_name", - "posthog_scheduledchange"."payload", - "posthog_scheduledchange"."scheduled_at", - "posthog_scheduledchange"."executed_at", - "posthog_scheduledchange"."failure_reason", - "posthog_scheduledchange"."team_id", - "posthog_scheduledchange"."created_at", - "posthog_scheduledchange"."created_by_id", - "posthog_scheduledchange"."updated_at" - FROM "posthog_scheduledchange" - WHERE "posthog_scheduledchange"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.27 - ''' - SELECT "posthog_scheduledchange"."id", - "posthog_scheduledchange"."record_id", - "posthog_scheduledchange"."model_name", - "posthog_scheduledchange"."payload", - "posthog_scheduledchange"."scheduled_at", - "posthog_scheduledchange"."executed_at", - "posthog_scheduledchange"."failure_reason", - "posthog_scheduledchange"."team_id", - "posthog_scheduledchange"."created_at", - "posthog_scheduledchange"."created_by_id", - "posthog_scheduledchange"."updated_at" - FROM "posthog_scheduledchange" - WHERE "posthog_scheduledchange"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.28 - ''' - SELECT "posthog_scheduledchange"."id", - "posthog_scheduledchange"."record_id", - "posthog_scheduledchange"."model_name", - "posthog_scheduledchange"."payload", - "posthog_scheduledchange"."scheduled_at", - "posthog_scheduledchange"."executed_at", - "posthog_scheduledchange"."failure_reason", - "posthog_scheduledchange"."team_id", - "posthog_scheduledchange"."created_at", - "posthog_scheduledchange"."created_by_id", - "posthog_scheduledchange"."updated_at" - FROM "posthog_scheduledchange" - WHERE "posthog_scheduledchange"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.29 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.30 ''' - SELECT "posthog_scheduledchange"."id", - "posthog_scheduledchange"."record_id", - "posthog_scheduledchange"."model_name", - "posthog_scheduledchange"."payload", - "posthog_scheduledchange"."scheduled_at", - "posthog_scheduledchange"."executed_at", - "posthog_scheduledchange"."failure_reason", - "posthog_scheduledchange"."team_id", - "posthog_scheduledchange"."created_at", - "posthog_scheduledchange"."created_by_id", - "posthog_scheduledchange"."updated_at" - FROM "posthog_scheduledchange" - WHERE "posthog_scheduledchange"."id" = 99999 - LIMIT 21 + SELECT "posthog_experiment"."id", + "posthog_experiment"."name", + "posthog_experiment"."description", + "posthog_experiment"."team_id", + "posthog_experiment"."filters", + "posthog_experiment"."parameters", + "posthog_experiment"."secondary_metrics", + "posthog_experiment"."created_by_id", + "posthog_experiment"."feature_flag_id", + "posthog_experiment"."exposure_cohort_id", + "posthog_experiment"."holdout_id", + "posthog_experiment"."start_date", + "posthog_experiment"."end_date", + "posthog_experiment"."created_at", + "posthog_experiment"."updated_at", + "posthog_experiment"."archived", + "posthog_experiment"."type", + "posthog_experiment"."variants", + "posthog_experiment"."metrics", + "posthog_experiment"."metrics_secondary" + FROM "posthog_experiment" + WHERE "posthog_experiment"."feature_flag_id" = 99999 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.3 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.31 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -806,29 +910,25 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.30 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.32 ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "posthog_featureflag"."rollback_conditions", - "posthog_featureflag"."performed_rollback", - "posthog_featureflag"."ensure_experience_continuity", - "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" - FROM "posthog_featureflag" - WHERE "posthog_featureflag"."key" = 'flag-1' + SELECT "posthog_scheduledchange"."id", + "posthog_scheduledchange"."record_id", + "posthog_scheduledchange"."model_name", + "posthog_scheduledchange"."payload", + "posthog_scheduledchange"."scheduled_at", + "posthog_scheduledchange"."executed_at", + "posthog_scheduledchange"."failure_reason", + "posthog_scheduledchange"."team_id", + "posthog_scheduledchange"."created_at", + "posthog_scheduledchange"."created_by_id", + "posthog_scheduledchange"."updated_at" + FROM "posthog_scheduledchange" + WHERE "posthog_scheduledchange"."id" = 99999 LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.31 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.33 ''' SELECT "posthog_scheduledchange"."id", "posthog_scheduledchange"."record_id", @@ -846,7 +946,43 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.32 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.34 + ''' + SELECT "posthog_scheduledchange"."id", + "posthog_scheduledchange"."record_id", + "posthog_scheduledchange"."model_name", + "posthog_scheduledchange"."payload", + "posthog_scheduledchange"."scheduled_at", + "posthog_scheduledchange"."executed_at", + "posthog_scheduledchange"."failure_reason", + "posthog_scheduledchange"."team_id", + "posthog_scheduledchange"."created_at", + "posthog_scheduledchange"."created_by_id", + "posthog_scheduledchange"."updated_at" + FROM "posthog_scheduledchange" + WHERE "posthog_scheduledchange"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.35 + ''' + SELECT "posthog_scheduledchange"."id", + "posthog_scheduledchange"."record_id", + "posthog_scheduledchange"."model_name", + "posthog_scheduledchange"."payload", + "posthog_scheduledchange"."scheduled_at", + "posthog_scheduledchange"."executed_at", + "posthog_scheduledchange"."failure_reason", + "posthog_scheduledchange"."team_id", + "posthog_scheduledchange"."created_at", + "posthog_scheduledchange"."created_by_id", + "posthog_scheduledchange"."updated_at" + FROM "posthog_scheduledchange" + WHERE "posthog_scheduledchange"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.36 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -878,6 +1014,51 @@ ''' # --- # name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.5 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.6 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.7 ''' SELECT "posthog_scheduledchange"."id", "posthog_scheduledchange"."record_id", @@ -899,7 +1080,7 @@ UPDATE NOWAIT ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.6 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.8 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -921,7 +1102,7 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.7 +# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.9 ''' SELECT "posthog_user"."id", "posthog_user"."password", @@ -954,89 +1135,3 @@ LIMIT 21 ''' # --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.8 - ''' - SELECT "posthog_featureflag"."id", - "posthog_featureflag"."key", - "posthog_featureflag"."name", - "posthog_featureflag"."filters", - "posthog_featureflag"."rollout_percentage", - "posthog_featureflag"."team_id", - "posthog_featureflag"."created_by_id", - "posthog_featureflag"."created_at", - "posthog_featureflag"."deleted", - "posthog_featureflag"."active", - "posthog_featureflag"."rollback_conditions", - "posthog_featureflag"."performed_rollback", - "posthog_featureflag"."ensure_experience_continuity", - "posthog_featureflag"."usage_dashboard_id", - "posthog_featureflag"."has_enriched_analytics" - FROM "posthog_featureflag" - WHERE ("posthog_featureflag"."active" - AND NOT "posthog_featureflag"."deleted" - AND "posthog_featureflag"."team_id" = 99999) - ''' -# --- -# name: TestProcessScheduledChanges.test_schedule_feature_flag_multiple_changes.9 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_id", - "posthog_team"."project_id", - "posthog_team"."api_token", - "posthog_team"."app_urls", - "posthog_team"."name", - "posthog_team"."slack_incoming_webhook", - "posthog_team"."created_at", - "posthog_team"."updated_at", - "posthog_team"."anonymize_ips", - "posthog_team"."completed_snippet_onboarding", - "posthog_team"."has_completed_onboarding_for", - "posthog_team"."ingested_event", - "posthog_team"."autocapture_opt_out", - "posthog_team"."autocapture_web_vitals_opt_in", - "posthog_team"."autocapture_web_vitals_allowed_metrics", - "posthog_team"."autocapture_exceptions_opt_in", - "posthog_team"."autocapture_exceptions_errors_to_ignore", - "posthog_team"."person_processing_opt_out", - "posthog_team"."session_recording_opt_in", - "posthog_team"."session_recording_sample_rate", - "posthog_team"."session_recording_minimum_duration_milliseconds", - "posthog_team"."session_recording_linked_flag", - "posthog_team"."session_recording_network_payload_capture_config", - "posthog_team"."session_recording_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "posthog_team"."session_recording_version", - "posthog_team"."signup_token", - "posthog_team"."is_demo", - "posthog_team"."access_control", - "posthog_team"."week_start_day", - "posthog_team"."inject_web_apps", - "posthog_team"."test_account_filters", - "posthog_team"."test_account_filters_default_checked", - "posthog_team"."path_cleaning_filters", - "posthog_team"."timezone", - "posthog_team"."data_attributes", - "posthog_team"."person_display_name_properties", - "posthog_team"."live_events_columns", - "posthog_team"."recording_domains", - "posthog_team"."primary_dashboard_id", - "posthog_team"."extra_settings", - "posthog_team"."modifiers", - "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days", - "posthog_team"."external_data_workspace_id", - "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- diff --git a/posthog/test/__snapshots__/test_feature_flag.ambr b/posthog/test/__snapshots__/test_feature_flag.ambr index 92b41f1da9933..d564d0137a391 100644 --- a/posthog/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/test/__snapshots__/test_feature_flag.ambr @@ -217,6 +217,88 @@ ''' # --- # name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.10 + ''' + SELECT "posthog_remoteconfig"."id", + "posthog_remoteconfig"."team_id", + "posthog_remoteconfig"."config", + "posthog_remoteconfig"."updated_at", + "posthog_remoteconfig"."synced_at" + FROM "posthog_remoteconfig" + WHERE "posthog_remoteconfig"."team_id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.11 + ''' + SELECT "posthog_team"."id", + "posthog_team"."uuid", + "posthog_team"."organization_id", + "posthog_team"."project_id", + "posthog_team"."api_token", + "posthog_team"."app_urls", + "posthog_team"."name", + "posthog_team"."slack_incoming_webhook", + "posthog_team"."created_at", + "posthog_team"."updated_at", + "posthog_team"."anonymize_ips", + "posthog_team"."completed_snippet_onboarding", + "posthog_team"."has_completed_onboarding_for", + "posthog_team"."ingested_event", + "posthog_team"."autocapture_opt_out", + "posthog_team"."autocapture_web_vitals_opt_in", + "posthog_team"."autocapture_web_vitals_allowed_metrics", + "posthog_team"."autocapture_exceptions_opt_in", + "posthog_team"."autocapture_exceptions_errors_to_ignore", + "posthog_team"."person_processing_opt_out", + "posthog_team"."session_recording_opt_in", + "posthog_team"."session_recording_sample_rate", + "posthog_team"."session_recording_minimum_duration_milliseconds", + "posthog_team"."session_recording_linked_flag", + "posthog_team"."session_recording_network_payload_capture_config", + "posthog_team"."session_recording_url_trigger_config", + "posthog_team"."session_recording_url_blocklist_config", + "posthog_team"."session_recording_event_trigger_config", + "posthog_team"."session_replay_config", + "posthog_team"."survey_config", + "posthog_team"."capture_console_log_opt_in", + "posthog_team"."capture_performance_opt_in", + "posthog_team"."capture_dead_clicks", + "posthog_team"."surveys_opt_in", + "posthog_team"."heatmaps_opt_in", + "posthog_team"."session_recording_version", + "posthog_team"."signup_token", + "posthog_team"."is_demo", + "posthog_team"."access_control", + "posthog_team"."week_start_day", + "posthog_team"."inject_web_apps", + "posthog_team"."test_account_filters", + "posthog_team"."test_account_filters_default_checked", + "posthog_team"."path_cleaning_filters", + "posthog_team"."timezone", + "posthog_team"."data_attributes", + "posthog_team"."person_display_name_properties", + "posthog_team"."live_events_columns", + "posthog_team"."recording_domains", + "posthog_team"."primary_dashboard_id", + "posthog_team"."extra_settings", + "posthog_team"."modifiers", + "posthog_team"."correlation_config", + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."plugins_opt_in", + "posthog_team"."opt_out_capture", + "posthog_team"."event_names", + "posthog_team"."event_names_with_usage", + "posthog_team"."event_properties", + "posthog_team"."event_properties_with_usage", + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", + "posthog_team"."external_data_workspace_last_synced_at" + FROM "posthog_team" + WHERE "posthog_team"."id" = 99999 + LIMIT 21 + ''' +# --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.12 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -225,7 +307,52 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.11 +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.13 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.14 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.15 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -248,7 +375,7 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.12 +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.16 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -311,7 +438,7 @@ LIMIT 21 ''' # --- -# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.13 +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.17 ''' SELECT "posthog_remoteconfig"."id", "posthog_remoteconfig"."team_id", @@ -323,7 +450,7 @@ LIMIT 21 ''' # --- -# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.14 +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.18 ''' SELECT "posthog_team"."id", "posthog_team"."uuid", @@ -393,7 +520,7 @@ LIMIT 21 ''' # --- -# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.15 +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.19 ''' SELECT COUNT(*) AS "__count" FROM "posthog_featureflag" @@ -402,43 +529,6 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.16 - ''' - SELECT ((("posthog_person"."properties" -> 'Distinct Id') IN ('"307"'::jsonb) - OR ("posthog_person"."properties" -> 'Distinct Id') IN ('307'::jsonb)) - AND "posthog_person"."properties" ? 'Distinct Id' - AND NOT (("posthog_person"."properties" -> 'Distinct Id') = 'null'::jsonb)) AS "flag_X_condition_0" - FROM "posthog_person" - INNER JOIN "posthog_persondistinctid" ON ("posthog_person"."id" = "posthog_persondistinctid"."person_id") - WHERE ("posthog_persondistinctid"."distinct_id" = '307' - AND "posthog_persondistinctid"."team_id" = 99999 - AND "posthog_person"."team_id" = 99999) - ''' -# --- -# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.17 - ''' - SELECT (("posthog_person"."properties" -> 'Distinct Id') IN ('307'::jsonb) - AND "posthog_person"."properties" ? 'Distinct Id' - AND NOT (("posthog_person"."properties" -> 'Distinct Id') = 'null'::jsonb)) AS "flag_X_condition_0" - FROM "posthog_person" - INNER JOIN "posthog_persondistinctid" ON ("posthog_person"."id" = "posthog_persondistinctid"."person_id") - WHERE ("posthog_persondistinctid"."distinct_id" = '307' - AND "posthog_persondistinctid"."team_id" = 99999 - AND "posthog_person"."team_id" = 99999) - ''' -# --- -# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.18 - ''' - SELECT (("posthog_person"."properties" -> 'Distinct Id') = '307'::jsonb - AND "posthog_person"."properties" ? 'Distinct Id' - AND NOT (("posthog_person"."properties" -> 'Distinct Id') = 'null'::jsonb)) AS "flag_X_condition_0" - FROM "posthog_person" - INNER JOIN "posthog_persondistinctid" ON ("posthog_person"."id" = "posthog_persondistinctid"."person_id") - WHERE ("posthog_persondistinctid"."distinct_id" = '307' - AND "posthog_persondistinctid"."team_id" = 99999 - AND "posthog_person"."team_id" = 99999) - ''' -# --- # name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.2 ''' SELECT "posthog_team"."id", @@ -502,6 +592,88 @@ LIMIT 21 ''' # --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.20 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.21 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.22 + ''' + SELECT ((("posthog_person"."properties" -> 'Distinct Id') IN ('"307"'::jsonb) + OR ("posthog_person"."properties" -> 'Distinct Id') IN ('307'::jsonb)) + AND "posthog_person"."properties" ? 'Distinct Id' + AND NOT (("posthog_person"."properties" -> 'Distinct Id') = 'null'::jsonb)) AS "flag_X_condition_0" + FROM "posthog_person" + INNER JOIN "posthog_persondistinctid" ON ("posthog_person"."id" = "posthog_persondistinctid"."person_id") + WHERE ("posthog_persondistinctid"."distinct_id" = '307' + AND "posthog_persondistinctid"."team_id" = 99999 + AND "posthog_person"."team_id" = 99999) + ''' +# --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.23 + ''' + SELECT (("posthog_person"."properties" -> 'Distinct Id') IN ('307'::jsonb) + AND "posthog_person"."properties" ? 'Distinct Id' + AND NOT (("posthog_person"."properties" -> 'Distinct Id') = 'null'::jsonb)) AS "flag_X_condition_0" + FROM "posthog_person" + INNER JOIN "posthog_persondistinctid" ON ("posthog_person"."id" = "posthog_persondistinctid"."person_id") + WHERE ("posthog_persondistinctid"."distinct_id" = '307' + AND "posthog_persondistinctid"."team_id" = 99999 + AND "posthog_person"."team_id" = 99999) + ''' +# --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.24 + ''' + SELECT (("posthog_person"."properties" -> 'Distinct Id') = '307'::jsonb + AND "posthog_person"."properties" ? 'Distinct Id' + AND NOT (("posthog_person"."properties" -> 'Distinct Id') = 'null'::jsonb)) AS "flag_X_condition_0" + FROM "posthog_person" + INNER JOIN "posthog_persondistinctid" ON ("posthog_person"."id" = "posthog_persondistinctid"."person_id") + WHERE ("posthog_persondistinctid"."distinct_id" = '307' + AND "posthog_persondistinctid"."team_id" = 99999 + AND "posthog_person"."team_id" = 99999) + ''' +# --- # name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.3 ''' SELECT "posthog_remoteconfig"."id", @@ -594,6 +766,51 @@ ''' # --- # name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.6 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.7 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.8 ''' SELECT "posthog_featureflag"."id", "posthog_featureflag"."key", @@ -616,81 +833,6 @@ AND "posthog_featureflag"."team_id" = 99999) ''' # --- -# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.7 - ''' - SELECT "posthog_team"."id", - "posthog_team"."uuid", - "posthog_team"."organization_id", - "posthog_team"."project_id", - "posthog_team"."api_token", - "posthog_team"."app_urls", - "posthog_team"."name", - "posthog_team"."slack_incoming_webhook", - "posthog_team"."created_at", - "posthog_team"."updated_at", - "posthog_team"."anonymize_ips", - "posthog_team"."completed_snippet_onboarding", - "posthog_team"."has_completed_onboarding_for", - "posthog_team"."ingested_event", - "posthog_team"."autocapture_opt_out", - "posthog_team"."autocapture_web_vitals_opt_in", - "posthog_team"."autocapture_web_vitals_allowed_metrics", - "posthog_team"."autocapture_exceptions_opt_in", - "posthog_team"."autocapture_exceptions_errors_to_ignore", - "posthog_team"."person_processing_opt_out", - "posthog_team"."session_recording_opt_in", - "posthog_team"."session_recording_sample_rate", - "posthog_team"."session_recording_minimum_duration_milliseconds", - "posthog_team"."session_recording_linked_flag", - "posthog_team"."session_recording_network_payload_capture_config", - "posthog_team"."session_recording_url_trigger_config", - "posthog_team"."session_recording_url_blocklist_config", - "posthog_team"."session_recording_event_trigger_config", - "posthog_team"."session_replay_config", - "posthog_team"."survey_config", - "posthog_team"."capture_console_log_opt_in", - "posthog_team"."capture_performance_opt_in", - "posthog_team"."capture_dead_clicks", - "posthog_team"."surveys_opt_in", - "posthog_team"."heatmaps_opt_in", - "posthog_team"."session_recording_version", - "posthog_team"."signup_token", - "posthog_team"."is_demo", - "posthog_team"."access_control", - "posthog_team"."week_start_day", - "posthog_team"."inject_web_apps", - "posthog_team"."test_account_filters", - "posthog_team"."test_account_filters_default_checked", - "posthog_team"."path_cleaning_filters", - "posthog_team"."timezone", - "posthog_team"."data_attributes", - "posthog_team"."person_display_name_properties", - "posthog_team"."live_events_columns", - "posthog_team"."recording_domains", - "posthog_team"."primary_dashboard_id", - "posthog_team"."extra_settings", - "posthog_team"."modifiers", - "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days", - "posthog_team"."external_data_workspace_id", - "posthog_team"."external_data_workspace_last_synced_at" - FROM "posthog_team" - WHERE "posthog_team"."id" = 99999 - LIMIT 21 - ''' -# --- -# name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.8 - ''' - SELECT "posthog_remoteconfig"."id", - "posthog_remoteconfig"."team_id", - "posthog_remoteconfig"."config", - "posthog_remoteconfig"."updated_at", - "posthog_remoteconfig"."synced_at" - FROM "posthog_remoteconfig" - WHERE "posthog_remoteconfig"."team_id" = 99999 - LIMIT 21 - ''' -# --- # name: TestFeatureFlagMatcher.test_db_matches_independent_of_string_or_number_type.9 ''' SELECT "posthog_team"."id", @@ -747,13 +889,6 @@ "posthog_team"."modifiers", "posthog_team"."correlation_config", "posthog_team"."session_recording_retention_period_days", - "posthog_team"."plugins_opt_in", - "posthog_team"."opt_out_capture", - "posthog_team"."event_names", - "posthog_team"."event_names_with_usage", - "posthog_team"."event_properties", - "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical", "posthog_team"."external_data_workspace_id", "posthog_team"."external_data_workspace_last_synced_at" FROM "posthog_team" @@ -1009,6 +1144,51 @@ ''' # --- # name: TestFeatureFlagMatcher.test_invalid_regex_match_flag.6 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestFeatureFlagMatcher.test_invalid_regex_match_flag.7 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestFeatureFlagMatcher.test_invalid_regex_match_flag.8 ''' SELECT (("posthog_person"."properties" ->> 'email')::text ~ '["neil@x.com"]' AND "posthog_person"."properties" ? 'email' @@ -1020,7 +1200,7 @@ AND "posthog_person"."team_id" = 99999) ''' # --- -# name: TestFeatureFlagMatcher.test_invalid_regex_match_flag.7 +# name: TestFeatureFlagMatcher.test_invalid_regex_match_flag.9 ''' SELECT (("posthog_person"."properties" ->> 'email')::text ~ '["neil@x.com"]' AND "posthog_person"."properties" ? 'email' @@ -1507,6 +1687,51 @@ ''' # --- # name: TestFeatureFlagMatcher.test_with_sql_injection_properties_and_other_aliases.6 + ''' + SELECT "posthog_pluginconfig"."id", + "posthog_pluginsourcefile"."transpiled", + "posthog_pluginconfig"."web_token", + "posthog_plugin"."config_schema", + "posthog_pluginconfig"."config" + FROM "posthog_pluginconfig" + INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id") + INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id") + WHERE ("posthog_pluginconfig"."enabled" + AND "posthog_pluginsourcefile"."filename" = 'site.ts' + AND "posthog_pluginsourcefile"."status" = 'TRANSPILED' + AND "posthog_pluginconfig"."team_id" = 99999) + ''' +# --- +# name: TestFeatureFlagMatcher.test_with_sql_injection_properties_and_other_aliases.7 + ''' + SELECT "posthog_hogfunction"."id", + "posthog_hogfunction"."team_id", + "posthog_hogfunction"."name", + "posthog_hogfunction"."description", + "posthog_hogfunction"."created_at", + "posthog_hogfunction"."created_by_id", + "posthog_hogfunction"."deleted", + "posthog_hogfunction"."updated_at", + "posthog_hogfunction"."enabled", + "posthog_hogfunction"."type", + "posthog_hogfunction"."icon_url", + "posthog_hogfunction"."hog", + "posthog_hogfunction"."bytecode", + "posthog_hogfunction"."transpiled", + "posthog_hogfunction"."inputs_schema", + "posthog_hogfunction"."inputs", + "posthog_hogfunction"."encrypted_inputs", + "posthog_hogfunction"."filters", + "posthog_hogfunction"."masking", + "posthog_hogfunction"."template_id" + FROM "posthog_hogfunction" + WHERE ("posthog_hogfunction"."enabled" + AND "posthog_hogfunction"."team_id" = 99999 + AND "posthog_hogfunction"."type" IN ('site_destination', + 'site_app')) + ''' +# --- +# name: TestFeatureFlagMatcher.test_with_sql_injection_properties_and_other_aliases.8 ''' SELECT "posthog_cohort"."id", "posthog_cohort"."name", @@ -1531,7 +1756,7 @@ AND "posthog_cohort"."team_id" = 99999) ''' # --- -# name: TestFeatureFlagMatcher.test_with_sql_injection_properties_and_other_aliases.7 +# name: TestFeatureFlagMatcher.test_with_sql_injection_properties_and_other_aliases.9 ''' SELECT (((("posthog_person"."properties" -> 'number space') > '"100"'::jsonb AND JSONB_TYPEOF(("posthog_person"."properties" -> 'number space')) = ('string'))