feat(fulfillment): Migration backward compatibility (#6672)

**What**
- Update migration for backward compatibility. This does not take into account data migration and table cleanup (@olivermrbl do we have a general tasks for the modules on that subject)?
- Rename fulfillment provider id to provider id
- add integration tests to ensure the migration backward compatibility
- add new module type for the options to be used in the medusa config for example

FIXES CORE-1724
This commit is contained in:
Adrien de Peretti
2024-03-12 13:53:33 +00:00
committed by GitHub
parent e82b4788ec
commit 87e63c024e
17 changed files with 896 additions and 137 deletions
@@ -2,9 +2,12 @@ import { moduleProviderLoader } from "@medusajs/modules-sdk"
import { LoaderOptions, ModuleProvider, ModulesSdkTypes } from "@medusajs/types"
import { asFunction, asValue, Lifetime } from "awilix"
import { FulfillmentIdentifiersRegistrationName } from "@types"
import { lowerCaseFirst, promiseAll } from "@medusajs/utils"
import {
ContainerRegistrationKeys,
lowerCaseFirst,
promiseAll,
} from "@medusajs/utils"
import { FulfillmentProviderService } from "@services"
import { ContainerRegistrationKeys } from "@medusajs/utils/src"
const registrationFn = async (klass, container, pluginOptions) => {
Object.entries(pluginOptions.config || []).map(([name, config]) => {
@@ -105,6 +108,6 @@ async function syncDatabaseProviders({ container }) {
await promiseAll(promises)
} catch (error) {
logger.error(`Error syncing providers: ${error.message}`)
logger.error(`Error syncing the fulfillment providers: ${error.message}`)
}
}