Options
All
  • Public
  • Public/Protected
  • All
Menu

Midway Api Reference

Index

Modules

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

Locale

Locale: string

ObjectIdentifier

ObjectIdentifier: string

Scope

Scope: "Singleton" | "Request" | "Prototype"

callback

callback: function

Type declaration

    • (node: Element): Promise<void>
    • Parameters

      • node: Element

      Returns Promise<void>

callbackSync

callbackSync: function

Type declaration

    • (node: Element): void
    • Parameters

      • node: Element

      Returns void

Variables

Const AGENT_NAME

AGENT_NAME: "agent" = "agent"

Const AMBIGUOUS_MATCH

AMBIGUOUS_MATCH: "Ambiguous match found for serviceIdentifier:" = "Ambiguous match found for serviceIdentifier:"

Const APP_NAME

APP_NAME: "app" = "app"

Const ARGUMENTS_LENGTH_MISMATCH_1

ARGUMENTS_LENGTH_MISMATCH_1: "The number of constructor arguments in the derived class " = "The number of constructor arguments in the derived class "

Const ARGUMENTS_LENGTH_MISMATCH_2

ARGUMENTS_LENGTH_MISMATCH_2: " must be >= than the number of constructor arguments of its base class." = " must be >= than the number of constructor arguments of its base class."

Const ARGUMENT_NAMES

ARGUMENT_NAMES: RegExp = /([^\s,]+)/g

Const CANNOT_UNBIND

CANNOT_UNBIND: "Could not unbind serviceIdentifier:" = "Could not unbind serviceIdentifier:"

Const CIRCULAR_DEPENDENCY

CIRCULAR_DEPENDENCY: "Circular dependency found:" = "Circular dependency found:"

Const CLASS_KEY_CONSTRUCTOR

CLASS_KEY_CONSTRUCTOR: "midway:class_key_constructor" = "midway:class_key_constructor"

Const CONFIG_KEY_CLZ

CONFIG_KEY_CLZ: "midway:config_key_class" = "midway:config_key_class"

Const CONFIG_KEY_PROP

CONFIG_KEY_PROP: "midway:config_key_props" = "midway:config_key_props"

Const CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE

CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE: string = 'Invalid Container option. Auto bind injectable must ' +'be a boolean'

Const CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE

CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE: string = 'Invalid Container option. Default scope must ' +'be a string (\'singleton\' or \'transient\').'

Const CONTAINER_OPTIONS_MUST_BE_AN_OBJECT

CONTAINER_OPTIONS_MUST_BE_AN_OBJECT: string = 'Invalid Container constructor argument. Container options ' +'must be an object.'

Const CONTROLLERS

CONTROLLERS: "controllers" = "controllers"

Const DUPLICATED_INJECTABLE_DECORATOR

DUPLICATED_INJECTABLE_DECORATOR: "Cannot apply @injectable decorator multiple times." = "Cannot apply @injectable decorator multiple times."

Const DUPLICATED_METADATA

DUPLICATED_METADATA: "Metadata key was used more than once in a parameter:" = "Metadata key was used more than once in a parameter:"

Const EggLoader

EggLoader: any = require('egg-core').EggLoader

Const FUNCTION_INJECT_KEY

FUNCTION_INJECT_KEY: "midway:function_inject_key" = "midway:function_inject_key"

Const INJECT_TAG

INJECT_TAG: "inject" = "inject"

Const INVALID_BINDING_TYPE

INVALID_BINDING_TYPE: "Invalid binding type:" = "Invalid binding type:"

Const INVALID_DECORATOR_OPERATION

INVALID_DECORATOR_OPERATION: string = 'The @inject @multiInject @tagged and @named decorators ' +'must be applied to the parameters of a class constructor or a class property.'

Const INVALID_FUNCTION_BINDING

INVALID_FUNCTION_BINDING: "Value provided to function binding must be a function!" = "Value provided to function binding must be a function!"

Const INVALID_MIDDLEWARE_RETURN

INVALID_MIDDLEWARE_RETURN: "Invalid return type in middleware. Middleware must return!" = "Invalid return type in middleware. Middleware must return!"

