Files
calendar/packages/features/flags/config.ts
T
Eunjae LeeGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
cef8610925 feat: add enabled column to UserFeatures and TeamFeatures for tri-state semantics (#25765)
* feat: add enabled column to UserFeatures and TeamFeatures for tri-state semantics

- Add enabled Boolean column to UserFeatures model with default true
- Add enabled Boolean column to TeamFeatures model with default true
- Update FeaturesRepository to use tri-state semantics:
  - enabled=true: feature is explicitly enabled
  - enabled=false: feature is explicitly disabled (blocks inheritance)
  - No row: inherit from team/org level
- Update SQL queries to check enabled=true for feature access
- Add enableFeatureForTeam method to interface and implementation

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>

* update comments

* add integration tests

* add more test

* select enabled only

* no @default(true)

* fix types and tests

* add missing enabled

* add missing enabled

* rename enableFeatureForTeam to updateFeatureForTeam and support FeatureState

* refactor: rename updateFeatureForTeam to setTeamFeatureState

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>

* fix integration test

* fix tests

* add more tests

* add missing enabled

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-12-18 07:16:20 -03:00

42 lines
1.2 KiB
TypeScript

/**
* Right now we only support boolean flags.
* Maybe later on we can add string variants or numeric ones
**/
export type AppFlags = {
"calendar-cache": boolean;
"calendar-cache-serve": boolean;
emails: boolean;
insights: boolean;
teams: boolean;
webhooks: boolean;
workflows: boolean;
organizations: boolean;
"email-verification": boolean;
"google-workspace-directory": boolean;
"disable-signup": boolean;
attributes: boolean;
"organizer-request-email-v2": boolean;
"delegation-credential": boolean;
"salesforce-crm-tasker": boolean;
"workflow-smtp-emails": boolean;
"cal-video-log-in-overlay": boolean;
"use-api-v2-for-team-slots": boolean;
pbac: boolean;
"restriction-schedule": boolean;
"team-booking-page-cache": boolean;
"cal-ai-voice-agents": boolean;
"tiered-support-chat": boolean;
"calendar-subscription-cache": boolean;
"calendar-subscription-sync": boolean;
"onboarding-v3": boolean;
"booker-botid": boolean;
"booking-calendar-view": boolean;
"booking-email-sms-tasker": boolean;
"bookings-v3": boolean;
"booking-audit": boolean;
};
export type TeamFeatures = Record<keyof AppFlags, boolean>;
export type FeatureState = "enabled" | "disabled" | "inherit";