@@ -318,26 +318,26 @@ function getApiKeyResult(apiKey: string): {
318318 const type = isPublicApiKey ( apiKey )
319319 ? "PUBLIC"
320320 : isSecretApiKey ( apiKey )
321- ? "PRIVATE"
322- : isPublicJWT ( apiKey )
323- ? "PUBLIC_JWT"
324- : "PRIVATE" ; // Fallback to private key
321+ ? "PRIVATE"
322+ : isPublicJWT ( apiKey )
323+ ? "PUBLIC_JWT"
324+ : "PRIVATE" ; // Fallback to private key
325325 return { apiKey, type } ;
326326}
327327
328328export type AuthenticationResult =
329329 | {
330- type : "personalAccessToken" ;
331- result : PersonalAccessTokenAuthenticationResult ;
332- }
330+ type : "personalAccessToken" ;
331+ result : PersonalAccessTokenAuthenticationResult ;
332+ }
333333 | {
334- type : "organizationAccessToken" ;
335- result : OrganizationAccessTokenAuthenticationResult ;
336- }
334+ type : "organizationAccessToken" ;
335+ result : OrganizationAccessTokenAuthenticationResult ;
336+ }
337337 | {
338- type : "apiKey" ;
339- result : ApiAuthenticationResult ;
340- } ;
338+ type : "apiKey" ;
339+ result : ApiAuthenticationResult ;
340+ } ;
341341
342342type AuthenticationMethod = "personalAccessToken" | "organizationAccessToken" | "apiKey" ;
343343
@@ -354,11 +354,11 @@ type FilteredAuthenticationResult<
354354 T extends AllowedAuthenticationMethods = AllowedAuthenticationMethods
355355> =
356356 | ( T [ "personalAccessToken" ] extends true
357- ? Extract < AuthenticationResult , { type : "personalAccessToken" } >
358- : never )
357+ ? Extract < AuthenticationResult , { type : "personalAccessToken" } >
358+ : never )
359359 | ( T [ "organizationAccessToken" ] extends true
360- ? Extract < AuthenticationResult , { type : "organizationAccessToken" } >
361- : never )
360+ ? Extract < AuthenticationResult , { type : "organizationAccessToken" } >
361+ : never )
362362 | ( T [ "apiKey" ] extends true ? Extract < AuthenticationResult , { type : "apiKey" } > : never ) ;
363363
364364/**
@@ -539,10 +539,18 @@ export async function authenticatedEnvironmentForAuthentication(
539539 const environment = await $replica . runtimeEnvironment . findFirst ( {
540540 where : {
541541 projectId : project . id ,
542+ slug : slug ,
542543 type : {
543544 in : [ "PREVIEW" , "DEVELOPMENT" ] ,
544545 } ,
545546 branchName : resolvedBranch ,
547+ ...( slug === "dev"
548+ ? {
549+ orgMember : {
550+ userId : user . id ,
551+ } ,
552+ }
553+ : { } ) ,
546554 archivedAt : null ,
547555 } ,
548556 include : authIncludeWithParent ,
@@ -605,9 +613,9 @@ export async function authenticatedEnvironmentForAuthentication(
605613 const environment = await $replica . runtimeEnvironment . findFirst ( {
606614 where : {
607615 projectId : project . id ,
608- type : {
609- in : [ "PREVIEW" , "DEVELOPMENT" ] ,
610- } ,
616+ slug : slug ,
617+ // No Development branches for OAT
618+ type : "PREVIEW" ,
611619 branchName : resolvedBranch ,
612620 archivedAt : null ,
613621 } ,
0 commit comments