feat: Add support for providers to validate their options at loading time (#8853)

* feat: Add support for providers to validate their options at loading time

* fix missing removal

* fix integration tests

* add tests
This commit is contained in:
Adrien de Peretti
2024-08-29 09:08:49 +02:00
committed by GitHub
parent b8572165cb
commit 77b874f272
11 changed files with 281 additions and 205 deletions
@@ -1,7 +1,7 @@
import {
AuthIdentityProviderService,
AuthenticationInput,
AuthenticationResponse,
AuthIdentityProviderService,
IAuthProvider,
} from "@medusajs/types"
@@ -74,6 +74,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider {
* @ignore
*/
private static DISPLAY_NAME: string
/**
* @ignore
*/
@@ -91,6 +92,12 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider {
return (this.constructor as typeof AbstractAuthModuleProvider).DISPLAY_NAME
}
/**
* Override this static method in order for the loader to validate the options provided to the module provider.
* @param options
*/
static validateOptions(options: Record<any, any>): void | never {}
/**
* @ignore
*