@@ -422,11 +422,15 @@ const registry: Record<SelectorKey, SelectorDefinition> = {
422422 fetchList : async ( { context } : SelectorQueryArgs ) => {
423423 const credentialId = ensureCredential ( context , 'confluence.spaces' )
424424 const domain = ensureDomain ( context , 'confluence.spaces' )
425- const accessToken = await fetchOAuthToken ( credentialId , context . workflowId )
426- if ( ! accessToken ) throw new Error ( 'Missing Confluence access token' )
427- const data = await fetchJson < { spaces : ConfluenceSpace [ ] } > ( '/api/tools/confluence/spaces' , {
428- searchParams : { domain, accessToken , limit : '250' } ,
425+ const body = JSON . stringify ( {
426+ credential : credentialId ,
427+ workflowId : context . workflowId ,
428+ domain,
429429 } )
430+ const data = await fetchJson < { spaces : ConfluenceSpace [ ] } > (
431+ '/api/tools/confluence/selector-spaces' ,
432+ { method : 'POST' , body }
433+ )
430434 return ( data . spaces || [ ] ) . map ( ( space ) => ( {
431435 id : space . id ,
432436 label : `${ space . name } (${ space . key } )` ,
@@ -436,11 +440,15 @@ const registry: Record<SelectorKey, SelectorDefinition> = {
436440 if ( ! detailId ) return null
437441 const credentialId = ensureCredential ( context , 'confluence.spaces' )
438442 const domain = ensureDomain ( context , 'confluence.spaces' )
439- const accessToken = await fetchOAuthToken ( credentialId , context . workflowId )
440- if ( ! accessToken ) throw new Error ( 'Missing Confluence access token' )
441- const data = await fetchJson < { spaces : ConfluenceSpace [ ] } > ( '/api/tools/confluence/spaces' , {
442- searchParams : { domain, accessToken , limit : '250' } ,
443+ const body = JSON . stringify ( {
444+ credential : credentialId ,
445+ workflowId : context . workflowId ,
446+ domain,
443447 } )
448+ const data = await fetchJson < { spaces : ConfluenceSpace [ ] } > (
449+ '/api/tools/confluence/selector-spaces' ,
450+ { method : 'POST' , body }
451+ )
444452 const space = ( data . spaces || [ ] ) . find ( ( s ) => s . id === detailId ) ?? null
445453 if ( ! space ) return null
446454 return { id : space . id , label : `${ space . name } (${ space . key } )` }
@@ -459,13 +467,14 @@ const registry: Record<SelectorKey, SelectorDefinition> = {
459467 fetchList : async ( { context } : SelectorQueryArgs ) => {
460468 const credentialId = ensureCredential ( context , 'jsm.serviceDesks' )
461469 const domain = ensureDomain ( context , 'jsm.serviceDesks' )
462- const accessToken = await fetchOAuthToken ( credentialId , context . workflowId )
463- if ( ! accessToken ) throw new Error ( 'Missing JSM access token' )
470+ const body = JSON . stringify ( {
471+ credential : credentialId ,
472+ workflowId : context . workflowId ,
473+ domain,
474+ } )
464475 const data = await fetchJson < { serviceDesks : JsmServiceDesk [ ] } > (
465476 '/api/tools/jsm/selector-servicedesks' ,
466- {
467- searchParams : { domain, accessToken } ,
468- }
477+ { method : 'POST' , body }
469478 )
470479 return ( data . serviceDesks || [ ] ) . map ( ( sd ) => ( {
471480 id : sd . id ,
@@ -476,13 +485,14 @@ const registry: Record<SelectorKey, SelectorDefinition> = {
476485 if ( ! detailId ) return null
477486 const credentialId = ensureCredential ( context , 'jsm.serviceDesks' )
478487 const domain = ensureDomain ( context , 'jsm.serviceDesks' )
479- const accessToken = await fetchOAuthToken ( credentialId , context . workflowId )
480- if ( ! accessToken ) throw new Error ( 'Missing JSM access token' )
488+ const body = JSON . stringify ( {
489+ credential : credentialId ,
490+ workflowId : context . workflowId ,
491+ domain,
492+ } )
481493 const data = await fetchJson < { serviceDesks : JsmServiceDesk [ ] } > (
482494 '/api/tools/jsm/selector-servicedesks' ,
483- {
484- searchParams : { domain, accessToken } ,
485- }
495+ { method : 'POST' , body }
486496 )
487497 const sd = ( data . serviceDesks || [ ] ) . find ( ( s ) => s . id === detailId ) ?? null
488498 if ( ! sd ) return null
@@ -505,17 +515,15 @@ const registry: Record<SelectorKey, SelectorDefinition> = {
505515 const credentialId = ensureCredential ( context , 'jsm.requestTypes' )
506516 const domain = ensureDomain ( context , 'jsm.requestTypes' )
507517 if ( ! context . serviceDeskId ) throw new Error ( 'Missing serviceDeskId for jsm.requestTypes' )
508- const accessToken = await fetchOAuthToken ( credentialId , context . workflowId )
509- if ( ! accessToken ) throw new Error ( 'Missing JSM access token' )
518+ const body = JSON . stringify ( {
519+ credential : credentialId ,
520+ workflowId : context . workflowId ,
521+ domain,
522+ serviceDeskId : context . serviceDeskId ,
523+ } )
510524 const data = await fetchJson < { requestTypes : JsmRequestType [ ] } > (
511525 '/api/tools/jsm/selector-requesttypes' ,
512- {
513- searchParams : {
514- domain,
515- accessToken,
516- serviceDeskId : context . serviceDeskId ,
517- } ,
518- }
526+ { method : 'POST' , body }
519527 )
520528 return ( data . requestTypes || [ ] ) . map ( ( rt ) => ( {
521529 id : rt . id ,
@@ -527,17 +535,15 @@ const registry: Record<SelectorKey, SelectorDefinition> = {
527535 const credentialId = ensureCredential ( context , 'jsm.requestTypes' )
528536 const domain = ensureDomain ( context , 'jsm.requestTypes' )
529537 if ( ! context . serviceDeskId ) return null
530- const accessToken = await fetchOAuthToken ( credentialId , context . workflowId )
531- if ( ! accessToken ) throw new Error ( 'Missing JSM access token' )
538+ const body = JSON . stringify ( {
539+ credential : credentialId ,
540+ workflowId : context . workflowId ,
541+ domain,
542+ serviceDeskId : context . serviceDeskId ,
543+ } )
532544 const data = await fetchJson < { requestTypes : JsmRequestType [ ] } > (
533545 '/api/tools/jsm/selector-requesttypes' ,
534- {
535- searchParams : {
536- domain,
537- accessToken,
538- serviceDeskId : context . serviceDeskId ,
539- } ,
540- }
546+ { method : 'POST' , body }
541547 )
542548 const rt = ( data . requestTypes || [ ] ) . find ( ( r ) => r . id === detailId ) ?? null
543549 if ( ! rt ) return null
@@ -585,15 +591,17 @@ const registry: Record<SelectorKey, SelectorDefinition> = {
585591 ] ,
586592 enabled : ( { context } ) => Boolean ( context . credentialId ) ,
587593 fetchList : async ( { context } : SelectorQueryArgs ) => {
594+ const credentialId = ensureCredential ( context , 'microsoft.planner.plans' )
588595 const data = await fetchJson < { plans : PlannerPlan [ ] } > ( '/api/tools/microsoft_planner/plans' , {
589- searchParams : { credentialId : context . credentialId } ,
596+ searchParams : { credentialId } ,
590597 } )
591598 return ( data . plans || [ ] ) . map ( ( plan ) => ( { id : plan . id , label : plan . title } ) )
592599 } ,
593600 fetchById : async ( { context, detailId } : SelectorQueryArgs ) => {
594601 if ( ! detailId ) return null
602+ const credentialId = ensureCredential ( context , 'microsoft.planner.plans' )
595603 const data = await fetchJson < { plans : PlannerPlan [ ] } > ( '/api/tools/microsoft_planner/plans' , {
596- searchParams : { credentialId : context . credentialId } ,
604+ searchParams : { credentialId } ,
597605 } )
598606 const plan = ( data . plans || [ ] ) . find ( ( p ) => p . id === detailId ) ?? null
599607 if ( ! plan ) return null
0 commit comments