Const INVALID_TO_SELF_VALUE

INVALID_TO_SELF_VALUE: string = 'The toSelf function can only be applied when a constructor is ' +'used as service identifier'

Const KEY_NOT_FOUND

KEY_NOT_FOUND: "Key Not Found" = "Key Not Found"

Const KoaRouter

KoaRouter: any = require('egg-core/lib/utils/router')

基于 koa-router 实现 Midway 的路由扩展

Const LOGGER_KEY_CLZ

LOGGER_KEY_CLZ: "midway:logger_key_class" = "midway:logger_key_class"

Const LOGGER_KEY_PROP

LOGGER_KEY_PROP: "midway:logger_key_props" = "midway:logger_key_props"

Const METHOD_METADATA

METHOD_METADATA: "METHOD_METADATA" = "METHOD_METADATA"

Const MIDDLEWARES

MIDDLEWARES: "middlewares" = "middlewares"

Const MIDWAY_PATH

MIDWAY_PATH: string = path.dirname(__dirname)

Const MISSING_INJECTABLE_ANNOTATION

MISSING_INJECTABLE_ANNOTATION: "Missing required @injectable annotation in:" = "Missing required @injectable annotation in:"

Const MISSING_INJECT_ANNOTATION

MISSING_INJECT_ANNOTATION: "Missing required @inject or @multiInject annotation in:" = "Missing required @inject or @multiInject annotation in:"

Const MULTIPLE_POST_CONSTRUCT_METHODS

MULTIPLE_POST_CONSTRUCT_METHODS: "Cannot apply @postConstruct decorator multiple times in the same class" = "Cannot apply @postConstruct decorator multiple times in the same class"

Const Master

Master: any = require('../cluster/master')

Const NAMED_TAG

NAMED_TAG: "named" = "named"

Const NOT_IMPLEMENTED

NOT_IMPLEMENTED: "Sorry, this feature is not fully implemented yet." = "Sorry, this feature is not fully implemented yet."

Const NOT_REGISTERED

NOT_REGISTERED: "No matching bindings found for serviceIdentifier:" = "No matching bindings found for serviceIdentifier:"

Const NO_MORE_SNAPSHOTS_AVAILABLE

NO_MORE_SNAPSHOTS_AVAILABLE: "No snapshot available to restore." = "No snapshot available to restore."

Const NULL_ARGUMENT

NULL_ARGUMENT: "NULL argument" = "NULL argument"

Const OBJ_DEF_CLS

OBJ_DEF_CLS: "object_definition_class" = "object_definition_class"

Const PATH_METADATA

PATH_METADATA: "PATH_METADATA" = "PATH_METADATA"

Const PLUGIN_KEY_CLZ

PLUGIN_KEY_CLZ: "midway:plugin_key_class" = "midway:plugin_key_class"

Const PLUGIN_KEY_PROP

PLUGIN_KEY_PROP: "midway:plugin_key_props" = "midway:plugin_key_props"

Const PREFIX

PREFIX: "_id_default_" = "_id_default_"

Const RELEASE

RELEASE: "VISION" = "VISION"

current release name

member

{String} Midway#RELEASE

Const ROUTER_NAME_METADATA

ROUTER_NAME_METADATA: "ROUTER_NAME_METADATA" = "ROUTER_NAME_METADATA"

Const SCHEDULE_CLASS

SCHEDULE_CLASS: "midway:schedule_class" = "midway:schedule_class"

for @schedule

Const STACK_OVERFLOW

STACK_OVERFLOW: "Maximum call stack size exceeded" = "Maximum call stack size exceeded"

Const STRIP_COMMENTS

STRIP_COMMENTS: RegExp = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg

Const TAGGED

TAGGED: "midway:tagged" = "midway:tagged"

Const TAGGED_CLS

TAGGED_CLS: "midway:tagged_class" = "midway:tagged_class"

Const TAGGED_FUN

TAGGED_FUN: "midway:tagged_function" = "midway:tagged_function"

Const TAGGED_PROP

TAGGED_PROP: "midway:tagged_props" = "midway:tagged_props"

