@@ -53,33 +53,6 @@ export const SUBBLOCK_ID_MIGRATIONS: Record<string, Record<string, string>> = {
5353 } ,
5454}
5555
56- /**
57- * Maps old Rippling operation values to their current equivalents.
58- *
59- * When the integration was expanded from 16 to 86 tools, several
60- * operations were renamed or removed. Saved workflows still carry
61- * the old operation value. Without this mapping the tool selector
62- * returns an unregistered tool ID, causing a runtime error.
63- */
64- export const OPERATION_VALUE_MIGRATIONS : Record < string , Record < string , string > > = {
65- rippling : {
66- list_employees : 'list_workers' ,
67- get_employee : 'get_worker' ,
68- list_employees_with_terminated : 'list_workers' ,
69- get_company : 'list_companies' ,
70- get_company_activity : '_removed_get_company_activity' ,
71- list_levels : '_removed_list_levels' ,
72- list_leave_requests : '_removed_list_leave_requests' ,
73- process_leave_request : '_removed_process_leave_request' ,
74- list_leave_balances : '_removed_list_leave_balances' ,
75- get_leave_balance : '_removed_get_leave_balance' ,
76- list_leave_types : '_removed_list_leave_types' ,
77- create_group : '_removed_create_group' ,
78- update_group : '_removed_update_group' ,
79- push_candidate : '_removed_push_candidate' ,
80- } ,
81- }
82-
8356/**
8457 * Migrates legacy subblock IDs inside a single block's subBlocks map.
8558 * Returns a new subBlocks record if anything changed, or the original if not.
@@ -130,43 +103,22 @@ export function migrateSubblockIds(blocks: Record<string, BlockState>): {
130103
131104 for ( const [ blockId , block ] of Object . entries ( blocks ) ) {
132105 const renames = SUBBLOCK_ID_MIGRATIONS [ block . type ]
133- const opMigrations = OPERATION_VALUE_MIGRATIONS [ block . type ]
134- let currentBlock = block
135-
136- if ( renames && block . subBlocks ) {
137- const { subBlocks, migrated } = migrateBlockSubblockIds ( block . subBlocks , renames )
138- if ( migrated ) {
139- logger . info ( 'Migrated legacy subblock IDs' , {
140- blockId : block . id ,
141- blockType : block . type ,
142- } )
143- anyMigrated = true
144- currentBlock = { ...currentBlock , subBlocks }
145- }
106+ if ( ! renames || ! block . subBlocks ) {
107+ result [ blockId ] = block
108+ continue
146109 }
147110
148- if ( opMigrations && currentBlock . subBlocks ?. operation ) {
149- const oldOp = String ( currentBlock . subBlocks . operation . value ?? '' )
150- const newOp = opMigrations [ oldOp ]
151- if ( newOp ) {
152- logger . info ( 'Migrated legacy operation value' , {
153- blockId : currentBlock . id ,
154- blockType : currentBlock . type ,
155- from : oldOp ,
156- to : newOp ,
157- } )
158- anyMigrated = true
159- currentBlock = {
160- ...currentBlock ,
161- subBlocks : {
162- ...currentBlock . subBlocks ,
163- operation : { ...currentBlock . subBlocks . operation , value : newOp } ,
164- } ,
165- }
166- }
111+ const { subBlocks, migrated } = migrateBlockSubblockIds ( block . subBlocks , renames )
112+ if ( migrated ) {
113+ logger . info ( 'Migrated legacy subblock IDs' , {
114+ blockId : block . id ,
115+ blockType : block . type ,
116+ } )
117+ anyMigrated = true
118+ result [ blockId ] = { ...block , subBlocks }
119+ } else {
120+ result [ blockId ] = block
167121 }
168-
169- result [ blockId ] = currentBlock
170122 }
171123
172124 return { blocks : result , migrated : anyMigrated }
0 commit comments