Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { provide, async, config, logger, scope, ScopeEnum } from 'midway-web';
import { BaseDataSource } from './base';
@scope(ScopeEnum.Singleton)
@async()
@provide('coreDB')
export class CoreDBDataSource extends BaseDataSource {
@config('coreDB')
config;
@logger('coreDBLogger')
logger;
name: string = 'coreDB';
}
import { provide, async, config, logger, scope, ScopeEnum } from 'midway-web';
import { BaseDataSource } from './base';
@scope(ScopeEnum.Singleton)
@async()
@provide('dw')
export class DWDataSource extends BaseDataSource {
@config('dw')
config;
@logger('dwLogger')
logger;
name: string = 'dw';
}
import { provide, inject, IApplicationContext, providerWrapper, scope, ScopeEnum } from 'midway-web';
import {IPlatformManagerAdapter} from '../../interface/adapter/IPlatformManagerAdapter';
import {IPlatformAdapter} from '../../interface/adapter/IPlatformAdapter';
@scope(ScopeEnum.Singleton)
@provide('platformManagerAdapter')
export class PlatformManagerAdapter implements IPlatformManagerAdapter {
@inject()
protected platformAdapterDispatcher;
async get(name: string): Promise {
return this.platformAdapterDispatcher(name);
}
}
export function platformAdapterDispatcher(context: IApplicationContext) {
return async (adapterName: string) => {
try {
return await context.getAsync(adapterName + 'PlatformAdapter');