@@ -10,6 +10,7 @@ export const FEATURE_FLAG = {
1010 hasAiAccess : "hasAiAccess" ,
1111 hasAiModelsAccess : "hasAiModelsAccess" ,
1212 hasComputeAccess : "hasComputeAccess" ,
13+ hasPrivateConnections : "hasPrivateConnections" ,
1314} as const ;
1415
1516const FeatureFlagCatalog = {
@@ -21,6 +22,7 @@ const FeatureFlagCatalog = {
2122 [ FEATURE_FLAG . hasAiAccess ] : z . coerce . boolean ( ) ,
2223 [ FEATURE_FLAG . hasAiModelsAccess ] : z . coerce . boolean ( ) ,
2324 [ FEATURE_FLAG . hasComputeAccess ] : z . coerce . boolean ( ) ,
25+ [ FEATURE_FLAG . hasPrivateConnections ] : z . coerce . boolean ( ) ,
2426} ;
2527
2628type FeatureFlagKey = keyof typeof FeatureFlagCatalog ;
@@ -49,21 +51,23 @@ export function makeFlag(_prisma: PrismaClientOrTransaction = prisma) {
4951
5052 const flagSchema = FeatureFlagCatalog [ opts . key ] ;
5153
52- if ( opts . overrides ?. [ opts . key ] ) {
54+ if ( opts . overrides ?. [ opts . key ] !== undefined ) {
5355 const parsed = flagSchema . safeParse ( opts . overrides [ opts . key ] ) ;
5456
5557 if ( parsed . success ) {
5658 return parsed . data ;
5759 }
5860 }
5961
60- const parsed = flagSchema . safeParse ( value ?. value ) ;
62+ if ( value !== null ) {
63+ const parsed = flagSchema . safeParse ( value . value ) ;
6164
62- if ( ! parsed . success ) {
63- return opts . defaultValue ;
65+ if ( parsed . success ) {
66+ return parsed . data ;
67+ }
6468 }
6569
66- return parsed . data ;
70+ return opts . defaultValue ;
6771 }
6872
6973 return flag ;
0 commit comments