11import type {
2- DelegatedPrincipal ,
32 SessionPrincipal ,
43 WorkspaceApiKeyPrincipal ,
4+ WorkspaceDelegatedPrincipal ,
55} from '@sim/auth/principal'
66import {
77 createPersonalApiKeyPrincipal ,
@@ -317,15 +317,15 @@ describe('defineAuthorizedWorkspaceUseCase', () => {
317317
318318 it ( 'resolves domain-specific delegation options against canonical context' , async ( ) => {
319319 const scopeCheck = vi . fn (
320- ( principal : DelegatedPrincipal , context : TestContext ) =>
320+ ( principal : WorkspaceDelegatedPrincipal , context : TestContext ) =>
321321 principal . resourceScope ?. fileId === context . canonicalResourceId
322322 )
323323 const useCase = defineAuthorizedWorkspaceUseCase ( {
324324 operation : delegatedOperation ,
325- resolveContext : async ( _args : { principal : DelegatedPrincipal ; input : TestInput } ) =>
325+ resolveContext : async ( _args : { principal : WorkspaceDelegatedPrincipal ; input : TestInput } ) =>
326326 canonicalContext ,
327327 authorizationOptions : ( { principal } ) => {
328- expectTypeOf ( principal ) . toMatchTypeOf < DelegatedPrincipal > ( )
328+ expectTypeOf ( principal ) . toMatchTypeOf < WorkspaceDelegatedPrincipal > ( )
329329 expectTypeOf ( principal . serviceId ) . toEqualTypeOf < 'executor' > ( )
330330 return {
331331 delegation : {
@@ -335,12 +335,12 @@ describe('defineAuthorizedWorkspaceUseCase', () => {
335335 }
336336 } ,
337337 async execute ( { principal } ) {
338- expectTypeOf ( principal ) . toMatchTypeOf < DelegatedPrincipal > ( )
338+ expectTypeOf ( principal ) . toMatchTypeOf < WorkspaceDelegatedPrincipal > ( )
339339 expectTypeOf ( principal . serviceId ) . toEqualTypeOf < 'executor' > ( )
340340 return { ok : true as const }
341341 } ,
342342 } )
343- const principal : DelegatedPrincipal = {
343+ const principal : WorkspaceDelegatedPrincipal = {
344344 kind : 'delegated' ,
345345 serviceId : 'executor' ,
346346 subjectUserId : 'user-1' ,
@@ -367,7 +367,8 @@ describe('defineAuthorizedWorkspaceUseCase', () => {
367367
368368 it ( 'rejects a disallowed delegated service before canonical loading' , async ( ) => {
369369 const resolveContext = vi . fn (
370- async ( _args : { principal : DelegatedPrincipal ; input : TestInput } ) => canonicalContext
370+ async ( _args : { principal : WorkspaceDelegatedPrincipal ; input : TestInput } ) =>
371+ canonicalContext
371372 )
372373 const useCase = defineAuthorizedWorkspaceUseCase ( {
373374 operation : delegatedOperation ,
0 commit comments