Skip to main content

GlobalContext

@webda/core


Class: GlobalContext

Defined in: packages/core/src/contexts/globalcontext.ts:7

Global Context is used as system context

Extends​

Constructors​

Constructor​

new GlobalContext(): GlobalContext

Returns​

GlobalContext

Inherited from​

Context.constructor

Properties​

_promises​

_promises: Promise<any>[]

Defined in: packages/core/src/contexts/icontext.ts:33

Contain all registered promises to this context

Inherited from​

Context._promises


caches​

caches: any

Defined in: packages/core/src/contexts/icontext.ts:19

Get the caches linked to the context

Inherited from​

Context.caches


extensions​

protected extensions: object

Defined in: packages/core/src/contexts/icontext.ts:23

Allow extensions

Index Signature​

[key: string]: any

Inherited from​

Context.extensions


flushed​

protected flushed: boolean = false

Defined in: packages/core/src/contexts/icontext.ts:37

If the headers were flushed

Inherited from​

Context.flushed

Methods​

end()​

end(): Promise<void>

Defined in: packages/core/src/contexts/icontext.ts:80

Ensure the whole execution is finished

Returns​

Promise<void>

Inherited from​

Context.end


flushHeaders()​

flushHeaders(): Promise<void>

Defined in: packages/core/src/contexts/icontext.ts:134

Send the headers to the client

Returns​

Promise<void>

Inherited from​

Context.flushHeaders


getCurrentUser()​

getCurrentUser(): Promise<undefined>

Defined in: packages/core/src/contexts/globalcontext.ts:32

Returns​

Promise<undefined>

Overrides​

Context.getCurrentUser


getCurrentUserId()​

getCurrentUserId(): string

Defined in: packages/core/src/contexts/globalcontext.ts:18

Returns​

string

Overrides​

Context.getCurrentUserId


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​

Context.getExtension


getOutputStream()​

getOutputStream(): Promise<Writable>

Defined in: packages/core/src/contexts/globalcontext.ts:11

Returns​

Promise<Writable>

Overrides​

Context.getOutputStream


getResponseHeaders()​

getResponseHeaders(): any

Defined in: packages/core/src/contexts/icontext.ts:127

Get current response headers

Returns​

any

the result

Inherited from​

Context.getResponseHeaders


getSession()​

getSession(): object

Defined in: packages/core/src/contexts/globalcontext.ts:40

Provide an empty session object

Returns​

object

the result

Overrides​

Context.getSession


init()​

init(): Promise<GlobalContext>

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<GlobalContext>

this for chaining

Inherited from​

Context.init


isGlobalContext()​

isGlobalContext(): boolean

Defined in: packages/core/src/contexts/globalcontext.ts:25

Returns​

boolean

Overrides​

Context.isGlobalContext


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​

Context.pipeline


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​

Context.registerPromise


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​

Context.setExtension


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​

Context.setHeader


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

Inherited from​

Context.writeHead