@@ -107,57 +107,6 @@ function matchByUIDandUUID(
107107 return { matched : { ...matched , ...matchedByName } , toCreate, toConfirm, toManualMatch}
108108}
109109
110- function migrateLegacyFunctions (
111- ids : IdentifiersExtensions ,
112- localSources : LocalSource [ ] ,
113- remoteSources : RemoteSource [ ] ,
114- ) : {
115- migrated : IdentifiersExtensions
116- pending : { local : LocalSource [ ] ; remote : RemoteSource [ ] }
117- } {
118- const migrated : IdentifiersExtensions = { }
119- const pendingMigrations : IdentifiersExtensions = { }
120-
121- remoteSources
122- . filter ( ( extension ) => extension . type === 'FUNCTION' )
123- . forEach ( ( functionExtension ) => {
124- const config = functionExtension . draftVersion ?. config
125- if ( config === undefined ) return
126-
127- const parsedConfig = JSON . parse ( config )
128- const legacyId = parsedConfig . legacy_function_id
129- if ( legacyId ) pendingMigrations [ legacyId ] = functionExtension . uuid
130-
131- const legacyUuid = parsedConfig . legacy_function_uuid
132- if ( legacyUuid ) pendingMigrations [ legacyUuid ] = functionExtension . uuid
133- } )
134-
135- localSources
136- . filter ( ( extension ) => extension . type === 'function' )
137- . forEach ( ( functionExtension ) => {
138- const localId = ids [ functionExtension . localIdentifier ]
139- if ( localId === undefined ) return
140-
141- const remoteId = pendingMigrations [ localId ]
142- if ( remoteId ) {
143- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
144- delete pendingMigrations [ functionExtension . localIdentifier ]
145- migrated [ functionExtension . localIdentifier ] = remoteId
146- }
147- } )
148-
149- const pendingLocal = localSources . filter ( ( elem ) => ! migrated [ elem . localIdentifier ] )
150- const pendingRemote = remoteSources . filter ( ( registration ) => ! Object . values ( migrated ) . includes ( registration . uuid ) )
151-
152- return {
153- migrated,
154- pending : {
155- local : pendingLocal ,
156- remote : pendingRemote ,
157- } ,
158- }
159- }
160-
161110/**
162111 * Ask the user to confirm the relationship between a local source and a remote source if they
163112 * the only ones of their types.
@@ -235,19 +184,15 @@ export async function automaticMatchmaking(
235184 return ids [ local . localIdentifier ] === remote . uuid
236185 } )
237186
238- const { migrated : migratedFunctions , pending : pendingAfterMigratingFunctions } = migrateLegacyFunctions (
239- ids ,
240- localSources . filter ( ( local ) => ! existsRemotely ( local ) ) ,
241- remoteSources . filter ( ( remote ) => ! localIds . includes ( remote . uuid ) ) ,
242- )
243- const { local, remote} = pendingAfterMigratingFunctions
187+ const local = localSources . filter ( ( local ) => ! existsRemotely ( local ) )
188+ const remote = remoteSources . filter ( ( remote ) => ! localIds . includes ( remote . uuid ) )
244189
245190 const { matched, toCreate, toConfirm, toManualMatch} = useUuidMatching
246191 ? matchByUIDandUUID ( localSources , remoteSources , ids )
247192 : matchByNameAndType ( local , remote )
248193
249194 return {
250- identifiers : { ...ids , ...matched , ... migratedFunctions } ,
195+ identifiers : { ...ids , ...matched } ,
251196 toConfirm,
252197 toCreate,
253198 toManualMatch,
0 commit comments