Closed jnoleau closed 7 years ago
Make generic the strategy attached to a channel.
The idea is to be able to define a function implementing the strategy. A strategy takes all provider in input and return a "new" provider.
channels { sms: { providers: [...] multiProviderStrategy: string /* actual*/ | (SmsProviderInstance[]) => ((req) => Promise<string>) } }
Refactor existing strategies would be easy
fallback : (providers) => // try with the first and recursively try on error round-robin (no-fallback) : (providers) => provider[n]
https://github.com/notifme/notifme-sdk/pull/14
Make generic the strategy attached to a channel.
The idea is to be able to define a function implementing the strategy. A strategy takes all provider in input and return a "new" provider.
Refactor existing strategies would be easy
fallback : (providers) => // try with the first and recursively try on error round-robin (no-fallback) : (providers) => provider[n]