Const TS_SRC_DIR

TS_SRC_DIR: "src" = "src"

Const TS_TARGET_DIR

TS_TARGET_DIR: "dist" = "dist"

Const TYPE_LOGGER

TYPE_LOGGER: "logger" = "logger"

Const TYPE_PLUGIN

TYPE_PLUGIN: "plugin" = "plugin"

Const VERSION

VERSION: any = require('../package.json').version

current version of midway

member

{String} Midway#VERSION

Const WEB_ROUTER_CLS

WEB_ROUTER_CLS: "midway:web_router_class" = "midway:web_router_class"

for @get/@post ...

Const WEB_ROUTER_PREFIX_CLS

WEB_ROUTER_PREFIX_CLS: "midway:web_router_prefix_class" = "midway:web_router_prefix_class"

for @controller

Const WEB_ROUTER_PRIORITY

WEB_ROUTER_PRIORITY: "midway:web_router_priority" = "midway:web_router_priority"

for @priority

Const WEB_ROUTER_PROP

WEB_ROUTER_PROP: "midway:web_router_props" = "midway:web_router_props"

Const all

all: (Anonymous function) = createMappingDecorator(RequestMethod.ALL)

Routes all HTTP requests to the specified path. Routes all HTTP requests to the specified path.

Const assert

assert: any = require('assert')

Const camelCase

camelCase: any = require('camelcase')

Const camelcase

camelcase: any = require('camelcase')

Const debug

debug: any = require('debug')('midway:loading')

! Midway Loading 文件加载 ! Midway Loading 文件加载

Const del

del: (Anonymous function) = createMappingDecorator(RequestMethod.DELETE)

Routes HTTP DELETE requests to the specified path. Routes HTTP DELETE requests to the specified path.

Const extend

extend: any = require('extend2')

Const functionPrototype

functionPrototype: any = Object.getPrototypeOf(Function)

Const get

get: (Anonymous function) = createMappingDecorator(RequestMethod.GET)

Routes HTTP GET requests to the specified path. Routes HTTP GET requests to the specified path.

Const globby

globby: any = require('globby')

Const graphviz

graphviz: any = require('graphviz')

Const head

head: (Anonymous function) = createMappingDecorator(RequestMethod.HEAD)

Routes HTTP HEAD requests to the specified path. Routes HTTP HEAD requests to the specified path.

Const is

is: any = require('is-type-of')

Const mm2

mm2: MidwayMock = Object.assign({}, mock, {container: mockContainer})

Const mock

mock: any = require('egg-mock')

Const options

options: (Anonymous function) = createMappingDecorator(RequestMethod.OPTIONS)

Routes HTTP OPTIONS requests to the specified path. Routes HTTP OPTIONS requests to the specified path.

Const patch

patch: (Anonymous function) = createMappingDecorator(RequestMethod.PATCH)

Routes HTTP PATCH requests to the specified path. Routes HTTP PATCH requests to the specified path.

Const path

path: any = require('path')

Const post

post: (Anonymous function) = createMappingDecorator(RequestMethod.POST)

Routes HTTP POST requests to the specified path. Routes HTTP POST requests to the specified path.

Const put

put: (Anonymous function) = createMappingDecorator(RequestMethod.PUT)

Routes HTTP PUT requests to the specified path. Routes HTTP PUT requests to the specified path.

Const uuidv1

uuidv1: any = require('uuid/v1')

Functions

Const CIRCULAR_DEPENDENCY_IN_FACTORY

  • CIRCULAR_DEPENDENCY_IN_FACTORY(...values: any[]): string

Const POST_CONSTRUCT_ERROR

  • POST_CONSTRUCT_ERROR(...values: any[]): string

Const RequestMapping

_tagParameterOrProperty

  • _tagParameterOrProperty(metadataKey: string, annotationTarget: any, propertyName: string, metadata: TagPropsMetadata, parameterIndex?: number): void

async

  • async(): (Anonymous function)

attachConstructorDataOnClass

  • attachConstructorDataOnClass(identifier: any, clz: any, type: any, index: any): void

