IOperationContext
Abstract Class: IOperationContext<Input, Parameters, Output>
Defined in: packages/core/src/contexts/icontext.ts:181
Abstract context for an operation, providing access to input, parameters, output, and session
Extends
Extended by
Type Parameters
Input
Input = any
Parameters
Parameters = any
Output
Output = any
Constructors
Constructor
new IOperationContext<
Input,Parameters,Output>():IOperationContext<Input,Parameters,Output>
Returns
IOperationContext<Input, Parameters, Output>
Inherited from
Properties
_promises
_promises:
Promise<any>[]
Defined in: packages/core/src/contexts/icontext.ts:33
Contain all registered promises to this context
Inherited from
caches
caches:
any
Defined in: packages/core/src/contexts/icontext.ts:19
Get the caches linked to the context
Inherited from
extensions
protectedextensions:object
Defined in: packages/core/src/contexts/icontext.ts:23
Allow extensions
Index Signature
[key: string]: any
Inherited from
flushed
protectedflushed:boolean=false
Defined in: packages/core/src/contexts/icontext.ts:37
If the headers were flushed
Inherited from
Methods
clearInput()
abstractclearInput():void
Defined in: packages/core/src/contexts/icontext.ts:202
Returns
void
end()
end():
Promise<void>
Defined in: packages/core/src/contexts/icontext.ts:80
Ensure the whole execution is finished
Returns
Promise<void>
Inherited from
flushHeaders()
flushHeaders():
Promise<void>
Defined in: packages/core/src/contexts/icontext.ts:134
Send the headers to the client
Returns
Promise<void>
Inherited from
getCurrentUser()
abstractgetCurrentUser():Promise<any>
Defined in: packages/core/src/contexts/icontext.ts:90
Return the user
This method is not typed to avoid circular dependencies
Returns
Promise<any>
Inherited from
getCurrentUserId()
abstractgetCurrentUserId():string
Defined in: packages/core/src/contexts/icontext.ts:50
Get current user id
Returns
string
Inherited from
getExtension()
getExtension<
K>(name):K
Defined in: packages/core/src/contexts/icontext.ts:64
Get an extension of the context
Type Parameters
K
K = any
Parameters
name
string
of the extension
Returns
K
extension object
Inherited from
getInput()
abstractgetInput():Promise<Input>
Defined in: packages/core/src/contexts/icontext.ts:185
Get the input of the context
Returns
Promise<Input>
getOutputStream()
abstractgetOutputStream():Promise<Writable>
Defined in: packages/core/src/contexts/icontext.ts:177
Returns
Promise<Writable>
Inherited from
getParameters()
abstractgetParameters():Parameters
Defined in: packages/core/src/contexts/icontext.ts:206
Get the parameters of the context
Returns
Parameters
getRawInput()
abstractgetRawInput(limit?):Promise<any>
Defined in: packages/core/src/contexts/icontext.ts:190
Get the raw input of the context
Parameters
limit?
number
Returns
Promise<any>
getResponseHeaders()
getResponseHeaders():
any
Defined in: packages/core/src/contexts/icontext.ts:127
Get current response headers
Returns
any
the result
Inherited from
getSession()
abstractgetSession():any
Defined in: packages/core/src/contexts/icontext.ts:15
Get the session linked to the context if exists
Returns
any
Inherited from
init()
init():
Promise<IOperationContext<Input,Parameters,Output>>
Defined in: packages/core/src/contexts/icontext.ts:96
Can be used to init the context if needed Reading from the input or reaching to a db
Returns
Promise<IOperationContext<Input, Parameters, Output>>
this for chaining
Inherited from
isGlobalContext()
isGlobalContext():
boolean
Defined in: packages/core/src/contexts/icontext.ts:43
Whether this is the global (non-request-scoped) context
Returns
boolean
true if the condition is met
Inherited from
newSession()
abstractnewSession():any
Defined in: packages/core/src/contexts/icontext.ts:221
Create a new session
Logout the current user
Returns
any
parameter()
parameter(
name,defaultValue?):any
Defined in: packages/core/src/contexts/icontext.ts:198
Read one specific parameter
Parameters
name
string
the name to use
defaultValue?
any
the default value
Returns
any
the result
Deprecated
Use getParameters
pipeline()
pipeline(
stream1, ...streams):Promise<void>
Defined in: packages/core/src/contexts/icontext.ts:149
Pipeline streams into the output stream
Parameters
stream1
ReadableStream
the first stream
streams
...(ReadWriteStream | PipelineOptions)[]
additional streams
Returns
Promise<void>
See
https://nodejs.org/api/stream.html#streampipelinestreams-options
Inherited from
registerPromise()
registerPromise(
promise):void
Defined in: packages/core/src/contexts/icontext.ts:56
Register a promise with the context
Parameters
promise
any
the promise to add
Returns
void
Inherited from
setExtension()
setExtension(
name,extension):this
Defined in: packages/core/src/contexts/icontext.ts:73
Parameters
name
string
to add
extension
any
object to store
Returns
this
this for chaining
Inherited from
setHeader()
setHeader(
name,value):void
Defined in: packages/core/src/contexts/icontext.ts:104
Set a header in the response
Parameters
name
string
the name to use
value
string | number | string[]
the value to set
Returns
void
Inherited from
setSession()
abstractsetSession(session):void
Defined in: packages/core/src/contexts/icontext.ts:214
Parameters
session
any
Returns
void
write()
abstractwrite(_data):boolean
Defined in: packages/core/src/contexts/icontext.ts:212
Write the output of the context
Parameters
_data
Output
Returns
boolean
writeHead()
writeHead(
_code,headers):void
Defined in: packages/core/src/contexts/icontext.ts:116
For easier compatibility with WebContext On OperationContext this call is simply ignored
Parameters
_code
number
the status code
headers
Returns
void