Ghost/ghost/adapter-manager
Naz d0c45cbe9e
Increased adapter manager test coverage
refs https://github.com/TryGhost/Toolbox/issues/384

- Boyscouting while having the context loaded. Getting to those 100% coverages one day!
2022-09-06 17:51:57 +08:00
..
lib Added adapter caching based on features 2022-09-06 17:51:57 +08:00
test Increased adapter manager test coverage 2022-09-06 17:51:57 +08:00
.eslintrc.js
index.js
package.json
README.md

Adapter Manager

A manager for retrieving custom "adapters" - can be used to abstract away from custom implementations

Usage

const AdapterManager = require('@tryghost/adapter-manager');

const adapterManager = new AdapterManager({
    pathsToAdapters: [
        '/path/to/custom/adapters',
        '/path/to/default/adapters'
    ]
});

class MailAdapterBase {
    someMethod() {}
}

adapterManager.register('mail', MailAdapterBase);

const mailAdapterInstance = adapterManager.getAdapter('mail', 'direct', mailConfig);

mailAdapterInstance.someMethod();