attachMetaDataOnClass

  • attachMetaDataOnClass(clz: any, key: any, value: any): void

attachObjectDefProps

  • attachObjectDefProps(target: any, options: any): any

autowire

  • autowire(isAutowire?: boolean): (Anonymous function)

config

  • config(identifier?: string): (Anonymous function)

controller

  • controller(routerPrefix: string): (Anonymous function)

Const createMappingDecorator

  • createMappingDecorator(method: string): (Anonymous function)

destroy

  • destroy(): (Anonymous function)

eachSubElement

  • eachSubElement(ele: Element, callback: any): Promise<void>

eachSubElementSync

  • eachSubElementSync(ele: Element, callbackSync: any): void

firstCDATAText

  • firstCDATAText(ele: Element): string

firstSubElement

  • firstSubElement(ele: Element): Element

getMethodNames

  • getMethodNames(obj: any): string[]
  • Find methods on a given object

    Parameters

    • obj: any

      object to enumerate on

    Returns string[]

    • method names

getParamNames

  • getParamNames(func: any): any

init

  • init(): (Anonymous function)

initOrGetObjectDefProps

inject

isPluginName

  • isPluginName(name: any): boolean

isTypeScriptEnvironment

  • isTypeScriptEnvironment(): boolean

loading

  • loading(files: any, options: any): any[]

logger

  • logger(identifier?: string): (Anonymous function)

mockContainer

nodeAttr

  • nodeAttr(ele: Element, name: string): string

nodeHasAttr

  • nodeHasAttr(ele: Element, name: string): boolean

nodeName

  • nodeName(ele: Element): string

nodeNameEq

  • nodeNameEq(ele: Element, desiredName: string): boolean

nodeText

  • nodeText(ele: Element): string

ordinaryGetPrototypeOf

  • ordinaryGetPrototypeOf(O: any): any

plugin

  • plugin(identifier?: string): (Anonymous function)

priority

  • priority(priority: number): (Anonymous function)

provide

providerWrapper

  • providerWrapper(wrapperInfo: Array<object>): void

recursiveGetMetadata

  • recursiveGetMetadata(metadataKey: any, target: any, propertyKey?: string | symbol): ReflectResult[]
  • get metadata value of a metadata key on the prototype chain of an object and property

    Parameters

    • metadataKey: any

      metadata's key

    • target: any

      the target of metadataKey

    • Optional propertyKey: string | symbol

    Returns ReflectResult[]

recursiveGetPrototypeOf

  • recursiveGetPrototypeOf(target: any): any[]
  • 以数组形式返回对象所有 property, 数组第一个元素是距离 o 最近的原型

    Parameters

    • target: any

      对象,class 或者 function

    Returns any[]

route

  • route(method: string, pattern: string): (Anonymous function)

schedule

  • schedule(scheduleOpts: SchedueOpts | string): (Anonymous function)

scope

  • scope(scope?: Scope): (Anonymous function)

startCluster

  • startCluster(options: any, callback: any): void

tagParameter

  • tagParameter(annotationTarget: any, propertyName: string, parameterIndex: number, metadata: TagPropsMetadata): void

tagProperty

  • tagProperty(annotationTarget: any, propertyName: string, metadata: TagPropsMetadata): void

tpl

  • tpl(s: string, props: any): string

Object literals

Const ContextEvent

ContextEvent: object

ONREFRESH

ONREFRESH: string = "onRefresh"

READY

READY: string = "onReady"

START

START: string = "start"

STOP

STOP: string = "stop"

Const KEYS

KEYS: object

静态参数

AROUND_ELEMENT

AROUND_ELEMENT: string = "around"

ASPECT_ELEMENT

ASPECT_ELEMENT: string = "aspect"

ASYNC_ATTRIBUTE

ASYNC_ATTRIBUTE: string = "async"

AUTOWIRE_ATTRIBUTE

AUTOWIRE_ATTRIBUTE: string = "autowire"

CONFIGURATION_ELEMENT

CONFIGURATION_ELEMENT: string = "configuration"

CONSTRUCTORARG_ELEMENT

