Pipelines
Appolo Pipelines allows you to add a custom middleware to any class method using the pipeline decorator with a pipeline you can change the arguments passed to the origin method or change the return value
#
Pipeline#
Change return value#
Change arguments value#
Call on single argument#
PipelineTypechange the prototype of a class when defined
#
Pipeline Instanceruns on an instance create
#
Pipeline Contextpipeline must implement IPipeline
with run
method
the run method will be called with pipeline context
and next
function
next must be called in order to continue the pipeline chain
#
metaDataget metadata define during the pipeline decorator
#
metaData#
get metaData(): Treturn metaData
#
index#
get index(): numberreturn the index number if the pipeline defined on method argument
#
arguments#
get arguments(): IArgumentsreturn IArguments
of the origin method
#
instance#
get instance(): anyreturn the current class instance
#
type#
get type(): anyreturn the class type
#
action#
get action(): stringreturn string name of the method name
#
argumentsTypes#
get argumentsTypes(): any[]return array of the arguments types
#
isArgument#
get isArgument(): booleanreturn true if run on single method argument
#
setArgumentAt#
setArgumentAt(index: number, value: any)set argument value at index
#
getArgumentAt#
getArgumentAt<T>(index: number): Treturn argument value at index
#
getArgumentByType#
getArgumentByType<T>(ctor: typeof T): Treturn argument from arguments by given type
#
getRequest#
getRequest<T extends http.IncomingMessage>(): Treturn http.IncomingMessage
if exists in arguments
#
getResponse#
getResponse<T extends http.ServerResponse>(): Treturn http.ServerResponse
if exists in arguments
#
values#
get values(): { index: number, value: any, type: any }[]return array of argument values by index and type