Files
standardnotes-server/packages/auth/src/Domain/Auth/AuthResponseFactoryResolver.ts
T
Karol Sójko dc71e6777f feat: home-server package initial setup with Api Gateway and Auth services (#605)
* fix(api-gateway): reduce exports

* wip controllers

* fix: imports of controllers

* fix(api-gateway): rename http service interface to proxy interface

* wip: self-registering services and controllers

* wip: add registering controller method bindings and services in container

* feat: merge two services together

* wip: resolving endpoints to direct code calls

* wip: bind controller container to a singleton

* fix: controller binding to instantiate and self-register on controller container

* fix: move signout endpoint to auth controller

* wip: define inversify controllers in the controller container

* fix(auth): bind inversify controllers to controller container

* fix(auth): linter issues

* fix(auth): specs

* fix(auth): inversify controllers bindings

* wip: endpoint resolving

* wip: add endpoint for more auth controllers

* wip: add sessions controller endpoint resolvings

* wip: add subscription invites endpoint resolvings

* wip: add subscription tokens endpoint resolvings

* wip: add all binding for auth server controllers

* wip: fix migrations path

* fix: configure default env vars and ci setup
2023-05-16 11:38:56 +02:00

33 lines
1.5 KiB
TypeScript

import { inject, injectable } from 'inversify'
import { Logger } from 'winston'
import TYPES from '../../Bootstrap/Types'
import { ApiVersion } from '../Api/ApiVersion'
import { AuthResponseFactory20161215 } from './AuthResponseFactory20161215'
import { AuthResponseFactory20190520 } from './AuthResponseFactory20190520'
import { AuthResponseFactory20200115 } from './AuthResponseFactory20200115'
import { AuthResponseFactoryInterface } from './AuthResponseFactoryInterface'
import { AuthResponseFactoryResolverInterface } from './AuthResponseFactoryResolverInterface'
@injectable()
export class AuthResponseFactoryResolver implements AuthResponseFactoryResolverInterface {
constructor(
@inject(TYPES.Auth_AuthResponseFactory20161215) private authResponseFactory20161215: AuthResponseFactory20161215,
@inject(TYPES.Auth_AuthResponseFactory20190520) private authResponseFactory20190520: AuthResponseFactory20190520,
@inject(TYPES.Auth_AuthResponseFactory20200115) private authResponseFactory20200115: AuthResponseFactory20200115,
@inject(TYPES.Auth_Logger) private logger: Logger,
) {}
resolveAuthResponseFactoryVersion(apiVersion: string): AuthResponseFactoryInterface {
this.logger.debug(`Resolving auth response factory for api version: ${apiVersion}`)
switch (apiVersion) {
case ApiVersion.v20190520:
return this.authResponseFactory20190520
case ApiVersion.v20200115:
return this.authResponseFactory20200115
default:
return this.authResponseFactory20161215
}
}
}