CONSTRUCTORARG_ELEMENT: string = "constructor-arg"

DIRECT_ATTRIBUTE

DIRECT_ATTRIBUTE: string = "direct"

ENTRY_ELEMENT

ENTRY_ELEMENT: string = "entry"

EXECUTE_ATTRIBUTE

EXECUTE_ATTRIBUTE: string = "execute"

EXPRESSION_ATTRIBUTE

EXPRESSION_ATTRIBUTE: string = "expression"

EXTERNAL_ATTRIBUTE

EXTERNAL_ATTRIBUTE: string = "external"

ID_ATTRIBUTE

ID_ATTRIBUTE: string = "id"

IMPORT_ELEMENT

IMPORT_ELEMENT: string = "import"

JSON_ELEMENT

JSON_ELEMENT: string = "json"

KEY_ATTRIBUTE

KEY_ATTRIBUTE: string = "key"

LIST_ELEMENT

LIST_ELEMENT: string = "list"

MAP_ELEMENT

MAP_ELEMENT: string = "map"

NAME_ATTRIBUTE

NAME_ATTRIBUTE: string = "name"

OBJECTS_ELEMENT

OBJECTS_ELEMENT: string = "objects"

OBJECT_ATTRIBUTE

OBJECT_ATTRIBUTE: string = "object"

OBJECT_ELEMENT

OBJECT_ELEMENT: string = "object"

PATH_ATTRIBUTE

PATH_ATTRIBUTE: string = "path"

PROPERTY_ELEMENT

PROPERTY_ELEMENT: string = "property"

PROPS_ELEMENT

PROPS_ELEMENT: string = "props"

PROP_ELEMENT

PROP_ELEMENT: string = "prop"

REF_ATTRIBUTE

REF_ATTRIBUTE: string = "ref"

REF_ELEMENT

REF_ELEMENT: string = "ref"

RESOURCE_ATTRIBUTE

RESOURCE_ATTRIBUTE: string = "resource"

SCOPE_ATTRIBUTE

SCOPE_ATTRIBUTE: string = "scope"

SET_ELEMENT

SET_ELEMENT: string = "set"

TYPE_ATTRIBUTE

TYPE_ATTRIBUTE: string = "type"

VALUE_ATTRIBUTE

VALUE_ATTRIBUTE: string = "value"

VALUE_ELEMENT

VALUE_ELEMENT: string = "value"

Const MidwayHandlerKey

MidwayHandlerKey: object

CONFIG

CONFIG: string = "config"

LOGGER

LOGGER: string = "logger"

PLUGIN

PLUGIN: string = "plugin"

Const NODE_TYPE

NODE_TYPE: object

ATTRIBUTE

ATTRIBUTE: number = 2

CDATA

CDATA: number = 4

ELEMENT

ELEMENT: number = 1

TEXT

TEXT: number = 3

Const RequestMethod

RequestMethod: object

ALL

ALL: string = "all"

DELETE

DELETE: string = "delete"

GET

GET: string = "get"

HEAD

HEAD: string = "head"

OPTIONS

OPTIONS: string = "options"

PATCH

PATCH: string = "patch"

POST

POST: string = "post"

PUT

PUT: string = "put"

Const ScopeEnum

ScopeEnum: object

Prototype

Prototype: "Prototype" = "Prototype"

Request

Request: "Request" = "Request"

Singleton

Singleton: "Singleton" = "Singleton"

Const VALUE_TYPE

VALUE_TYPE: object

BOOLEAN

BOOLEAN: string = "boolean"

DATE

DATE: string = "date"

INTEGER

INTEGER: string = "int"

MANAGED

MANAGED: string = "managed"

NUMBER

NUMBER: string = "number"

OBJECT

OBJECT: string = "object"

STRING

STRING: string = "string"

TEMPLATE

TEMPLATE: string = "template"

Const babel

babel: object

all

all: any

del

del: any

get

get: any

head

head: any

options

options: any

patch

patch: any

post

post: any

put

put: any

route

route: route

Const defaultMetadata

defaultMetadata: object

__computed

__computed: null = null

Generated using TypeDoc