zents
Version:
ZenTS is a Node.js & TypeScript MVC-Framework for building rich web applications, released as free and open-source software under the MIT License. It is designed for building web applications with modern tools and design patterns.
26 lines • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SessionStoreAdapterFactory = void 0;
const DatabaseSessionStoreAdapter_1 = require("./stores/DatabaseSessionStoreAdapter");
const RedisSessionStoreAdapter_1 = require("./stores/RedisSessionStoreAdapter");
class SessionStoreAdapterFactory {
constructor(databaseContainer) {
this.databaseContainer = databaseContainer;
}
build(providerOptions) {
let adapter;
switch (providerOptions.storeType) {
case 'redis':
adapter = new RedisSessionStoreAdapter_1.RedisSessionStoreAdapter(this.databaseContainer, providerOptions);
break;
case 'database':
adapter = new DatabaseSessionStoreAdapter_1.DatabaseSessionStoreAdapter(this.databaseContainer, providerOptions);
break;
default:
throw new Error(`Invalid session store "${providerOptions.storeType}"`);
}
return adapter;
}
}
exports.SessionStoreAdapterFactory = SessionStoreAdapterFactory;
//# sourceMappingURL=SessionStoreAdapterFactory.js.map