@@ -107,35 +107,12 @@ export function createApi(client) {
107107}
108108
109109// ---------------------------------------------------------------------------
110- // Response-shape helpers
110+ // Response-shape helpers — canonical implementations live in lib/TaskExecution.js
111111// ---------------------------------------------------------------------------
112112
113- export function getProcessDefinitionKey ( deployResponse , processId ) {
114- const items = deployResponse && ( deployResponse . deployments || deployResponse . processes || [ ] ) ;
115- for ( const item of items ) {
116- const def = item . processDefinition || item ;
117- if ( def . processDefinitionId === processId ) {
118- return def . processDefinitionKey ;
119- }
120- }
121- return null ;
122- }
123-
124- export function getProcessInstanceKey ( startResponse ) {
125- if ( ! startResponse ) return null ;
126- return String (
127- startResponse . processInstanceKey ||
128- ( startResponse . items && startResponse . items [ 0 ] && startResponse . items [ 0 ] . processInstanceKey ) ||
129- ''
130- ) || null ;
131- }
132-
133- export function getProcessInstanceState ( piResult ) {
134- const items = piResult && piResult . response && piResult . response . items ;
135- return items && items [ 0 ] && items [ 0 ] . state ;
136- }
137-
138- export function hasProcessInstanceIncident ( piResult ) {
139- const items = piResult && piResult . response && piResult . response . items ;
140- return ! ! ( items && items [ 0 ] && items [ 0 ] . hasIncident ) ;
141- }
113+ export {
114+ getProcessDefinitionKey ,
115+ getProcessInstanceKey ,
116+ getProcessInstanceState ,
117+ hasProcessInstanceIncident
118+ } from '../lib/TaskExecution.js' ;
0 commit comments