@@ -9,6 +9,7 @@ export const FEATURE_FLAG = {
99 hasLogsPageAccess : "hasLogsPageAccess" ,
1010 hasAiAccess : "hasAiAccess" ,
1111 hasAiModelsAccess : "hasAiModelsAccess" ,
12+ hasPrivateConnections : "hasPrivateConnections" ,
1213} as const ;
1314
1415const FeatureFlagCatalog = {
@@ -19,6 +20,7 @@ const FeatureFlagCatalog = {
1920 [ FEATURE_FLAG . hasLogsPageAccess ] : z . coerce . boolean ( ) ,
2021 [ FEATURE_FLAG . hasAiAccess ] : z . coerce . boolean ( ) ,
2122 [ FEATURE_FLAG . hasAiModelsAccess ] : z . coerce . boolean ( ) ,
23+ [ FEATURE_FLAG . hasPrivateConnections ] : z . coerce . boolean ( ) ,
2224} ;
2325
2426type FeatureFlagKey = keyof typeof FeatureFlagCatalog ;
@@ -47,21 +49,23 @@ export function makeFlag(_prisma: PrismaClientOrTransaction = prisma) {
4749
4850 const flagSchema = FeatureFlagCatalog [ opts . key ] ;
4951
50- if ( opts . overrides ?. [ opts . key ] ) {
52+ if ( opts . overrides ?. [ opts . key ] !== undefined ) {
5153 const parsed = flagSchema . safeParse ( opts . overrides [ opts . key ] ) ;
5254
5355 if ( parsed . success ) {
5456 return parsed . data ;
5557 }
5658 }
5759
58- const parsed = flagSchema . safeParse ( value ?. value ) ;
60+ if ( value !== null ) {
61+ const parsed = flagSchema . safeParse ( value . value ) ;
5962
60- if ( ! parsed . success ) {
61- return opts . defaultValue ;
63+ if ( parsed . success ) {
64+ return parsed . data ;
65+ }
6266 }
6367
64- return parsed . data ;
68+ return opts . defaultValue ;
6569 }
6670
6771 return flag ;
0 commit comments