import '@midwayjs/axios';
import '@midwayjs/cache';
import '@midwayjs/core';
import '@midwayjs/cross-domain';
import '@midwayjs/koa';
import '@midwayjs/typeorm';
import '@midwayjs/upload';
import '@midwayjs/validate';

export * from './dist/index';

declare module '@midwayjs/core' {
  interface Context {
    ignoreFormat: boolean;
    request: {
      params: {
        [key: string]: any;
      };
    };
  }
}

declare module 'typeorm' {
  interface DataSourceOptions {
    _name: string;
    _key: string;
  }
}

declare module '@midwayjs/core/dist/interface' {
  interface MidwayConfig {
    magic?: {
      prefix?: string; //magic接口请求前缀
      editorConfigPath?: string; //编辑器js配置路径
      typesPath?: string;
      security?: {
        username: string;
        password: string;
        permission: 'developer' | 'readOnly';
      }[];
      resource?: {
        type: 'database' | 'file' | string;
        location: string;
        tableName: string;
      };
      crud?: {
        logicDeleteColumn: string;
        logicDeleteValue: any;
      };
      swagger?: {
        enabled: boolean;
        title: string;
        description: string;
        version: string;
      };
    };
  }
}
