Skip to content

PURISTA API


PURISTA API / @purista/core / ContextBase

Type Alias: ContextBase<Metrics>

ContextBase<Metrics> = object

Defined in: core/types/ContextBase.ts:21

The ContextBase provides is a basic type. Each context for command function, subscription function and all Hooks and transformers will have at least the properties of this type.

Type Parameters

Metrics

Metrics extends PuristaMetricDefinitions = EmptyObject

Properties

configs

configs: object

Defined in: core/types/ContextBase.ts:45

the config store

getConfig

getConfig: ConfigGetterFunction

get a config value from the config store

removeConfig

removeConfig: ConfigDeleteFunction

delete a config value from the config store

setConfig

setConfig: ConfigSetterFunction

set a config value in the config store


logger

logger: Logger

Defined in: core/types/ContextBase.ts:23

the logger instance


metrics

metrics: PuristaMetricContext<Metrics>

Defined in: core/types/ContextBase.ts:25

typed custom metrics declared on the current builder scope


queue

queue: QueueContext

Defined in: core/types/ContextBase.ts:62


secrets

secrets: object

Defined in: core/types/ContextBase.ts:36

the secret store

getSecret

getSecret: SecretGetterFunction

get a secret from the secret store

removeSecret

removeSecret: SecretDeleteFunction

delete a secret from the secret store

setSecret

setSecret: SecretSetterFunction

set a secret in the secret store


startActiveSpan

startActiveSpan: <F>(name, opts, context, fn) => Promise<F>

Defined in: core/types/ContextBase.ts:29

wrap given function in an opentelemetry active span

Type Parameters

F

F

Parameters

name

string

opts

SpanOptions

context

Context | undefined

fn

(span) => Promise<F>

Returns

Promise<F>


states

states: object

Defined in: core/types/ContextBase.ts:54

the state store

getState

getState: StateGetterFunction

get a state value from the state store

removeState

removeState: StateDeleteFunction

delete a state value from the state store

setState

setState: StateSetterFunction

set a state value in the state store


wrapInSpan

wrapInSpan: <F>(name, opts, fn, context?) => Promise<F>

Defined in: core/types/ContextBase.ts:27

wrap given function in an opentelemetry span

Type Parameters

F

F

Parameters

name

string

opts

SpanOptions

fn

(span) => Promise<F>

context?

Context

Returns

Promise<F>