chore: Update modules providers configuration with 'identifier' and 'PROVIDER' (#9636)

* chore: Update modules providers configuration with 'identifier' and 'PROVIDER'

* update check

* fix tests

* type

* normalize auth provider

* emailpass

* providers

---------

Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
Adrien de Peretti
2024-10-18 09:24:15 +02:00
committed by GitHub
parent 902ac12f73
commit 876d8072e7
22 changed files with 131 additions and 67 deletions

View File

@@ -19,3 +19,4 @@ export * from "./module-provider"
export * from "./query-context"
export * from "./types/links-config"
export * from "./types/medusa-service"
export * from "./module-provider-registration-key"

View File

@@ -0,0 +1,19 @@
export const moduleProviderRegistrationKeyPrefix = "__providers__"
/**
* Return the key used to register a module provider in the container
* @param {string} moduleKey
* @return {string}
*/
export function getProviderRegistrationKey({
providerId,
providerIdentifier,
}: {
providerId?: string
providerIdentifier?: string
}): string {
const registrationIdentifier = `${
providerIdentifier ? providerIdentifier : ""
}${providerId ? `${providerIdentifier ? "_" : ""}${providerId}` : ""}`
return moduleProviderRegistrationKeyPrefix + registrationIdentifier
}