Skip to content

PURISTA API / Modules / @purista/core

Module: @purista/core

This is the main package of PURISTA.

A backend framework for building message based domain services.

This framework adapts and combines a wide range of different patters from domain driven design, cqrs, microservice, event sourcing and lambda functions.

It is build from ground up in typescript and highly focuses on schema, and auto generation of types, input-output-validation, OpenApi documentation (swagger).

It contains the builders, classes & types and some helper functions. For easier testing of commands and subscriptions, the package contains different mock creation helper based on sinon

Learn PURIST at purista.dev

Table of contents

Enumerations

Classes

Interfaces

Type Aliases

Variables

Functions

Command

Event bridge

Helper

Service

Store

Subscription

Unit test helper

Type Aliases

AuthCredentials

Ƭ AuthCredentials: Object

HTTP authentication information

Type declaration

NameTypeDescription
basicAuth?{ password: string ; username: string }Basic-Auth information
basicAuth.passwordstringBasic-Auth password
basicAuth.usernamestringBasic-Auth username
bearerToken?stringBearer token header

Defined in

HttpClient/types/AuthCredentials.ts:4


BrokerHeaderCommandMsg

Ƭ BrokerHeaderCommandMsg: Prettify<BrokerHeaderCustomMsg & { receiverInstanceId?: InstanceId ; receiverServiceName: string ; receiverServiceTarget: string ; receiverServiceVersion: string }>

Defined in

core/types/BrokerHeaderCommandMsg.ts:5


BrokerHeaderCommandResponseMsg

Ƭ BrokerHeaderCommandResponseMsg: Prettify<BrokerHeaderCommandMsg & { receiverInstanceId: InstanceId }>

Defined in

core/types/BrokerHeaderCommandResponseMsg.ts:5


BrokerHeaderCustomMsg

Ƭ BrokerHeaderCustomMsg: Object

Type declaration

NameType
eventName?string
messageTypeEBMessageType
principalId?PrincipalId
senderInstanceIdInstanceId
senderServiceNamestring
senderServiceTargetstring
senderServiceVersionstring
tenantId?TenantId

Defined in

core/types/BrokerHeaderCustomMsg.ts:6


Command

Ƭ Command<PayloadType, ParameterType>: Prettify<{ correlationId: CorrelationId ; messageType: Command ; payload: { parameter: ParameterType ; payload: PayloadType } ; receiver: EBMessageAddress } & EBMessageBase>

Command is a event bridge message, which is emitted by sender to event bridge. The event bridge dispatches the event to the receiver. A command expects to get a response message from receiver back to sender.

Also if there are subscriptions which are matching given command, the event bridge also dispatches the command message to the subscriber(s).

BE AWARE: Subscribers should not respond with command responses if they are "silent" subscribers/listeners.

Type parameters

NameType
PayloadTypeunknown
ParameterTypeunknown

Defined in

core/types/commandType/Command.ts:18


CommandDefinitionList

Ƭ CommandDefinitionList<ServiceClassType>: Promise<CommandDefinition<ServiceClassType, CommandDefinitionMetadataBase, any, any, any, any, any, any, any, any>>[]

Helper type for creating list of service commands to be passed as input to service class

typescript
export const userServiceCommands: CommandDefinitionList<UserService> = [signUp.getDefinition()]

Type parameters

NameType
ServiceClassTypeextends ServiceClass

Defined in

core/types/commandType/CommandDefinitionList.ts:12


CommandDefinitionListResolved

Ƭ CommandDefinitionListResolved<ServiceClassType>: CommandDefinition<ServiceClassType, CommandDefinitionMetadataBase, any, any, any, any, any, any, any, any>[]

Type parameters

NameType
ServiceClassTypeextends ServiceClass

Defined in

core/types/commandType/CommandDefinitionList.ts:16


CommandDefinitionMetadataBase

Ƭ CommandDefinitionMetadataBase: Object

Type declaration

NameType
expose{ contentEncodingRequest?: string ; contentEncodingResponse?: string ; contentTypeRequest?: ContentType ; contentTypeResponse?: ContentType ; deprecated?: boolean ; inputPayload?: SchemaObject ; outputPayload?: SchemaObject ; parameter?: SchemaObject }
expose.contentEncodingRequest?string
expose.contentEncodingResponse?string
expose.contentTypeRequest?ContentType
expose.contentTypeResponse?ContentType
expose.deprecated?boolean
expose.inputPayload?SchemaObject
expose.outputPayload?SchemaObject
expose.parameter?SchemaObject

Defined in

core/types/commandType/CommandDefinitionMetadataBase.ts:5


Complete

Ƭ Complete<T>: { [P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>> ? T[P] : T[P] | undefined }

A helper which forces to provide all object keys, even if they are optional.

Example

typescript
type A = {
 one?: string,
 two?: number,
 three: string
}

// without:
const x:A = { three: 'will work'}

// this will fail
const y:Complete<A> = { three: 'will complain that one and two is missing'}
// needs to be like this:
const z:Complete<A> = { one: undefined, two: undefined, three: 'will work'}

Type parameters

Name
T

Defined in

core/types/Complete.ts:21


CompressionMethod

Ƭ CompressionMethod: "gzip" | "deflat" | "br" | undefined

Defined in

core/HttpServer/types/CompressionMethod.ts:1


ConfigStoreCacheMap

Ƭ ConfigStoreCacheMap: Map<string, { createdAt: number ; value: string }>

Defined in

core/ConfigStore/types/ConfigStoreCacheMap.ts:1


ContentType

Ƭ ContentType: "application/json" | "application/javascript" | "text/csv" | "text/css" | "text/html" | "text/javascript" | "text/markdown" | "text/plain" | "text/xml" | string

List of content types for message payloads. If the content type is other than application/json, the message payload must be a string. It is up to the implementation to extract the content type from the original message and to convert or transform data.

Defined in

core/types/ContentType.ts:6


ContextBase

Ƭ ContextBase: Object

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 declaration

NameTypeDescription
configs{ getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction }the config store
configs.getConfigConfigGetterFunctionget a config value from the config store
configs.removeConfigConfigDeleteFunctiondelete a config value from the config store
configs.setConfigConfigSetterFunctionset a config value in the config store
loggerLoggerthe logger instance
secrets{ getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction }the secret store
secrets.getSecretSecretGetterFunctionget a secret from the secret store
secrets.removeSecretSecretDeleteFunctiondelete a secret from the secret store
secrets.setSecretSecretSetterFunctionset a secret in the secret store
startActiveSpan<F>(name: string, opts: SpanOptions, context: Context | undefined, fn: (span: Span) => Promise<F>) => Promise<F>wrap given function in an opentelemetry active span
states{ getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction }the state store
states.getStateStateGetterFunctionget a state value from the state store
states.removeStateStateDeleteFunctiondelete a state value from the state store
states.setStateStateSetterFunctionset a state value in the state store
wrapInSpan<F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F>wrap given function in an opentelemetry span

Defined in

core/types/ContextBase.ts:12


CorrelationId

Ƭ CorrelationId: string

the correlation id links the command invocation message with the command response message

Defined in

core/types/CorrelationId.ts:2


CustomMessage

Ƭ CustomMessage<Payload>: Prettify<{ eventName: string ; messageType: CustomMessage ; payload?: Payload ; receiver?: EBMessageAddress } & EBMessageBase>

A custom message is a message which can be used to pass business information. The producer emits the message without knowledge about any consumer. The producer does not expect a response from a consumer.

Type parameters

NameType
Payloadunknown

Defined in

core/types/CustomMessage.ts:11


DefaultConfigStoreConfig

Ƭ DefaultConfigStoreConfig: Record<string, unknown>

Defined in

DefaultConfigStore/types/DefaultConfigStoreConfig.ts:1


DefaultEventBridgeConfig

Ƭ DefaultEventBridgeConfig: Object

The configuration for the DefaultEventBridge.

Type declaration

NameTypeDescription
emitMessagesAsEventBridgeEvents?booleanEmit messages which have an event name set as javascript events on the event bridge instance
logWarnOnMessagesWithoutReceiver?booleanLog warnings on messages which are emitted, but could not delivered to at least one receiver

Defined in

DefaultEventBridge/types/DefaultEventBridgeConfig.ts:4


DefaultSecretStoreConfig

Ƭ DefaultSecretStoreConfig: Record<string, unknown>

Defined in

DefaultSecretStore/types/DefaultSecretStoreConfig.ts:1


DefaultStateStoreConfig

Ƭ DefaultStateStoreConfig: Record<string, unknown>

Defined in

DefaultStateStore/types/DefaultStateStoreConfig.ts:1


DefinitionEventBridgeConfig

Ƭ DefinitionEventBridgeConfig: Object

Settings and advices for the event bridge, which are set in the command or subscription builder. The properties are advices and hints. It depends on the used event bridge implementation and underlaying message broker, if a specific property can be respected.

Type declaration

NameTypeDescription
autoacknowledgebooleanSend the acknowledge to message broker as soon as the message arrives - defaults to true for commands - defaults to false for subscriptions
durablebooleanAdvise the underlaying message broker to store messages if no consumer is available. Messages will be send as soon as the service is able to consume.
sharedbooleanIf set to true, the event bridge is adviced to deliver one message to at least one consumer instance. True is the default value. If set to false, the event bridge is adviced to deliver one message to all consumer instances. Use case: Receiving Info of message, which need to be passed to all instance to keep information in sync. In serverless environments, this flag should not have any effect Default ts true

Defined in

core/types/DefinitionEventBridgeConfig.ts:6


EBMessage

Ƭ EBMessage: Command | CommandResponse | InfoMessage | CustomMessage

EBMessage is some message which is handled by the event bridge.

Defined in

core/types/EBMessage.ts:8


EBMessageAddress

Ƭ EBMessageAddress: Object

A event bridge message address describes the sender or receiver of a message.

Type declaration

NameTypeDescription
instanceId?Exclude<InstanceId, "">instance id of eventbridge
serviceNameExclude<string, "">the name of the service
serviceTargetExclude<string, "">the name of the command or subscription
serviceVersionExclude<string, "">the version of the service

Defined in

core/types/EBMessageAddress.ts:6


EBMessageBase

Ƭ EBMessageBase: Object

Default fields which are part of any purista message

Type declaration

NameTypeDescription
contentEncodingstringcontent encoding of message payload
contentTypeContentTypecontent type of message payload
correlationId?CorrelationIdcorrelation id to know which command response referrs to which command
eventName?stringevent name for this message
idEBMessageIdglobal unique id of message
otp?stringstringified Opentelemetry parent trace id
principalId?PrincipalIdprincipal id
senderEBMessageSenderAddress-
tenantId?TenantIdprincipal id
timestampnumbertimestamp of message creation time
traceId?TraceIdtrace id of message

Defined in

core/types/EBMessageBase.ts:12


EBMessageId

Ƭ EBMessageId: string

Unique id of the event bridge message

Defined in

core/types/EBMessageId.ts:4


EBMessageSenderAddress

Ƭ EBMessageSenderAddress: Prettify<Omit<EBMessageAddress, "instanceId"> & Required<Pick<EBMessageAddress, "instanceId">>>

A event bridge message address describes the sender or receiver of a message.

Defined in

core/types/EBMessageSenderAddress.ts:7


EmitCustomMessageFunction

Ƭ EmitCustomMessageFunction<EmitList>: <K>(eventName: K, payload: EmitList[K], contentType?: ContentType, contentEncoding?: string) => Promise<void>

Emits the given payload as custom message with the given event name.

Example

typescript
await emit('my-custom-event-name', { the: 'payload' })

Type parameters

Name
EmitList

Type declaration

▸ <K>(eventName, payload, contentType?, contentEncoding?): Promise<void>

Type parameters
NameType
Kextends keyof EmitSchemaList<EmitList>
Parameters
NameType
eventNameK
payloadEmitList[K]
contentType?ContentType
contentEncoding?string
Returns

Promise<void>

Defined in

core/types/EmitCustomMessageFunction.ts:12


EmitSchemaList

Ƭ EmitSchemaList<T>: { [K in keyof T]: Schema }

Type parameters

Name
T

Defined in

core/types/EmitSchemaList.ts:3


ErrorResponsePayload

Ƭ ErrorResponsePayload: Object

Error message payload

Type declaration

NameTypeDescription
data?unknownaddition data
messagestringa human readable error message
statusStatusCodethe error status code
traceId?TraceIdthe trace if of the request

Defined in

core/types/ErrorResponsePayload.ts:7


EventBridgeAdapterEvents

Ƭ EventBridgeAdapterEvents: Object

Index signature

▪ [key: string]: unknown

currently not used, but reserved for further events

Group

Events

Defined in

core/EventBridge/types/EventBridgeEvents.ts:42


EventBridgeConfig

Ƭ EventBridgeConfig<CustomConfig>: Prettify<{ defaultCommandTimeout?: number ; instanceId?: string ; logLevel?: LogLevelName ; logger?: Logger ; spanProcessor?: SpanProcessor } & CustomConfig>

The config object for an event bridge. Every event bridge implementation must use this type for configuration.

Type parameters

Name
CustomConfig

Defined in

core/EventBridge/types/EventBridgeConfig.ts:10


EventBridgeCustomEvents

Ƭ EventBridgeCustomEvents: Object

Index signature

▪ [key: string]: unknown

emitted a EBMessage if event name is provided and if it is enabled and supported on the event bridge

Group

Events

Defined in

core/EventBridge/types/EventBridgeEvents.ts:37


EventBridgeEvents

Ƭ EventBridgeEvents: Prettify<EventBridgeEventsBasic & addPrefixToObject<EventBridgeAdapterEvents, "adapter-"> & addPrefixToObject<EventBridgeCustomEvents, "custom-">>

Defined in

core/EventBridge/types/EventBridgeEvents.ts:47


EventKey

Ƭ EventKey<T>: string & keyof T

Type parameters

NameType
Textends EventMap

Defined in

core/types/GenericEventEmitter.ts:5


EventMap

Ƭ EventMap: Record<string, any>

Defined in

core/types/GenericEventEmitter.ts:3


FromEmitToOtherType

Ƭ FromEmitToOtherType<Entry, NewType>: { [TKey in keyof Entry]: NewType }

Changes the canEmit proxy type to given type

serviceName.ServiceVersion.FunctionName becomes type of SinonStub

Type parameters

Name
Entry
NewType

Defined in

core/types/FromEmitToOtherType.ts:6


FromInvokeToOtherType

Ƭ FromInvokeToOtherType<Entry, NewType>: { [TKey in keyof Entry]: { [TKey2 in keyof Entry[TKey]]: { [TKey3 in keyof Entry[TKey][TKey2]]: NewType } } }

Changes the canInvoke proxy type to given type

serviceName.ServiceVersion.FunctionName becomes type of NewType

Type parameters

Name
Entry
NewType

Defined in

core/types/FromInvokeToOtherType.ts:6


HttpClientConfig

Ƭ HttpClientConfig<CustomConfig>: Prettify<{ baseUrl: string ; basicAuth?: { password: string ; username: string } ; bearerToken?: string ; defaultHeaders?: Record<string, string> ; defaultTimeout?: number ; enableOpentelemetry?: boolean ; isKeepAlive?: boolean ; logLevel?: LogLevelName ; logger?: Logger ; name?: string ; spanProcessor?: SpanProcessor ; traceId?: string } & CustomConfig>

Tha basic configuration for a HTTPClient Requires as least a baseUrl

Type parameters

NameType
CustomConfigextends Record<string, unknown>

Defined in

HttpClient/types/HttpClientConfig.ts:9


HttpClientRequestOptions

Ƭ HttpClientRequestOptions: Object

Options for a single request

Type declaration

NameTypeDescription
hash?stringurl hash @example: http://example.com/index.html#hash
headers?Record<string, string>additional headers
query?Record<string, string>query/search string parameter
timeout?numberTimeout for the request in ms Default ts 30000

Defined in

HttpClient/types/HttpClientRequestOptions.ts:4


HttpExposedServiceMeta

Ƭ HttpExposedServiceMeta<ParameterType>: Prettify<CommandDefinitionMetadataBase & { expose: { http: { method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE" ; openApi?: { additionalStatusCodes?: StatusCode[] ; description: string ; isSecure: boolean ; operationId?: string ; query?: QueryParameter<ParameterType>[] ; summary: string ; tags?: string[] } ; path: string } } }>

Type parameters

NameType
ParameterType{}

Defined in

core/HttpServer/types/HttpExposedServiceMeta.ts:4


InfoInvokeTimeout

Ƭ InfoInvokeTimeout: { messageType: InfoInvokeTimeout } & InfoServiceBase

Defined in

core/types/infoType/InfoInvokeTimeout.ts:22


InfoInvokeTimeoutPayload

Ƭ InfoInvokeTimeoutPayload: Object

Type declaration

NameType
correlationIdCorrelationId
receiver{ serviceName: string ; serviceTarget: string ; serviceVersion: string }
receiver.serviceNamestring
receiver.serviceTargetstring
receiver.serviceVersionstring
sender{ serviceName: string ; serviceTarget: string ; serviceVersion: string }
sender.serviceNamestring
sender.serviceTargetstring
sender.serviceVersionstring
timestampnumber
traceIdTraceId

Defined in

core/types/infoType/InfoInvokeTimeout.ts:6


InfoMessage

Ƭ InfoMessage: InfoServiceDrain | InfoServiceFunctionAdded | InfoServiceInit | InfoServiceNotReady | InfoServiceReady | InfoServiceShutdown | InfoInvokeTimeout | InfoSubscriptionError

Defined in

core/types/infoType/InfoMessage.ts:11


InfoMessageType

Ƭ InfoMessageType: InfoServiceDrain | InfoServiceFunctionAdded | InfoServiceInit | InfoServiceNotReady | InfoServiceReady | InfoServiceShutdown | InfoInvokeTimeout | InfoSubscriptionError

Defined in

core/types/infoType/InfoMessage.ts:21


InfoServiceBase

Ƭ InfoServiceBase: Prettify<{ contentEncoding: "utf-8" ; contentType: "application/json" ; payload?: unknown } & EBMessageBase>

Defined in

core/types/infoType/InfoServiceBase.ts:4


InfoServiceDrain

Ƭ InfoServiceDrain: Prettify<{ messageType: InfoServiceDrain } & InfoServiceBase>

Defined in

core/types/infoType/InfoServiceDrain.ts:5


InfoServiceFunctionAdded

Ƭ InfoServiceFunctionAdded: Prettify<{ messageType: InfoServiceFunctionAdded } & InfoServiceBase>

Defined in

core/types/infoType/InfoServiceFunctionAdded.ts:5


InfoServiceInit

Ƭ InfoServiceInit: Prettify<{ messageType: InfoServiceInit } & InfoServiceBase>

Defined in

core/types/infoType/InfoServiceInit.ts:5


InfoServiceNotReady

Ƭ InfoServiceNotReady: Prettify<{ messageType: InfoServiceNotReady } & InfoServiceBase>

Defined in

core/types/infoType/InfoServiceNotReady.ts:5


InfoServiceReady

Ƭ InfoServiceReady: Prettify<{ messageType: InfoServiceReady } & InfoServiceBase>

Defined in

core/types/infoType/InfoServiceReady.ts:5


InfoServiceShutdown

Ƭ InfoServiceShutdown: Prettify<{ messageType: InfoServiceShutdown } & InfoServiceBase>

Defined in

core/types/infoType/InfoServiceShutdown.ts:5


InfoSubscriptionError

Ƭ InfoSubscriptionError: Prettify<{ messageType: InfoSubscriptionError } & InfoServiceBase>

Defined in

core/types/infoType/InfoSubscriptionError.ts:5


InstanceId

Ƭ InstanceId: string

the instance id of the event bridge

Defined in

core/types/InstanceId.ts:2


InvokeFunction

Ƭ InvokeFunction: <InvokeResponseType, PayloadType, ParameterType>(address: EBMessageAddress, payload: PayloadType, parameter: ParameterType) => Promise<InvokeResponseType>

Invokes a command and returns the result. It is recommended to validate the result against a schema which only contains the data you actually need.

Example

typescript

const address: EBMessageAddress = {
  serviceName: 'name-of-service-to-invoke',
  serviceVersion: '1',
  serviceTarget: 'command-name-to-invoke',
}

const inputPayload = { my: 'input' }
const inputParameter = { search: 'for_me' }

const result = await invoke<MyResultType>(address, inputPayload inputParameter )

Type declaration

▸ <InvokeResponseType, PayloadType, ParameterType>(address, payload, parameter): Promise<InvokeResponseType>

Type parameters
NameType
InvokeResponseTypeunknown
PayloadTypeunknown
ParameterTypeunknown
Parameters
NameType
addressEBMessageAddress
payloadPayloadType
parameterParameterType
Returns

Promise<InvokeResponseType>

Defined in

core/types/InvokeFunction.ts:22


LogFnParamType

Ƭ LogFnParamType: [unknown, string?, ...any] | [string, ...any]

Defined in

core/types/Logger.ts:20


LogLevelName

Ƭ LogLevelName: "info" | "error" | "warn" | "debug" | "trace" | "fatal"

Defined in

core/types/LogLevelName.ts:1


LoggerOptions

Ƭ LoggerOptions: Object

Type declaration

NameType
customTraceId?TraceId
hostname?string
instanceId?InstanceId
module?string
name?string
principalId?PrincipalId
puristaVersion?string
serviceName?string
serviceTarget?string
serviceVersion?string
tenantId?TenantId

Defined in

core/types/Logger.ts:6


LoggerStubs

Ƭ LoggerStubs: Object

Type declaration

NameType
debugSinonStub
errorSinonStub
infoSinonStub
traceSinonStub
warnSinonStub

Defined in

mocks/getLogger.mock.ts:42


Newable

Ƭ Newable<T, ConfigType>: (config: ServiceConstructorInput<ConfigType>) => T

Type parameters

Name
T
ConfigType

Type declaration

new Newable(config): T

Parameters
NameType
configServiceConstructorInput<ConfigType>
Returns

T

Defined in

ServiceBuilder/ServiceBuilder.impl.ts:30


NonEmptyString

Ƭ NonEmptyString<T>: "" extends T ? never : T

Type parameters

NameType
Textends string

Defined in

helper/types/NonEmptyString.ts:1


ObjectWithKeysFromStringArray

Ƭ ObjectWithKeysFromStringArray<T, Value>: { [K in T extends ReadonlyArray<infer U> ? U : never]: Value }

Type helper which can create a typed record, based on given string array type.

Type parameters

NameType
Textends ReadonlyArray<string>
Valueunknown | undefined

Defined in

helper/types/ObjectWithKeysFromStringArray.ts:5


PendigInvocation

Ƭ PendigInvocation: Object

Type declaration

NameType
reject(error: UnhandledError | HandledError) => void
resolve(responsePayload: unknown) => void

Defined in

DefaultEventBridge/types/PendingInvocations.ts:3


Prettify

Ƭ Prettify<T>: { [K in keyof T]: T[K] } & {}

Type parameters

Name
T

Defined in

core/types/Prettify.ts:1


PrincipalId

Ƭ PrincipalId: string

the principal id

Defined in

core/types/PrincipalId.ts:2


QueryParameter

Ƭ QueryParameter<ParameterType>: Object

Type parameters

NameType
ParameterType{}

Type declaration

NameType
namekeyof ParameterType
requiredboolean

Defined in

core/HttpServer/types/QueryParameter.ts:1


SecretStoreCacheMap

Ƭ SecretStoreCacheMap: Map<string, { createdAt: number ; value: string }>

Defined in

core/SecretStore/types/SecretStoreCacheMap.ts:1


ServiceEvents

Ƭ ServiceEvents: ServiceEventsInternal & addPrefixToObject<CustomEvents, "custom-"> & addPrefixToObject<CustomEvents, "misc-">

ServiceEvents are plain javascript events sent by the service. There are three types:

  • technical events when a services starts, stops, an error occurs and so on are prefixed with service-
  • response messages, which have a event name assigned, are prefixed with custom-
  • additional events, free defined by developer are prefixed with misc-

Defined in

core/types/ServiceEvents.ts:98


ServiceInfoType

Ƭ ServiceInfoType: Object

General service information

Type declaration

NameType
serviceDescriptionstring
serviceNameExclude<string, "">
serviceVersionExclude<string, "">

Defined in

core/types/infoType/ServiceInfoType.ts:4


ShutdownEntry

Ƭ ShutdownEntry: Object

Entry of thing you like to shutdown gracefully

Type declaration

NameTypeDescription
destroy() => Promise<void>a async function that is called during shutdown
namestringthe name

Defined in

helper/types/ShutdownEntry.ts:4


StoreBaseConfig

Ƭ StoreBaseConfig<Config>: Prettify<{ cacheTtl?: number ; enableCache?: boolean ; enableGet?: boolean ; enableRemove?: boolean ; enableSet?: boolean ; logLevel?: LogLevelName ; logger?: Logger } & Config>

Basic configuration object which is used by any store

Type parameters

NameType
Configextends Record<string, unknown>

Defined in

core/types/StoreBaseConfig.ts:8


SubscriptionDefinitionList

Ƭ SubscriptionDefinitionList<ServiceClassType>: Promise<SubscriptionDefinition<ServiceClassType, any, any, any, any, any, any, any, any, any>>[]

Helper type for creating list of service commands to be passed as input to service class

typescript
export const userServiceCommands: SubscriptionDefinitionList<UserService> = [signUp.getDefinition()]

Type parameters

NameType
ServiceClassTypeextends ServiceClass

Defined in

core/types/subscription/SubscriptionDefinitionList.ts:11


SubscriptionDefinitionListResolved

Ƭ SubscriptionDefinitionListResolved<ServiceClassType>: SubscriptionDefinition<ServiceClassType, any, any, any, any, any, any, any, any, any>[]

Type parameters

NameType
ServiceClassTypeextends ServiceClass

Defined in

core/types/subscription/SubscriptionDefinitionList.ts:15


SubscriptionDefinitionMetadataBase

Ƭ SubscriptionDefinitionMetadataBase: Object

Type declaration

NameType
expose{ contentEncodingRequest?: string ; contentEncodingResponse?: string ; contentTypeRequest?: ContentType ; contentTypeResponse?: ContentType ; inputPayload?: SchemaObject ; outputPayload?: SchemaObject ; parameter?: SchemaObject }
expose.contentEncodingRequest?string
expose.contentEncodingResponse?string
expose.contentTypeRequest?ContentType
expose.contentTypeResponse?ContentType
expose.inputPayload?SchemaObject
expose.outputPayload?SchemaObject
expose.parameter?SchemaObject

Defined in

core/types/subscription/SubscriptionDefinitionMetadataBase.ts:5


SubscriptionStorageEntry

Ƭ SubscriptionStorageEntry: Object

Type declaration

NameType
cb(message: EBMessage) => Promise<Omit<CustomMessage, "id" | "timestamp"> | undefined>
emitEventName?string
isMatchingEventName(input?: string) => boolean
isMatchingMessageType(input: EBMessageType) => boolean
isMatchingPrincipalId(input?: string) => boolean
isMatchingReceiverInstanceId(input?: string) => boolean
isMatchingReceiverServiceName(input?: string) => boolean
isMatchingReceiverServiceTarget(input?: string) => boolean
isMatchingReceiverServiceVersion(input?: string) => boolean
isMatchingSenderInstanceId(input?: string) => boolean
isMatchingSenderServiceName(input?: string) => boolean
isMatchingSenderServiceTarget(input?: string) => boolean
isMatchingSenderServiceVersion(input?: string) => boolean
isMatchingTenantId(input?: string) => boolean

Defined in

DefaultEventBridge/types/SubscriptionStorageEntry.ts:3


SupportedHttpMethod

Ƭ SupportedHttpMethod: "GET" | "POST" | "PATCH" | "PUT" | "DELETE"

Supported HTTP-Methods for defining endpoints

Defined in

core/HttpServer/types/SupportedHttpMethod.ts:2


TenantId

Ƭ TenantId: string

the tenant id

Defined in

core/types/TenantId.ts:2


TraceId

Ƭ TraceId: string

The trace id which will be passed through all commands, invocations and subscriptions

Defined in

core/types/TraceId.ts:4


addPrefixToObject

Ƭ addPrefixToObject<T, P>: { [K in keyof T as K extends string ? `${P}${K}` : never]: T[K] }

Helper for better typescript type. All keys of given object must start with the given prefix. Otherwise Typescript will complain.


#### Type parameters

| Name | Type |
| :------ | :------ |
| `T` | `T` |
| `P` | extends `string` |

#### Defined in

[core/types/addPrefixToObject.ts:7](https://github.com/puristajs/purista/blob/master/packages/core/src/core/types/addPrefixToObject.ts#L7)

## Variables

### MIN\_CONTENT\_SIZE\_FOR\_COMPRESSION

• `Const` **MIN\_CONTENT\_SIZE\_FOR\_COMPRESSION**: ``1024``

#### Defined in

[core/HttpServer/MinContentSizeForCompression.const.ts:1](https://github.com/puristajs/purista/blob/master/packages/core/src/core/HttpServer/MinContentSizeForCompression.const.ts#L1)

___

### ServiceInfoValidator

• `Const` **ServiceInfoValidator**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `set` | (`obj`: [`ServiceInfoType`](purista_core.md#serviceinfotype), `prop`: keyof [`ServiceInfoType`](purista_core.md#serviceinfotype), `value`: `string`) => `boolean` |

#### Defined in

[core/Service/ServiceInfoValidator.impl.ts:5](https://github.com/puristajs/purista/blob/master/packages/core/src/core/Service/ServiceInfoValidator.impl.ts#L5)

___

### infoMessageTypes

• `Const` **infoMessageTypes**: [`EBMessageType`](../enums/purista_core.EBMessageType.md)[]

#### Defined in

[core/types/infoType/InfoMessage.ts:30](https://github.com/puristajs/purista/blob/master/packages/core/src/core/types/infoType/InfoMessage.ts#L30)

___

### puristaVersion

• `Const` **puristaVersion**: ``"1.11.0"``

#### Defined in

[version.ts:1](https://github.com/puristajs/purista/blob/master/packages/core/src/version.ts#L1)

## Functions

### createInvokeFunctionProxy

▸ **createInvokeFunctionProxy**\<`TFaux`\>(`invokeOg`, `address?`, `lvl?`): `TFaux`

Creates a proxy which allows to chain the invoke function.

#### Type parameters

| Name |
| :------ |
| `TFaux` |

#### Parameters

| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
| `invokeOg` | [`InvokeFunction`](purista_core.md#invokefunction) | `undefined` | the regular invoke function |
| `address?` | [`EBMessageAddress`](purista_core.md#ebmessageaddress) | `undefined` | the receivers EBMessageAddress |
| `lvl` | `number` | `0` | counter for recursive usage |

#### Returns

`TFaux`

a proxy which allows to chain like serviceName.serviceVersion.fnToInvoke(payload,parameter)

#### Defined in

[core/helper/createInvokeFunctionProxy.impl.ts:16](https://github.com/puristajs/purista/blob/master/packages/core/src/core/helper/createInvokeFunctionProxy.impl.ts#L16)

___

### extendApi

▸ **extendApi**\<`T`\>(`schema`, `SchemaObject?`): `T`

#### Type parameters

| Name | Type |
| :------ | :------ |
| `T` | extends [`OpenApiZodAny`](../interfaces/purista_core.OpenApiZodAny.md) |

#### Parameters

| Name | Type |
| :------ | :------ |
| `schema` | `T` |
| `SchemaObject` | `SchemaObject` |

#### Returns

`T`

#### Defined in

[zodOpenApi/zodOpenApi.impl.ts:26](https://github.com/puristajs/purista/blob/master/packages/core/src/zodOpenApi/zodOpenApi.impl.ts#L26)

___

### generateSchema

▸ **generateSchema**(`zodRef`, `useOutput?`): `SchemaObject`

#### Parameters

| Name | Type |
| :------ | :------ |
| `zodRef` | [`OpenApiZodAny`](../interfaces/purista_core.OpenApiZodAny.md) |
| `useOutput?` | `boolean` |

#### Returns

`SchemaObject`

#### Defined in

[zodOpenApi/zodOpenApi.impl.ts:415](https://github.com/puristajs/purista/blob/master/packages/core/src/zodOpenApi/zodOpenApi.impl.ts#L415)

___

### getCommandFunctionWithValidation

▸ **getCommandFunctionWithValidation**\<`ServiceClassType`, `MessagePayloadType`, `MessageParamsType`, `MessageResultType`, `FunctionPayloadType`, `FunctionParamsType`, `FunctionResultType`, `Invokes`, `EmitListType`\>(`fn`, `inputPayloadSchema`, `inputParameterSchema`, `outputPayloadSchema`, `beforeGuards?`): [`CommandFunction`](purista_core.md#commandfunction)\<`ServiceClassType`, `MessagePayloadType`, `MessageParamsType`, `FunctionPayloadType`, `FunctionParamsType`, `FunctionResultType`, `Invokes`, `EmitListType`\>

#### Type parameters

| Name | Type |
| :------ | :------ |
| `ServiceClassType` | extends [`ServiceClass`](../interfaces/purista_core.ServiceClass.md)\<`unknown`\> |
| `MessagePayloadType` | `unknown` |
| `MessageParamsType` | `unknown` |
| `MessageResultType` | `unknown` |
| `FunctionPayloadType` | `MessagePayloadType` |
| `FunctionParamsType` | `MessageParamsType` |
| `FunctionResultType` | `MessageResultType` |
| `Invokes` | {} |
| `EmitListType` | {} |

#### Parameters

| Name | Type |
| :------ | :------ |
| `fn` | [`CommandFunction`](purista_core.md#commandfunction)\<`ServiceClassType`, `MessagePayloadType`, `MessageParamsType`, `FunctionPayloadType`, `FunctionParamsType`, `FunctionResultType`, `Invokes`, `EmitListType`\> |
| `inputPayloadSchema` | `undefined` \| `Schema`\<`any`, `any`, `any`, ``""``\> \| `ZodType`\<`any`, `ZodTypeDef`, `any`\> |
| `inputParameterSchema` | `undefined` \| `Schema`\<`any`, `any`, `any`, ``""``\> \| `ZodType`\<`any`, `ZodTypeDef`, `any`\> |
| `outputPayloadSchema` | `undefined` \| `Schema`\<`any`, `any`, `any`, ``""``\> \| `ZodType`\<`any`, `ZodTypeDef`, `any`\> |
| `beforeGuards` | `Record`\<`string`, [`CommandBeforeGuardHook`](purista_core.md#commandbeforeguardhook)\<`ServiceClassType`, `MessagePayloadType`, `MessageParamsType`, `FunctionPayloadType`, `FunctionParamsType`, `Invokes`, `EmitListType`\>\> |

#### Returns

[`CommandFunction`](purista_core.md#commandfunction)\<`ServiceClassType`, `MessagePayloadType`, `MessageParamsType`, `FunctionPayloadType`, `FunctionParamsType`, `FunctionResultType`, `Invokes`, `EmitListType`\>

#### Defined in

[CommandDefinitionBuilder/getCommandFunctionWithValidation.impl.ts:8](https://github.com/puristajs/purista/blob/master/packages/core/src/CommandDefinitionBuilder/getCommandFunctionWithValidation.impl.ts#L8)

___

### getDefaultEventBridgeConfig

▸ **getDefaultEventBridgeConfig**(): [`Complete`](purista_core.md#complete)\<[`DefaultEventBridgeConfig`](purista_core.md#defaulteventbridgeconfig)\>

#### Returns

[`Complete`](purista_core.md#complete)\<[`DefaultEventBridgeConfig`](purista_core.md#defaulteventbridgeconfig)\>

#### Defined in

[DefaultEventBridge/getDefaultEventBridgeConfig.impl.ts:4](https://github.com/puristajs/purista/blob/master/packages/core/src/DefaultEventBridge/getDefaultEventBridgeConfig.impl.ts#L4)

___

### getDefaultLogLevel

▸ **getDefaultLogLevel**(): [`LogLevelName`](purista_core.md#loglevelname)

#### Returns

[`LogLevelName`](purista_core.md#loglevelname)

#### Defined in

[DefaultLogger/getDefaultLogLevel.ts:4](https://github.com/puristajs/purista/blob/master/packages/core/src/DefaultLogger/getDefaultLogLevel.ts#L4)

___

### getNewSubscriptionStorageEntry

▸ **getNewSubscriptionStorageEntry**(`subscription`, `cb`): [`SubscriptionStorageEntry`](purista_core.md#subscriptionstorageentry)

#### Parameters

| Name | Type |
| :------ | :------ |
| `subscription` | [`Subscription`](purista_core.md#subscription) |
| `cb` | (`message`: [`EBMessage`](purista_core.md#ebmessage)) => `Promise`\<`undefined` \| `Omit`\<\{ `contentEncoding`: `string` ; `contentType`: `string` ; `correlationId?`: `string` ; `eventName`: `string` ; `id`: `string` ; `messageType`: [`CustomMessage`](../enums/purista_core.EBMessageType.md#custommessage) ; `otp?`: `string` ; `payload?`: `unknown` ; `principalId?`: `string` ; `receiver?`: [`EBMessageAddress`](purista_core.md#ebmessageaddress) ; `sender`: \{ `instanceId`: `string` ; `serviceName`: `string` ; `serviceTarget`: `string` ; `serviceVersion`: `string`  } ; `tenantId?`: `string` ; `timestamp`: `number` ; `traceId?`: `string`  }, ``"id"`` \| ``"timestamp"``\>\> |

#### Returns

[`SubscriptionStorageEntry`](purista_core.md#subscriptionstorageentry)

#### Defined in

[DefaultEventBridge/getNewSubscriptionStorageEntry.impl.ts:4](https://github.com/puristajs/purista/blob/master/packages/core/src/DefaultEventBridge/getNewSubscriptionStorageEntry.impl.ts#L4)

___

### getSubscriptionFunctionWithValidation

▸ **getSubscriptionFunctionWithValidation**\<`ServiceClassType`, `MessagePayloadType`, `MessageParamsType`, `MessageResultType`, `FunctionPayloadType`, `FunctionParamsType`, `FunctionResultType`, `Invokes`, `EmitListType`\>(`fn`, `inputPayloadSchema`, `inputParameterSchema`, `outputPayloadSchema`, `beforeGuards?`): [`SubscriptionFunction`](purista_core.md#subscriptionfunction)\<`ServiceClassType`, `MessagePayloadType`, `MessageParamsType`, `FunctionPayloadType`, `FunctionParamsType`, `FunctionResultType`, `Invokes`, `EmitListType`\>

#### Type parameters

| Name | Type |
| :------ | :------ |
| `ServiceClassType` | extends [`ServiceClass`](../interfaces/purista_core.ServiceClass.md)\<`unknown`\> |
| `MessagePayloadType` | `unknown` |
| `MessageParamsType` | `unknown` |
| `MessageResultType` | `unknown` |
| `FunctionPayloadType` | `MessagePayloadType` |
| `FunctionParamsType` | `MessageParamsType` |
| `FunctionResultType` | `MessageResultType` |
| `Invokes` | {} |
| `EmitListType` | {} |

#### Parameters

| Name | Type |
| :------ | :------ |
| `fn` | [`SubscriptionFunction`](purista_core.md#subscriptionfunction)\<`ServiceClassType`, `MessagePayloadType`, `MessageParamsType`, `FunctionPayloadType`, `FunctionParamsType`, `FunctionResultType`, `Invokes`, `EmitListType`\> |
| `inputPayloadSchema` | `undefined` \| `Schema`\<`any`, `any`, `any`, ``""``\> \| `ZodType`\<`any`, `ZodTypeDef`, `any`\> |
| `inputParameterSchema` | `undefined` \| `Schema`\<`any`, `any`, `any`, ``""``\> \| `ZodType`\<`any`, `ZodTypeDef`, `any`\> |
| `outputPayloadSchema` | `undefined` \| `Schema`\<`any`, `any`, `any`, ``""``\> \| `ZodType`\<`any`, `ZodTypeDef`, `any`\> |
| `beforeGuards` | `Record`\<`string`, [`SubscriptionBeforeGuardHook`](purista_core.md#subscriptionbeforeguardhook)\<`ServiceClassType`, `FunctionPayloadType`, `FunctionParamsType`, `Invokes`, `EmitListType`\>\> |

#### Returns

[`SubscriptionFunction`](purista_core.md#subscriptionfunction)\<`ServiceClassType`, `MessagePayloadType`, `MessageParamsType`, `FunctionPayloadType`, `FunctionParamsType`, `FunctionResultType`, `Invokes`, `EmitListType`\>

#### Defined in

[SubscriptionDefinitionBuilder/getSubscriptionFunctionWithValidation.impl.ts:8](https://github.com/puristajs/purista/blob/master/packages/core/src/SubscriptionDefinitionBuilder/getSubscriptionFunctionWithValidation.impl.ts#L8)

___

### getTimeoutPromise

▸ **getTimeoutPromise**\<`T`\>(`fn`, `ttl?`): `Promise`\<`T`\>

#### Type parameters

| Name |
| :------ |
| `T` |

#### Parameters

| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
| `fn` | `Promise`\<`T`\> | `undefined` | the promise which should get a timeout |
| `ttl` | `number` | `30000` | the timeout in ms |

#### Returns

`Promise`\<`T`\>

**`Default`**

```ts
30000

Defined in

helper/getTimeoutPromise.impl.ts:9


initDefaultConfigStore

initDefaultConfigStore(options): DefaultConfigStore

Parameters

NameType
optionsObject
options.loggerLogger

Returns

DefaultConfigStore

Defined in

DefaultConfigStore/initDefaultConfigStore.impl.ts:4


initDefaultSecretStore

initDefaultSecretStore(options): DefaultSecretStore

Parameters

NameType
optionsObject
options.loggerLogger

Returns

DefaultSecretStore

Defined in

DefaultSecretStore/initDefaultSecretStore.impl.ts:4


initDefaultStateStore

initDefaultStateStore(options): DefaultStateStore

Parameters

NameType
optionsObject
options.loggerLogger

Returns

DefaultStateStore

Defined in

DefaultStateStore/initDefaultStateStore.impl.ts:4


initLogger

initLogger(level?, opt?): Logger

Create a new logger with the given minimum log level

Parameters

NameType
levelLogLevelName
opt?LoggerOptions<never>

Returns

Logger

Defined in

DefaultLogger/initLogger.impl.ts:14


isCustomMessage

isCustomMessage(message): message is Object

Checks if a PURISTA message is type of custom message

Parameters

NameTypeDescription
messageEBMessageany PURISTA message

Returns

message is Object

true if message is type of custom message

Defined in

core/types/isCustomMessage.impl.ts:10


isHttpExposedServiceMeta

isHttpExposedServiceMeta(input?): input is Object

Checks if given input is type of HttpExposedServiceMeta

Parameters

NameType
input?any

Returns

input is Object

boolean - true if input is type of HttpExposedServiceMeta

Defined in

core/HttpServer/types/isHttpExposedServiceMeta.impl.ts:8


isInfoMessage

isInfoMessage(message): message is InfoMessage

Parameters

NameType
messageEBMessage

Returns

message is InfoMessage

Defined in

core/types/infoType/isInfoMessage.impl.ts:5


isInfoServiceFunctionAdded

isInfoServiceFunctionAdded(message): message is Object

Parameters

NameType
messageEBMessage

Returns

message is Object

Defined in

core/types/infoType/isInfoServiceFunctionAdded.impl.ts:5


isMessageMatchingSubscription

isMessageMatchingSubscription(_log, message, subscription): boolean

Parameters

NameType
_logLogger
messageEBMessage
subscriptionSubscriptionStorageEntry

Returns

boolean

Defined in

DefaultEventBridge/isMessageMatchingSubscription.impl.ts:5


safeBind

safeBind<T>(fn, thisArg): (...args: Parameters<T>) => ReturnType<T>

Bind this argument like regular .bind(thisArg), but keeps the typescript types in result

Type parameters

NameType
Textends (...args: any) => any

Parameters

NameTypeDescription
fnTThe function
thisArgSafeThisParameterType<T>-

Returns

fn

▸ (...args): ReturnType<T>

Parameters
NameType
...argsParameters<T>
Returns

ReturnType<T>

Example

typescript
const functionWithThisSet = safeBind(fn, thisParam)

Defined in

helper/safeBind.impl.ts:19


throwIfNotValidMessage

throwIfNotValidMessage(input): void

Validates if the given input might be valid event bridge message It only checks for "technically possible"

Parameters

NameType
inputunknown

Returns

void

Defined in

helper/throwIfNotValidMessage.impl.ts:10


validationToSchema

validationToSchema<T>(schema?): Promise<undefined | SchemaObject>

Type parameters

NameType
Textends Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any>

Parameters

NameType
schema?T

Returns

Promise<undefined | SchemaObject>

Defined in

zodOpenApi/validationToSchema.ts:9

Command

CommandDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>: Object

Command definition builder is a helper to create and define a command for a service. It helps to set all needed information like schemas and hooks. With these information, the types are automatically set and extended.

A working schema definition needs at least a command name, a short description and the function implementation.

Type parameters

NameType
ServiceClassTypeextends ServiceClass
MessagePayloadTypeunknown
MessageParamsType{}
MessageResultTypevoid
PayloadSchemaextends Schema = ZodAny
ParameterSchemaextends Schema = ZodAny
ResultSchemaextends Schema = ZodAny
Invokes{}
EmitListType{}

Defined in

CommandDefinitionBuilder/CommandDefinitionBuilder.impl.ts:38

CommandAfterGuardHook

Ƭ CommandAfterGuardHook<ServiceClassType, MessagePayloadType, MessageParamsType, FunctionResultType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>: (this: ServiceClassType, context: CommandFunctionContext<MessagePayloadType, MessageParamsType, Invokes, EmitListType>, result: Readonly<FunctionResultType>, input: Readonly<FunctionPayloadType>, parameter: Readonly<FunctionParamsType>) => Promise<void>

Definition of after guard hook functions. This guard is called after function successfully returns and after output validation.

Type parameters

NameType
ServiceClassTypeServiceClass
MessagePayloadTypeunknown
MessageParamsTypeunknown
FunctionResultTypeunknown
FunctionPayloadTypeunknown
FunctionParamsTypeunknown
Invokes{}
EmitListType{}

Type declaration

▸ (this, context, result, input, parameter): Promise<void>

Parameters
NameType
thisServiceClassType
contextCommandFunctionContext<MessagePayloadType, MessageParamsType, Invokes, EmitListType>
resultReadonly<FunctionResultType>
inputReadonly<FunctionPayloadType>
parameterReadonly<FunctionParamsType>
Returns

Promise<void>

Defined in

core/types/commandType/CommandAfterGuardHook.ts:10


CommandBeforeGuardHook

Ƭ CommandBeforeGuardHook<ServiceClassType, MessagePayloadType, MessageParamsType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>: (this: ServiceClassType, context: CommandFunctionContext<MessagePayloadType, MessageParamsType, Invokes, EmitListType>, payload: Readonly<FunctionPayloadType>, parameter: Readonly<FunctionParamsType>) => Promise<void>

Guard is called after command function input validation and before executing the command function. The guard is usefull to separate for example auth checks from business logic. It should throw HandledError or return void.

Type parameters

NameType
ServiceClassTypeServiceClass
MessagePayloadTypeunknown
MessageParamsTypeunknown
FunctionPayloadTypeMessagePayloadType
FunctionParamsTypeMessageParamsType
Invokes{}
EmitListType{}

Type declaration

▸ (this, context, payload, parameter): Promise<void>

Parameters
NameType
thisServiceClassType
contextCommandFunctionContext<MessagePayloadType, MessageParamsType, Invokes, EmitListType>
payloadReadonly<FunctionPayloadType>
parameterReadonly<FunctionParamsType>
Returns

Promise<void>

Defined in

core/types/commandType/CommandBeforeGuardHook.ts:11


CommandDefinition

Ƭ CommandDefinition<ServiceClassType, MetadataType, MessagePayloadType, MessageParamsType, MessageResultType, FunctionPayloadType, FunctionParamsType, FunctionResultType, Invokes, EmitListType>: Object

The definition for a command provided by some service.

Type parameters

NameType
ServiceClassTypeextends ServiceClass = ServiceClass
MetadataTypeCommandDefinitionMetadataBase
MessagePayloadTypeunknown
MessageParamsTypeunknown
MessageResultTypeunknown
FunctionPayloadTypeMessagePayloadType
FunctionParamsTypeMessageParamsType
FunctionResultTypeunknown
Invokes{}
EmitListType{}

Type declaration

NameTypeDescription
callCommandFunction<ServiceClassType, MessagePayloadType, MessageParamsType, FunctionPayloadType, FunctionParamsType, FunctionResultType, Invokes, EmitListType>the command function
commandDescriptionstringthe description of the command
commandNamestringthe name of the command
emitListEmitListType-
eventBridgeConfigDefinitionEventBridgeConfigconfig information for event bridge
eventName?stringthe eventName for the command response
hooks{ afterGuard?: Record<string, CommandAfterGuardHook<ServiceClassType, MessagePayloadType, MessageParamsType, FunctionResultType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>> ; beforeGuard?: Record<string, CommandBeforeGuardHook<ServiceClassType, MessagePayloadType, MessageParamsType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>> ; transformInput?: { transformFunction: CommandTransformInputHook<ServiceClassType, MessagePayloadType, MessageParamsType> ; transformInputSchema: Schema ; transformParameterSchema: Schema } ; transformOutput?: { transformFunction: CommandTransformOutputHook<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, FunctionResultType, FunctionParamsType> ; transformOutputSchema: Schema } }hooks of command
hooks.afterGuard?Record<string, CommandAfterGuardHook<ServiceClassType, MessagePayloadType, MessageParamsType, FunctionResultType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>>-
hooks.beforeGuard?Record<string, CommandBeforeGuardHook<ServiceClassType, MessagePayloadType, MessageParamsType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>>-
hooks.transformInput?{ transformFunction: CommandTransformInputHook<ServiceClassType, MessagePayloadType, MessageParamsType> ; transformInputSchema: Schema ; transformParameterSchema: Schema }-
hooks.transformInput.transformFunctionCommandTransformInputHook<ServiceClassType, MessagePayloadType, MessageParamsType>-
hooks.transformInput.transformInputSchemaSchema-
hooks.transformInput.transformParameterSchemaSchema-
hooks.transformOutput?{ transformFunction: CommandTransformOutputHook<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, FunctionResultType, FunctionParamsType> ; transformOutputSchema: Schema }-
hooks.transformOutput.transformFunctionCommandTransformOutputHook<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, FunctionResultType, FunctionParamsType>-
hooks.transformOutput.transformOutputSchemaSchema-
invokesFromInvokeToOtherType<Invokes, { outputSchema?: Schema ; parameterSchema?: Schema ; payloadSchema?: Schema }>-
metadataMetadataTypethe metadata of the command

Defined in

core/types/commandType/CommandDefinition.ts:18


CommandErrorResponse

Ƭ CommandErrorResponse: Prettify<{ contentEncoding: "utf-8" ; contentType: "application/json" ; correlationId: CorrelationId ; isHandledError: boolean ; messageType: CommandErrorResponse ; payload: { data?: unknown ; message: string ; status: StatusCode } ; receiver: EBMessageSenderAddress } & EBMessageBase>

CommandErrorResponse is a response to a specific previously received command which indicates some failure.

Defined in

core/types/commandType/CommandErrorResponse.ts:13


CommandFunction

Ƭ CommandFunction<ServiceClassType, MessagePayloadType, MessageParamsType, FunctionPayloadType, FunctionParamsType, FunctionResultType, Invokes, EmitListType>: (this: ServiceClassType, context: CommandFunctionContext<MessagePayloadType, MessageParamsType, Invokes, EmitListType>, payload: Readonly<FunctionPayloadType>, parameter: Readonly<FunctionParamsType>) => Promise<FunctionResultType>

CommandFunction is a function which will be triggered when a matching event bridge message is received by the service

Type parameters

NameType
ServiceClassTypeextends ServiceClass
MessagePayloadTypeunknown
MessageParamsTypeunknown
FunctionPayloadTypeMessagePayloadType
FunctionParamsTypeMessageParamsType
FunctionResultTypeunknown
Invokes{}
EmitListType{}

Type declaration

▸ (this, context, payload, parameter): Promise<FunctionResultType>

Parameters
NameType
thisServiceClassType
contextCommandFunctionContext<MessagePayloadType, MessageParamsType, Invokes, EmitListType>
payloadReadonly<FunctionPayloadType>
parameterReadonly<FunctionParamsType>
Returns

Promise<FunctionResultType>

Defined in

core/types/commandType/CommandFunction.ts:9


CommandFunctionContext

Ƭ CommandFunctionContext<MessagePayloadType, MessageParamsType, Invokes, EmitListType>: Prettify<ContextBase & CommandFunctionContextEnhancements<MessagePayloadType, MessageParamsType, Invokes, EmitListType>>

The command function context which will be passed into command function.

Type parameters

NameType
MessagePayloadTypeunknown
MessageParamsTypeunknown
Invokes{}
EmitListType{}

Defined in

core/types/commandType/CommandFunctionContext.ts:72


CommandFunctionContextEnhancements

Ƭ CommandFunctionContextEnhancements<MessagePayloadType, MessageParamsType, Invokes, EmitListType>: Object

It provides the original command message with types for payload and parameter. Also, the methods:

  • emit which allows to emit custom events to the event bridge
  • invoke which allows to call other commands

Type parameters

NameType
MessagePayloadTypeunknown
MessageParamsTypeunknown
Invokes{}
EmitListType{}

Type declaration

NameTypeDescription
emitEmitCustomMessageFunction<EmitListType>emit a custom message
invokeInvokeFunctionDeprecated Please use service instead and define the invocations with canInvoke in command builder. Invokes a command and returns the result. It is recommended to validate the result against a schema which only contains the data you actually need. Example typescript const address: EBMessageAddress = { serviceName: 'name-of-service-to-invoke', serviceVersion: '1', serviceTarget: 'command-name-to-invoke', } const inputPayload = { my: 'input' } const inputParameter = { search: 'for_me' } const result = await invoke<MyResultType>(address, inputPayload inputParameter )
messageReadonly<Command<MessagePayloadType, MessageParamsType>>the original message
serviceInvokesInvokes a command and returns the result. It is recommended to validate the result against a schema which only contains the data you actually need. Example typescript // define your invocation in command builder .canInvoke('ServiceA', '1', 'test', responseOutputSchema, payloadSchema, parameterSchema) .setCommandFunction(async function (context, payload, _parameter) { const inputPayload = { my: 'input' } const inputParameter = { search: 'for_me' } const result = await context.service.ServiceA[1].test(inputPayload,inputParameter) })

Defined in

core/types/commandType/CommandFunctionContext.ts:16


CommandResponse

Ƭ CommandResponse<T>: CommandSuccessResponse<T> | CommandErrorResponse

CommandResponse is a response to a specific previously received command which can be either a success or failure

Type parameters

NameType
Tunknown

Defined in

core/types/commandType/CommandResponse.ts:9


CommandSuccessResponse

Ƭ CommandSuccessResponse<PayloadType>: Prettify<{ correlationId: CorrelationId ; messageType: CommandSuccessResponse ; payload: PayloadType ; receiver: EBMessageSenderAddress } & EBMessageBase>

CommandSuccessResponse is a response to a specific previously received command. It indicates that the command was executed successfully and contains the result payload

Type parameters

NameType
PayloadTypeunknown

Defined in

core/types/commandType/CommandSuccessResponse.ts:13


CommandTransformFunctionContext

Ƭ CommandTransformFunctionContext<PayloadType, ParameterType>: Prettify<ContextBase & { message: Readonly<Command<PayloadType, ParameterType>> }>

Type parameters

Name
PayloadType
ParameterType

Defined in

core/types/commandType/CommandTransformFunctionContext.ts:8


CommandTransformInputHook

Ƭ CommandTransformInputHook<ServiceClassType, FunctionPayloadOutput, FunctionParamsOutput, MessagePayloadInput, MessageParamsInput>: (this: ServiceClassType, context: CommandTransformFunctionContext<MessagePayloadInput, MessageParamsInput>, payload: Readonly<MessagePayloadInput>, parameter: Readonly<MessageParamsInput>) => Promise<{ parameter: Readonly<FunctionParamsOutput> ; payload: Readonly<FunctionPayloadOutput> }>

The command transform gets the raw message payload and parameter input, which is validated against the transform input schemas. The command transform function is called before guard hooks and before the actual command function.

It should throw HandledError or return an object with the transformed payload and parameter. The type of returned payload and parameter must match the command function input for payload and parameter

Type parameters

NameType
ServiceClassTypeServiceClassType
FunctionPayloadOutputunknown
FunctionParamsOutputunknown
MessagePayloadInputunknown
MessageParamsInputunknown

Type declaration

▸ (this, context, payload, parameter): Promise<{ parameter: Readonly<FunctionParamsOutput> ; payload: Readonly<FunctionPayloadOutput> }>

Parameters
NameType
thisServiceClassType
contextCommandTransformFunctionContext<MessagePayloadInput, MessageParamsInput>
payloadReadonly<MessagePayloadInput>
parameterReadonly<MessageParamsInput>
Returns

Promise<{ parameter: Readonly<FunctionParamsOutput> ; payload: Readonly<FunctionPayloadOutput> }>

Defined in

core/types/commandType/CommandTransformInputHook.ts:12


CommandTransformOutputHook

Ƭ CommandTransformOutputHook<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, FunctionResultType, FunctionParamsType>: (this: ServiceClassType, context: CommandTransformFunctionContext<MessagePayloadType, MessageParamsType>, commandFunctionOutput: Readonly<FunctionResultType>, commandFunctionInputParameter: Readonly<FunctionParamsType>) => Promise<MessageResultType>

This transform hook is executed after function output validation and AfterGuardHooks.

Type parameters

Name
ServiceClassType
MessagePayloadType
MessageParamsType
MessageResultType
FunctionResultType
FunctionParamsType

Type declaration

▸ (this, context, commandFunctionOutput, commandFunctionInputParameter): Promise<MessageResultType>

Parameters
NameTypeDescription
thisServiceClassType-
contextCommandTransformFunctionContext<MessagePayloadType, MessageParamsType>the Context
commandFunctionOutputReadonly<FunctionResultType>The output result output of command function
commandFunctionInputParameterReadonly<FunctionParamsType>The parameter input given to command function
Returns

Promise<MessageResultType>

Defined in

core/types/commandType/CommandTransformOutputHook.ts:13


isCommand

isCommand(message): message is Object

Checks if given message is type of Command

Parameters

NameType
messageEBMessage

Returns

message is Object

boolean

Defined in

core/types/commandType/isCommand.impl.ts:12


isCommandErrorResponse

isCommandErrorResponse(message): message is Object

Checks if given message is type of CommandErrorResponse

Parameters

NameType
messageunknown

Returns

message is Object

boolean

Defined in

core/types/commandType/isCommandErrorResponse.impl.ts:12


isCommandResponse

isCommandResponse(message): message is CommandResponse

Checks if given message is type of CommandResponse (success or error)

Parameters

NameType
messageEBMessage

Returns

message is CommandResponse

boolean

Defined in

core/types/commandType/isCommandResponse.impl.ts:12


isCommandSuccessResponse

isCommandSuccessResponse(message): message is Object

Checks if given message is type of CommandSuccessResponse

Parameters

NameType
messageEBMessage

Returns

message is Object

boolean

Defined in

core/types/commandType/isCommandSuccessResponse.impl.ts:12

Event bridge

DefaultEventBridge: Object

Simple implementation of some simple in-memory event bridge. Does not support threads and does not need any external databases.

Example

typescript
import { DefaultEventBridge } from '@purista/core'

const eventBridge = new DefaultEventBridge()
await eventBridge.start()

// add your services

Defined in

DefaultEventBridge/DefaultEventBridge.impl.ts:63

EventBridgeBaseClass<ConfigType>: Object

The base class to be extended by event bridge implementations

Type parameters

Name
ConfigType

Defined in

core/EventBridge/EventBridgeBaseClass.impl.ts:19

EventBridge: Object

Event bridge interface The event bridge must implement this interface.

Defined in

core/EventBridge/types/EventBridge.ts:19

EventBridgeEventsBasic

Ƭ EventBridgeEventsBasic: Object

Events which can be emitted by a event bridge

Type declaration

NameTypeDescription
eventbridge-connectedneveremitted when then connection to event bridge is established
eventbridge-connection-errorundefined | unknown | Erroremitted when the connection to event bridge can not be established or a connection has issues or gets closed unexpectedly
eventbridge-disconnectedneveremitted when the connection to event bridge closed
eventbridge-errorUnhandledError | unknownemitted on internal event bridge error
eventbridge-reconnectingneveremitted on retry to connect to event bridge

Defined in

core/EventBridge/types/EventBridgeEvents.ts:20


getCommandQueueName

getCommandQueueName(address): string

Parameters

NameType
addressEBMessageAddress

Returns

string

Defined in

core/helper/getCommandQueueName.impl.ts:10

Helper

convertToCamelCase

convertToCamelCase(str): string

Converts a string into camelCase

Parameters

NameTypeDescription
strstringstring

Returns

string

string converted to camelCase

Link

https://github.com/30-seconds/30-seconds-of-code

Defined in

helper/string/convertToCamelCase.impl.ts:9


convertToKebabCase

convertToKebabCase(str): string

Converts a string into kebab-case

Parameters

NameTypeDescription
strstringstring

Returns

string

string converted to kebab-case

Link

https://github.com/30-seconds/30-seconds-of-code

Defined in

helper/string/convertToKebabCase.impl.ts:9


convertToPascalCase

convertToPascalCase(str): string

Converts a string into PascalCase

Parameters

NameTypeDescription
strstringstring

Returns

string

string converted to PascalCase

Link

https://github.com/30-seconds/30-seconds-of-code

Defined in

helper/string/convertToPascalCase.impl.ts:9


convertToSnakeCase

convertToSnakeCase(str): string

Converts a string into snake_case

Parameters

NameTypeDescription
strstringstring

Returns

string

string converted to snake_case

Link

https://github.com/30-seconds/30-seconds-of-code

Defined in

helper/string/convertToSnakeCase.impl.ts:9


createErrorResponse

createErrorResponse(instanceId, originalEBMessage, statusCode?, error?): Readonly<Omit<{ contentEncoding: "utf-8" ; contentType: "application/json" ; correlationId: string ; eventName?: string ; id: string ; isHandledError: boolean ; messageType: CommandErrorResponse ; otp?: string ; payload: { data?: unknown ; message: string ; status: StatusCode } ; principalId?: string ; receiver: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }, "instanceId">>

Creates a error response object based on original command Toggles sender and receiver

Parameters

NameTypeDefault value
instanceIdstringundefined
originalEBMessageReadonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: Command ; otp?: string ; payload: { parameter: unknown ; payload: unknown } ; principalId?: string ; receiver: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>undefined
statusCodeStatusCodeStatusCode.InternalServerError
error?unknownundefined

Returns

Readonly<Omit<{ contentEncoding: "utf-8" ; contentType: "application/json" ; correlationId: string ; eventName?: string ; id: string ; isHandledError: boolean ; messageType: CommandErrorResponse ; otp?: string ; payload: { data?: unknown ; message: string ; status: StatusCode } ; principalId?: string ; receiver: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }, "instanceId">>

CommandErrorResponse message object

Defined in

core/helper/createErrorResponse.impl.ts:19


createInfoMessage

createInfoMessage(messageType, sender, additional?): InfoMessage

Parameters

NameTypeDescription
messageTypeInfoMessageType-
senderObject-
sender.instanceIdstringinstance id of eventbridge
sender.serviceNamestringthe name of the service
sender.serviceTargetstringthe name of the command or subscription
sender.serviceVersionstringthe version of the service
additional?Partial<InfoMessage>-

Returns

InfoMessage

Defined in

core/helper/createInfoMessage.impl.ts:14


createSuccessResponse

createSuccessResponse<T>(instanceId, originalEBMessage, payload, eventName?, contentType?, contentEncoding?): Readonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: CommandSuccessResponse ; otp?: string ; payload: T ; principalId?: string ; receiver: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

Type parameters

Name
T

Parameters

NameTypeDefault value
instanceIdstringundefined
originalEBMessageReadonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: Command ; otp?: string ; payload: { parameter: unknown ; payload: unknown } ; principalId?: string ; receiver: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>undefined
payloadTundefined
eventName?stringundefined
contentTypestring'application/json'
contentEncodingstring'utf-8'

Returns

Readonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: CommandSuccessResponse ; otp?: string ; payload: T ; principalId?: string ; receiver: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

Defined in

core/helper/createSuccessResponse.impl.ts:16


deserializeOtp

deserializeOtp(logger, otp?): undefined | Context

Parameters

NameType
loggerLogger
otp?string

Returns

undefined | Context

Defined in

core/helper/serializeOtp.impl.ts:26


getCleanedMessage

getCleanedMessage(message, stripeOutContent?): Record<string, unknown>

Helper function for logging. Returns a message object, where fields which might contain sensitive data, are overwritten with string values. For command messages, parameter and payload are overwritten with string values.

For command success responses, the response field is overwritten.

Command error responses are not changed.

Parameters

NameTypeDefault value
messageReadonly<EBMessage>undefined
stripeOutContentboolean!isDevelop()

Returns

Record<string, unknown>

Defined in

core/helper/getCleanedMessage.impl.ts:16


getErrorMessageForCode

getErrorMessageForCode(code): string

Parameters

NameType
codeStatusCode

Returns

string

Defined in

core/helper/getErrorMessageForCode.impl.ts:10


getNewCorrelationId

getNewCorrelationId(): string

Create a new unique event bridge correlation id

Returns

string

EBMessageId

Defined in

core/helper/getNewCorrelationId.impl.ts:10


getNewEBMessageId

getNewEBMessageId(): string

Create a new unique event bridge message id

Returns

string

EBMessageId

Defined in

core/helper/getNewEBMessageId.impl.ts:11


getNewInstanceId

getNewInstanceId(): string

Returns

string

Defined in

core/helper/getNewInstanceId.impl.ts:9


getNewTraceId

getNewTraceId(): string

Returns

string

Defined in

core/helper/getNewTraceId.impl.ts:9


getSubscriptionQueueName

getSubscriptionQueueName(address): string

Parameters

NameType
addressEBMessageAddress

Returns

string

Defined in

core/helper/getSubscriptionQueueName.impl.ts:10


getUniqueId

getUniqueId(): string

Returns

string

Defined in

core/helper/getUniqueId.impl.ts:11


gracefulShutdown

gracefulShutdown(logger, list, timeoutMs?): void

Helps to gracefully shut down your application. Provide in list objects. The objects contains a name and a promise function which should be executed.

The execution of array list functions is done sequential.

Parameters

NameTypeDefault valueDescription
loggerLoggerundefinedthe logger object
listShutdownEntry[]undefineda object containing name and function
timeoutMsnumber30000in ms to shut

Returns

void

Example

typescript
const shutDownList = [
 {
   name: `${serviceA.info.serviceName} version ${serviceA.info.serviceVersion}`,
   fn: serviceA.destroy
 },
 {
   name: `${serviceB.info.serviceName} version ${serviceB.info.serviceVersion}`,
   fn: serviceB.destroy
 },
{
   name: eventbridge.name,
   fn: eventbridge.destroy
 }
]
gracefulShutdown(logger, shutDownList)

// will shutdown ServiceA, then ServiceB, then the event bridge

Default

ts
30000 milliseconds

Defined in

helper/gracefulShutdown.impl.ts:37


isDevelop

isDevelop(): boolean

returns true if NODE_ENV is set to value starting with "develop"

Returns

boolean

Defined in

core/helper/isDevelop.impl.ts:6


serializeOtp

serializeOtp(): string

Returns

string

Defined in

core/helper/serializeOtp.impl.ts:11

Service

ServiceEventsNames: Object

Events which can be emitted by a service. Internal events are prefixed with service-

Defined in

core/types/ServiceEvents.ts:11

Service<ConfigType>: Object

Base class for all services. This class provides base functions to work with the event bridge, logging and so on

Every service should extend this class and should not directly access the eventbridge or other service

typescript
class MyService extends Service {

  async start() {
    await super.start()
    // your custom implementation
  }

  async destroy() {
    // your custom implementation
   await super.destroy()
  }
}

Type parameters

NameType
ConfigTypeunknown

Defined in

core/Service/Service.impl.ts:81

ServiceBuilder<ConfigType, ConfigInputType, ServiceClassType>: Object

This class is used to build a service. The ServiceBuilder class is used to build a service. It has a few methods that are used to add command definitions and subscription definitions to the service. It also has a method that is used to create an instance of the service class.

Type parameters

NameType
ConfigTypeRecord<string, unknown>
ConfigInputTypeRecord<string, unknown>
ServiceClassTypeextends ServiceClass = Service<ConfigType>

Defined in

ServiceBuilder/ServiceBuilder.impl.ts:40

ServiceClass<ConfigType>: Object

The ServiceClass interface

Type parameters

NameType
ConfigTypeunknown | undefined

Defined in

core/types/ServiceClass.ts:11

ServiceConstructorInput

Ƭ ServiceConstructorInput<ConfigType>: Object

Type parameters

Name
ConfigType

Type declaration

NameTypeDescription
commandDefinitionListCommandDefinitionListResolved<any>The list of command definitions for this service
configConfigTypeThe service specific config
configSchema?SchemaThe config validation schema
configStore?ConfigStoreThe config store instance
eventBridgeEventBridgeThe eventBridge instance
infoServiceInfoTypeThe service info with name, version and description of service
loggerLoggerA logger instance
secretStore?SecretStoreThe secret store instance
spanProcessor?SpanProcessorThe opentelemetry span processor instance
stateStore?StateStorethe state store instance
subscriptionDefinitionListSubscriptionDefinitionListResolved<any>The list of subscription definitions for this service

Defined in

core/types/ServiceConstructorInput.ts:16


ServiceEventsInternal

Ƭ ServiceEventsInternal: Object

Events which can be emitted by a service. Internal events are prefixed with service-.

Response messages, which have an event name assigned, are prefixed with custom- If you like to use your own events, the event name must be prefixed with misc-.

Type declaration

NameTypeDescription
service-availableundefinedemitted when the service is fully initialized and ready Should be emitted by custom service class. It is not emitted by default
service-drainundefinedemitted when the service is going to be stopped
service-handled-command-error{ commandName: string ; error: HandledError ; traceId?: TraceId }emitted when a command throws a HandledError
service-handled-command-error.commandNamestring-
service-handled-command-error.errorHandledError-
service-handled-command-error.traceId?TraceId-
service-handled-subscription-error{ error: HandledError ; subscriptionName: string ; traceId?: TraceId }emitted when a subscription throws a HandledError
service-handled-subscription-error.errorHandledError-
service-handled-subscription-error.subscriptionNamestring-
service-handled-subscription-error.traceId?TraceId-
service-not-availableundefined | unknownemitted when the service is not available (for example database connection could not be established)
service-startedundefinedemitted when the service is started, but not fully initialized and not ready yet
service-stoppedundefinedemitted when the service has been stopped
service-unhandled-command-error{ commandName: string ; error: unknown ; traceId?: TraceId }emitted when a command throws an error other than a HandledError
service-unhandled-command-error.commandNamestring-
service-unhandled-command-error.errorunknown-
service-unhandled-command-error.traceId?TraceId-
service-unhandled-subscription-error{ error: unknown ; subscriptionName: string ; traceId?: TraceId }emitted when a subscription throws an error other than a HandledError
service-unhandled-subscription-error.errorunknown-
service-unhandled-subscription-error.subscriptionNamestring-
service-unhandled-subscription-error.traceId?TraceId-

Defined in

core/types/ServiceEvents.ts:54

Store

Abstract ConfigStoreBaseClass<ConfigStoreConfigType>: Object

Base class for config store adapters. The actual store implementation must overwrite the protected methods:

  • getConfigImpl
  • setConfigImpl
  • removeConfigImpl

DO NOT OVERWRITE: the regular methods getConfig, setConfig or removeConfig

Type parameters

NameType
ConfigStoreConfigTypeextends Record<string, unknown> = {}

Defined in

core/ConfigStore/ConfigStoreBaseClass.impl.ts:20

DefaultConfigStore: Object

The DefaultConfigStore is a placeholder which offers all needed methods. Getters and setters will throw a UnhandledError with status Unauthorized, when a disabled operation is called.

For development and testing purpose, you can initiate the store with values.

Example

typescript
const store = new DefaultConfigStore({
   enableGet: true,
   enableRemove: true,
   enableSet: true,
   config: {
     initialValue: 'initial',
   },
})

console.log(await store.getConfig('initialValue') // outputs: { initialValue: 'initial' }

Defined in

DefaultConfigStore/DefaultConfigStore.impl.ts:28

DefaultSecretStore: Object

The DefaultSecretStore is a placeholder which offers all needed methods. Getters and setters will throw a UnhandledError with status Unauthorized, when a disabled operation is called.

For development and testing purpose, you can initiate the store with values.

Example

typescript
const store = new DefaultSecretStore({
 config: {
   secretOne: 'my_secret_one_value',
   secretTwo: 'my_secret_two_value',
 }
})
console.log(await store.getSecret('secretOne', 'secretTwo) // outputs: { secretOne: my_secret_one_value, secretTwo: 'my_secret_two_value' }

Per default, setting/changing and removal of values are disabled. You can enable it on instance creation:

Example

typescript
const store = new DefaultSecretStore({
 enableGet: true,
 enableRemove: true,
 enableSet: true,
})

Defined in

DefaultSecretStore/DefaultSecretStore.impl.ts:37

DefaultStateStore: Object

The DefaultStateStore is a placeholder which offers all needed methods. Getters and setters will throw a UnhandledError with status Not implemented

Defined in

DefaultStateStore/DefaultStateStore.impl.ts:13

Abstract SecretStoreBaseClass<SecretStoreConfigType>: Object

Base class for secret store adapters The actual store implementation must overwrite the protected methods:

  • getSecretImpl
  • setSecretImpl
  • removeSecretImpl

DO NOT OVERWRITE: the regular methods getSecret, setSecret or removeSecret

Type parameters

NameType
SecretStoreConfigTypeextends Record<string, unknown> = {}

Defined in

core/SecretStore/SecretStoreBaseClass.impl.ts:20

Abstract StateStoreBaseClass<StateStoreConfigType>: Object

Base class for config store implementations The actual store implementation must overwrite the protected methods:

  • getStateImpl
  • setStateImpl
  • removeStateImpl

DO NOT OVERWRITE: the regular methods getState, setState or removeState

Type parameters

NameType
StateStoreConfigTypeextends Record<string, unknown> = {}

Defined in

core/StateStore/StateStoreBaseClass.impl.ts:18

ConfigStore: Object

Interface definition for config store adapters

Defined in

core/ConfigStore/types/ConfigStore.ts:10

SecretStore: Object

Interface definition for a secret store implementation

Defined in

core/SecretStore/types/SecretStore.ts:9

StateStore: Object

Interface definition for state store implementations

Defined in

core/StateStore/types/StateStore.ts:10

ConfigDeleteFunction

Ƭ ConfigDeleteFunction: (configName: string) => Promise<void>

delete a config value from the config store

Type declaration

▸ (configName): Promise<void>

Parameters
NameType
configNamestring
Returns

Promise<void>

Defined in

core/ConfigStore/types/ConfigDeleteFunction.ts:2


ConfigGetterFunction

Ƭ ConfigGetterFunction: <ConfigNames>(...configNames: ConfigNames) => Promise<ObjectWithKeysFromStringArray<ConfigNames>>

get a config value from the config store

Type declaration

▸ <ConfigNames>(...configNames): Promise<ObjectWithKeysFromStringArray<ConfigNames>>

Type parameters
NameType
ConfigNamesextends string[]
Parameters
NameType
...configNamesConfigNames
Returns

Promise<ObjectWithKeysFromStringArray<ConfigNames>>

Defined in

core/ConfigStore/types/ConfigGetterFunction.ts:4


ConfigSetterFunction

Ƭ ConfigSetterFunction: (configName: string, configValue: unknown) => Promise<void>

set a config value in the config store

Type declaration

▸ (configName, configValue): Promise<void>

Parameters
NameType
configNamestring
configValueunknown
Returns

Promise<void>

Defined in

core/ConfigStore/types/ConfigSetterFunction.ts:2


SecretDeleteFunction

Ƭ SecretDeleteFunction: (secretName: string) => Promise<void>

delete a secret from the secret store

Type declaration

▸ (secretName): Promise<void>

Parameters
NameType
secretNamestring
Returns

Promise<void>

Defined in

core/SecretStore/types/SecretDeleteFunction.ts:2


SecretGetterFunction

Ƭ SecretGetterFunction: <SecretNames>(...secretNames: SecretNames) => Promise<ObjectWithKeysFromStringArray<SecretNames, string | undefined>>

get a secret from the secret store

Type declaration

▸ <SecretNames>(...secretNames): Promise<ObjectWithKeysFromStringArray<SecretNames, string | undefined>>

Type parameters
NameType
SecretNamesextends string[]
Parameters
NameType
...secretNamesSecretNames
Returns

Promise<ObjectWithKeysFromStringArray<SecretNames, string | undefined>>

Defined in

core/SecretStore/types/SecretGetterFunction.ts:4


SecretSetterFunction

Ƭ SecretSetterFunction: (secretName: string, secretValue: string) => Promise<void>

set a secret in the secret store

Type declaration

▸ (secretName, secretValue): Promise<void>

Parameters
NameType
secretNamestring
secretValuestring
Returns

Promise<void>

Defined in

core/SecretStore/types/SecretSetterFunction.ts:2


StateDeleteFunction

Ƭ StateDeleteFunction: (stateName: string) => Promise<void>

delete a state value from the state store

Type declaration

▸ (stateName): Promise<void>

Parameters
NameType
stateNamestring
Returns

Promise<void>

Defined in

core/StateStore/types/StateDeleteFunction.ts:2


StateGetterFunction

Ƭ StateGetterFunction: <StateNames>(...stateNames: StateNames) => Promise<ObjectWithKeysFromStringArray<StateNames>>

get a state value from the state store

Type declaration

▸ <StateNames>(...stateNames): Promise<ObjectWithKeysFromStringArray<StateNames>>

Type parameters
NameType
StateNamesextends string[]
Parameters
NameType
...stateNamesStateNames
Returns

Promise<ObjectWithKeysFromStringArray<StateNames>>

Defined in

core/StateStore/types/StateGetterFunction.ts:4


StateSetterFunction

Ƭ StateSetterFunction: (stateName: string, stateValue: unknown) => Promise<void>

set a state value in the state store

Type declaration

▸ (stateName, stateValue): Promise<void>

Parameters
NameType
stateNamestring
stateValueunknown
Returns

Promise<void>

Defined in

core/StateStore/types/StateSetterFunction.ts:2

Subscription

SubscriptionDefinitionBuilder<ServiceClassType, MessagePayloadType, MessageParamsType, MessageResultType, PayloadSchema, ParameterSchema, ResultSchema, Invokes, EmitListType>: Object

Subscription definition builder is a helper to create and define a subscriptions for a service. It helps to set all needed filters.

A working schema definition needs at least a subscription name, a short description and the subscription implementation.

Type parameters

NameType
ServiceClassTypeextends ServiceClass = ServiceClass
MessagePayloadTypeunknown
MessageParamsTypeundefined
MessageResultTypevoid
PayloadSchemaextends Schema = ZodAny
ParameterSchemaextends Schema = ZodAny
ResultSchemaextends Schema = ZodAny
Invokes{}
EmitListType{}

Defined in

SubscriptionDefinitionBuilder/SubscriptionDefinitionBuilder.impl.ts:39

Subscription

Ƭ Subscription<PayloadType, ParameterType>: Object

A subscription managed by the event bridge

Type parameters

NameType
PayloadTypeunknown
ParameterTypeunknown

Type declaration

NameTypeDescription
emitEventName?stringthe event name to be used for custom message if the subscriptions returns a result
eventBridgeConfigDefinitionEventBridgeConfigconfig information for event bridge
eventName?stringthe event name to subscribe for
messageType?EBMessageTypethe message type
payload?{ parameter?: ParameterType ; payload?: PayloadType }the message payload
payload.parameter?ParameterType-
payload.payload?PayloadType-
principalId?PrincipalIdthe principal id
receiver?{ instanceId?: InstanceId ; serviceName?: string ; serviceTarget?: string ; serviceVersion?: string }the consumer address of the message
receiver.instanceId?InstanceId-
receiver.serviceName?string-
receiver.serviceTarget?string-
receiver.serviceVersion?string-
sender?{ instanceId?: InstanceId ; serviceName?: string ; serviceTarget?: string ; serviceVersion?: string }the producer address of the message
sender.instanceId?InstanceId-
sender.serviceName?string-
sender.serviceTarget?string-
sender.serviceVersion?string-
subscriberEBMessageAddressthe address of the subscription (service name, version and subscription name)
tenantId?TenantIdthe tenant id

Defined in

core/types/subscription/Subscription.ts:13


SubscriptionAfterGuardHook

Ƭ SubscriptionAfterGuardHook<ServiceClassType, FunctionResultType, FunctionPayloadOutputType, FunctionParameterType, Invokes, EmitListType>: (this: ServiceClassType, context: SubscriptionFunctionContext<Invokes, EmitListType>, result: Readonly<FunctionResultType>, payload: Readonly<FunctionPayloadOutputType>, parameter: Readonly<FunctionParameterType>) => Promise<void>

Definition of after guard hook functions. This guard is called after function successfully returns and after output validation.

Type parameters

NameType
ServiceClassTypeServiceClass
FunctionResultTypeunknown
FunctionPayloadOutputTypeunknown
FunctionParameterTypeunknown
Invokes{}
EmitListType{}

Type declaration

▸ (this, context, result, payload, parameter): Promise<void>

Parameters
NameType
thisServiceClassType
contextSubscriptionFunctionContext<Invokes, EmitListType>
resultReadonly<FunctionResultType>
payloadReadonly<FunctionPayloadOutputType>
parameterReadonly<FunctionParameterType>
Returns

Promise<void>

Defined in

core/types/subscription/SubscriptionAfterGuardHook.ts:10


SubscriptionBeforeGuardHook

Ƭ SubscriptionBeforeGuardHook<ServiceClassType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>: (this: ServiceClassType, context: SubscriptionFunctionContext<Invokes, EmitListType>, payload: Readonly<FunctionPayloadType>, parameter: Readonly<FunctionParamsType>) => Promise<void>

Guard is called after command function input validation and before executing the command function. The guard is usefull to separate for example auth checks from business logic. It should throw HandledError or return void.

Type parameters

NameType
ServiceClassTypeServiceClass
FunctionPayloadTypeunknown
FunctionParamsTypeunknown
Invokes{}
EmitListType{}

Type declaration

▸ (this, context, payload, parameter): Promise<void>

Parameters
NameType
thisServiceClassType
contextSubscriptionFunctionContext<Invokes, EmitListType>
payloadReadonly<FunctionPayloadType>
parameterReadonly<FunctionParamsType>
Returns

Promise<void>

Defined in

core/types/subscription/SubscriptionBeforeGuardHook.ts:11


SubscriptionDefinition

Ƭ SubscriptionDefinition<ServiceClassType, MetadataType, MessagePayloadType, MessageParamsType, MessageResultType, FunctionPayloadType, FunctionParamsType, FunctionResultType, Invokes, EmitListType>: Object

The definition for a subscription provided by some service.

Type parameters

NameType
ServiceClassTypeextends ServiceClass = ServiceClass
MetadataTypeSubscriptionDefinitionMetadataBase
MessagePayloadTypeunknown
MessageParamsTypeunknown
MessageResultTypeunknown
FunctionPayloadTypeMessagePayloadType
FunctionParamsTypeMessageParamsType
FunctionResultTypeMessageResultType
Invokes{}
EmitListType{}

Type declaration

NameTypeDescription
callSubscriptionFunction<ServiceClassType, MessagePayloadType, MessageParamsType, FunctionPayloadType, FunctionParamsType, FunctionResultType, Invokes, EmitListType>the subscription function
emitEventName?stringevent name to be used for custom message if the subscription functions returns value
emitListEmitListType-
eventBridgeConfigDefinitionEventBridgeConfigconfig information for event bridge
eventName?stringfilter forevent name
hooks{ afterGuard?: Record<string, SubscriptionAfterGuardHook<ServiceClassType, FunctionResultType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>> ; beforeGuard?: Record<string, SubscriptionBeforeGuardHook<ServiceClassType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>> ; transformInput?: { transformFunction: SubscriptionTransformInputHook<ServiceClassType, MessagePayloadType, MessageParamsType> ; transformInputSchema: Schema ; transformParameterSchema: Schema } ; transformOutput?: { transformFunction: SubscriptionTransformOutputHook<ServiceClassType, FunctionResultType, FunctionParamsType, any> ; transformOutputSchema: Schema } }hooks of subscription
hooks.afterGuard?Record<string, SubscriptionAfterGuardHook<ServiceClassType, FunctionResultType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>>-
hooks.beforeGuard?Record<string, SubscriptionBeforeGuardHook<ServiceClassType, FunctionPayloadType, FunctionParamsType, Invokes, EmitListType>>-
hooks.transformInput?{ transformFunction: SubscriptionTransformInputHook<ServiceClassType, MessagePayloadType, MessageParamsType> ; transformInputSchema: Schema ; transformParameterSchema: Schema }-
hooks.transformInput.transformFunctionSubscriptionTransformInputHook<ServiceClassType, MessagePayloadType, MessageParamsType>-
hooks.transformInput.transformInputSchemaSchema-
hooks.transformInput.transformParameterSchemaSchema-
hooks.transformOutput?{ transformFunction: SubscriptionTransformOutputHook<ServiceClassType, FunctionResultType, FunctionParamsType, any> ; transformOutputSchema: Schema }-
hooks.transformOutput.transformFunctionSubscriptionTransformOutputHook<ServiceClassType, FunctionResultType, FunctionParamsType, any>-
hooks.transformOutput.transformOutputSchemaSchema-
invokesFromInvokeToOtherType<Invokes, { outputSchema?: Schema ; parameterSchema?: Schema ; payloadSchema?: Schema }>-
messageType?EBMessageTypefilter for message type
metadataMetadataTypethe metadata of the subscription
principalId?PrincipalIdfilter for principal id
receiver?{ instanceId?: InstanceId ; serviceName?: string ; serviceTarget?: string ; serviceVersion?: string }filter for messages consumed by given receiver
receiver.instanceId?InstanceId-
receiver.serviceName?string-
receiver.serviceTarget?string-
receiver.serviceVersion?string-
sender?{ instanceId?: InstanceId ; serviceName?: string ; serviceTarget?: string ; serviceVersion?: string }filter for messages produced by given sender
sender.instanceId?InstanceId-
sender.serviceName?string-
sender.serviceTarget?string-
sender.serviceVersion?string-
subscriptionDescriptionstringthe description of the subscription
subscriptionNamestringthe name of the subscription
tenantId?TenantIdfilter for tenant id

Defined in

core/types/subscription/SubscriptionDefinition.ts:22


SubscriptionFunction

Ƭ SubscriptionFunction<ServiceClassType, MessagePayloadType, MessageParamsType, FunctionPayloadType, FunctionParamsType, FunctionResultType, Invokes, EmitListType>: (this: ServiceClassType, context: SubscriptionFunctionContext<Invokes, EmitListType>, payload: Readonly<FunctionPayloadType>, parameter: Readonly<FunctionParamsType>) => Promise<FunctionResultType>

CommandFunction is a function which will be triggered when a matching event bridge message is received by the service

Type parameters

NameType
ServiceClassTypeextends ServiceClass
MessagePayloadTypeunknown
MessageParamsTypeundefined
FunctionPayloadTypeMessagePayloadType
FunctionParamsTypeMessageParamsType
FunctionResultTypeundefined
Invokes{}
EmitListType{}

Type declaration

▸ (this, context, payload, parameter): Promise<FunctionResultType>

Parameters
NameType
thisServiceClassType
contextSubscriptionFunctionContext<Invokes, EmitListType>
payloadReadonly<FunctionPayloadType>
parameterReadonly<FunctionParamsType>
Returns

Promise<FunctionResultType>

Defined in

core/types/subscription/SubscriptionFunction.ts:8


SubscriptionFunctionContext

Ƭ SubscriptionFunctionContext<Invokes, EmitListType>: Prettify<ContextBase & SubscriptionFunctionContextEnhancements<Invokes, EmitListType>>

The subscription function context which will be passed into subscription function.

Type parameters

NameType
Invokes{}
EmitListType{}

Defined in

core/types/subscription/SubscriptionFunctionContext.ts:66


SubscriptionFunctionContextEnhancements

Ƭ SubscriptionFunctionContextEnhancements<Invokes, EmitListType>: Object

It provides the original command message. Also, the methods:

  • emit which allows to emit custom events to the event bridge
  • invoke which allows to call other commands

Type parameters

NameType
Invokes{}
EmitListType{}

Type declaration

NameTypeDescription
emitEmitCustomMessageFunction<EmitListType>emit a custom message
invokeInvokeFunctionDeprecated Please use service instead and define the invocations with canInvoke in subscription builder. Invokes a command and returns the result. It is recommended to validate the result against a schema which only contains the data you actually need. Example typescript const address: EBMessageAddress = { serviceName: 'name-of-service-to-invoke', serviceVersion: '1', serviceTarget: 'command-name-to-invoke', } const inputPayload = { my: 'input' } const inputParameter = { search: 'for_me' } const result = await invoke<MyResultType>(address, inputPayload inputParameter )
messageReadonly<EBMessage>the original message
serviceInvokesInvokes a command and returns the result. It is recommended to validate the result against a schema which only contains the data you actually need. Example typescript // define your invocation in subscription builder .canInvoke<{ response: string }>('ServiceA', '1', 'test', payloadSchema, parameterSchema) .setCommandFunction(async function (context, payload, _parameter) { const inputPayload = { my: 'input' } const inputParameter = { search: 'for_me' } const result = await context.service.ServiceA[1].test(inputPayload,inputParameter) })

Defined in

core/types/subscription/SubscriptionFunctionContext.ts:16


SubscriptionTransformFunctionContext

Ƭ SubscriptionTransformFunctionContext: Prettify<ContextBase & { message: Readonly<EBMessage> }>

Defined in

core/types/subscription/SubscriptionTransformFunctionContext.ts:8


SubscriptionTransformInputHook

Ƭ SubscriptionTransformInputHook<ServiceClassType, PayloadOutput, ParamsOutput, PayloadInput, ParamsInput>: (this: ServiceClassType, context: SubscriptionTransformFunctionContext, payload: Readonly<PayloadInput>, parameter: Readonly<ParamsInput>) => Promise<{ parameter: Readonly<ParamsOutput> ; payload: Readonly<PayloadOutput> }>

Type parameters

NameType
ServiceClassTypeServiceClassType
PayloadOutputunknown
ParamsOutputunknown
PayloadInputunknown
ParamsInputunknown

Type declaration

▸ (this, context, payload, parameter): Promise<{ parameter: Readonly<ParamsOutput> ; payload: Readonly<PayloadOutput> }>

Parameters
NameType
thisServiceClassType
contextSubscriptionTransformFunctionContext
payloadReadonly<PayloadInput>
parameterReadonly<ParamsInput>
Returns

Promise<{ parameter: Readonly<ParamsOutput> ; payload: Readonly<PayloadOutput> }>

Defined in

core/types/subscription/SubscriptionTransformInputHook.ts:6


SubscriptionTransformOutputHook

Ƭ SubscriptionTransformOutputHook<ServiceClassType, MessageResultType, MessageParamsType, ResponseOutput>: (this: ServiceClassType, context: SubscriptionTransformFunctionContext, payload: Readonly<MessageResultType>, parameter: Readonly<MessageParamsType>) => Promise<ResponseOutput>

This transform hook is executed after function output validation and AfterGuardHooks.

Type parameters

NameType
ServiceClassTypeServiceClassType
MessageResultTypeunknown
MessageParamsTypeunknown
ResponseOutputunknown

Type declaration

▸ (this, context, payload, parameter): Promise<ResponseOutput>

Parameters
NameType
thisServiceClassType
contextSubscriptionTransformFunctionContext
payloadReadonly<MessageResultType>
parameterReadonly<MessageParamsType>
Returns

Promise<ResponseOutput>

Defined in

core/types/subscription/SubscriptionTransformOutputHook.ts:8

Unit test helper

getCommandContextMock

getCommandContextMock<MessagePayloadType, MessageParamsType, Invokes, EmitListType>(payload, parameter, sandbox?, _invokes?, emitList?): Object

A function that returns a mock object for command function context

Type parameters

NameType
MessagePayloadTypeunknown
MessageParamsTypeunknown
Invokes{}
EmitListType{}

Parameters

NameType
payloadMessagePayloadType
parameterMessageParamsType
sandbox?SinonSandbox
_invokes?FromInvokeToOtherType<Invokes, { outputSchema?: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> ; parameterSchema?: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> ; payloadSchema?: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> }>
emitList?EmitListType

Returns

Object

NameType
mock{ configs: { getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction } ; emit: EmitCustomMessageFunction<EmitListType> ; invoke: InvokeFunction ; logger: Logger ; message: Readonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: Command ; otp?: string ; payload: { parameter: MessageParamsType ; payload: MessagePayloadType } ; principalId?: string ; receiver: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }> ; secrets: { getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction } ; service: Invokes ; startActiveSpan: <F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F> ; states: { getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction } ; wrapInSpan: <F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F> }
mock.configs{ getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction }
mock.configs.getConfigConfigGetterFunction
mock.configs.removeConfigConfigDeleteFunction
mock.configs.setConfigConfigSetterFunction
mock.emitEmitCustomMessageFunction<EmitListType>
mock.invokeInvokeFunction
mock.loggerLogger
mock.messageReadonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: Command ; otp?: string ; payload: { parameter: MessageParamsType ; payload: MessagePayloadType } ; principalId?: string ; receiver: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>
mock.secrets{ getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction }
mock.secrets.getSecretSecretGetterFunction
mock.secrets.removeSecretSecretDeleteFunction
mock.secrets.setSecretSecretSetterFunction
mock.serviceInvokes
mock.startActiveSpan<F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F>
mock.states{ getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction }
mock.states.getStateStateGetterFunction
mock.states.removeStateStateDeleteFunction
mock.states.setStateStateSetterFunction
mock.wrapInSpan<F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F>
stubs{ emit: FromEmitToOtherType<EmitListType, SinonStub<any[], any>> = eventList; getConfig: SinonStub<any[], any> ; getSecret: SinonStub<any[], any> ; getState: SinonStub<any[], any> ; invoke: SinonStub<any[], any> ; logger: { debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> } = logger.stubs; removeConfig: SinonStub<any[], any> ; removeSecret: SinonStub<any[], any> ; removeState: SinonStub<any[], any> ; service: FromInvokeToOtherType<Invokes, SinonStub<any[], any>> ; setConfig: SinonStub<any[], any> ; setSecret: SinonStub<any[], any> ; setState: SinonStub<any[], any> ; startActiveSpan: SinonStub<any[], any> ; wrapInSpan: SinonStub<any[], any> }
stubs.emitFromEmitToOtherType<EmitListType, SinonStub<any[], any>>
stubs.getConfigSinonStub<any[], any>
stubs.getSecretSinonStub<any[], any>
stubs.getStateSinonStub<any[], any>
stubs.invokeSinonStub<any[], any>
stubs.logger{ debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> }
stubs.logger.debugSinonStub<any[], any>
stubs.logger.errorSinonStub<any[], any>
stubs.logger.fatalSinonStub<any[], any>
stubs.logger.infoSinonStub<any[], any>
stubs.logger.traceSinonStub<any[], any>
stubs.logger.warnSinonStub<any[], any>
stubs.removeConfigSinonStub<any[], any>
stubs.removeSecretSinonStub<any[], any>
stubs.removeStateSinonStub<any[], any>
stubs.serviceFromInvokeToOtherType<Invokes, SinonStub<any[], any>>
stubs.setConfigSinonStub<any[], any>
stubs.setSecretSinonStub<any[], any>
stubs.setStateSinonStub<any[], any>
stubs.startActiveSpanSinonStub<any[], any>
stubs.wrapInSpanSinonStub<any[], any>

Defined in

mocks/getCommandContext.mock.ts:19


getCommandErrorMessageMock

getCommandErrorMessageMock(error?, input?, commandMessage?): Readonly<{ contentEncoding: "utf-8" ; contentType: "application/json" ; correlationId: string ; eventName?: string ; id: string ; isHandledError: boolean ; messageType: CommandErrorResponse ; otp?: string ; payload: { data?: unknown ; message: string ; status: StatusCode } ; principalId?: string ; receiver: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

A function that returns a mocked command error response message

Parameters

NameTypeDescription
error?UnhandledError | HandledError-
input?Partial<{ contentEncoding: "utf-8" ; contentType: "application/json" ; correlationId: string ; eventName?: string ; id: string ; isHandledError: boolean ; messageType: CommandErrorResponse ; otp?: string ; payload: { data?: unknown ; message: string ; status: StatusCode } ; principalId?: string ; receiver: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>-
commandMessage?Object-
commandMessage.contentEncodingstringcontent encoding of message payload
commandMessage.contentTypestringcontent type of message payload
commandMessage.correlationIdstringcorrelation id to know which command response referrs to which command
commandMessage.eventName?stringevent name for this message
commandMessage.idstringglobal unique id of message
commandMessage.messageTypeCommand-
commandMessage.otp?stringstringified Opentelemetry parent trace id
commandMessage.payloadObject-
commandMessage.payload.parameterunknown-
commandMessage.payload.payloadunknown-
commandMessage.principalId?stringprincipal id
commandMessage.receiverEBMessageAddress-
commandMessage.senderObject-
commandMessage.sender.instanceIdstringinstance id of eventbridge
commandMessage.sender.serviceNamestringthe name of the service
commandMessage.sender.serviceTargetstringthe name of the command or subscription
commandMessage.sender.serviceVersionstringthe version of the service
commandMessage.tenantId?stringprincipal id
commandMessage.timestampnumbertimestamp of message creation time
commandMessage.traceId?stringtrace id of message

Returns

Readonly<{ contentEncoding: "utf-8" ; contentType: "application/json" ; correlationId: string ; eventName?: string ; id: string ; isHandledError: boolean ; messageType: CommandErrorResponse ; otp?: string ; payload: { data?: unknown ; message: string ; status: StatusCode } ; principalId?: string ; receiver: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

Defined in

mocks/messages/getCommandErrorMessage.mock.ts:16


getCommandMessageMock

getCommandMessageMock<Payload, Parameter>(input?): Readonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: Command ; otp?: string ; payload: { parameter: Parameter ; payload: Payload } ; principalId?: string ; receiver: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

A function that returns a mocked command message.

Type parameters

NameType
Payloadunknown
Parameterunknown

Parameters

NameType
input?Partial<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: Command ; otp?: string ; payload: { parameter: Parameter ; payload: Payload } ; principalId?: string ; receiver: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }> & { payload?: { parameter?: Parameter ; payload?: Payload } }

Returns

Readonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: Command ; otp?: string ; payload: { parameter: Parameter ; payload: Payload } ; principalId?: string ; receiver: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

Defined in

mocks/messages/getCommandMessage.mock.ts:15


getCommandSuccessMessageMock

getCommandSuccessMessageMock<PayloadType>(payload, input?, commandMessage?): Readonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: CommandSuccessResponse ; otp?: string ; payload: PayloadType ; principalId?: string ; receiver: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

A function that returns a mocked command success response message.

Type parameters

Name
PayloadType

Parameters

NameTypeDescription
payloadPayloadType-
input?Partial<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: CommandSuccessResponse ; otp?: string ; payload: PayloadType ; principalId?: string ; receiver: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>-
commandMessage?Object-
commandMessage.contentEncodingstringcontent encoding of message payload
commandMessage.contentTypestringcontent type of message payload
commandMessage.correlationIdstringcorrelation id to know which command response referrs to which command
commandMessage.eventName?stringevent name for this message
commandMessage.idstringglobal unique id of message
commandMessage.messageTypeCommand-
commandMessage.otp?stringstringified Opentelemetry parent trace id
commandMessage.payloadObject-
commandMessage.payload.parameterunknown-
commandMessage.payload.payloadunknown-
commandMessage.principalId?stringprincipal id
commandMessage.receiverEBMessageAddress-
commandMessage.senderObject-
commandMessage.sender.instanceIdstringinstance id of eventbridge
commandMessage.sender.serviceNamestringthe name of the service
commandMessage.sender.serviceTargetstringthe name of the command or subscription
commandMessage.sender.serviceVersionstringthe version of the service
commandMessage.tenantId?stringprincipal id
commandMessage.timestampnumbertimestamp of message creation time
commandMessage.traceId?stringtrace id of message

Returns

Readonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: CommandSuccessResponse ; otp?: string ; payload: PayloadType ; principalId?: string ; receiver: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

Defined in

mocks/messages/getCommandSuccessMessage.mock.ts:10


getCommandTransformContextMock

getCommandTransformContextMock<MessagePayloadType, MessageParamsType>(payload, parameter, sandbox?): Object

A function that returns a mock object for command transform function context

Type parameters

NameType
MessagePayloadTypeunknown
MessageParamsTypeunknown

Parameters

NameType
payloadMessagePayloadType
parameterMessageParamsType
sandbox?SinonSandbox

Returns

Object

NameType
mock{ configs: { getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction } ; logger: Logger ; message: Readonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: Command ; otp?: string ; payload: { parameter: MessageParamsType ; payload: MessagePayloadType } ; principalId?: string ; receiver: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }> ; secrets: { getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction } ; startActiveSpan: <F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F> ; states: { getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction } ; wrapInSpan: <F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F> }
mock.configs{ getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction }
mock.configs.getConfigConfigGetterFunction
mock.configs.removeConfigConfigDeleteFunction
mock.configs.setConfigConfigSetterFunction
mock.loggerLogger
mock.messageReadonly<{ contentEncoding: string ; contentType: string ; correlationId: string ; eventName?: string ; id: string ; messageType: Command ; otp?: string ; payload: { parameter: MessageParamsType ; payload: MessagePayloadType } ; principalId?: string ; receiver: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>
mock.secrets{ getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction }
mock.secrets.getSecretSecretGetterFunction
mock.secrets.removeSecretSecretDeleteFunction
mock.secrets.setSecretSecretSetterFunction
mock.startActiveSpan<F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F>
mock.states{ getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction }
mock.states.getStateStateGetterFunction
mock.states.removeStateStateDeleteFunction
mock.states.setStateStateSetterFunction
mock.wrapInSpan<F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F>
stubs{ getConfig: SinonStub<any[], any> ; getSecret: SinonStub<any[], any> ; getState: SinonStub<any[], any> ; logger: { debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> } = logger.stubs; removeConfig: SinonStub<any[], any> ; removeSecret: SinonStub<any[], any> ; removeState: SinonStub<any[], any> ; setConfig: SinonStub<any[], any> ; setSecret: SinonStub<any[], any> ; setState: SinonStub<any[], any> ; startActiveSpan: SinonStub<any[], any> ; wrapInSpan: SinonStub<any[], any> }
stubs.getConfigSinonStub<any[], any>
stubs.getSecretSinonStub<any[], any>
stubs.getStateSinonStub<any[], any>
stubs.logger{ debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> }
stubs.logger.debugSinonStub<any[], any>
stubs.logger.errorSinonStub<any[], any>
stubs.logger.fatalSinonStub<any[], any>
stubs.logger.infoSinonStub<any[], any>
stubs.logger.traceSinonStub<any[], any>
stubs.logger.warnSinonStub<any[], any>
stubs.removeConfigSinonStub<any[], any>
stubs.removeSecretSinonStub<any[], any>
stubs.removeStateSinonStub<any[], any>
stubs.setConfigSinonStub<any[], any>
stubs.setSecretSinonStub<any[], any>
stubs.setStateSinonStub<any[], any>
stubs.startActiveSpanSinonStub<any[], any>
stubs.wrapInSpanSinonStub<any[], any>

Defined in

mocks/getCommandTransformContext.mock.ts:13


getCustomMessageMessageMock

getCustomMessageMessageMock<PayloadType>(eventName, payload, input?): Readonly<{ contentEncoding: string ; contentType: string ; correlationId?: string ; eventName: string ; id: string ; messageType: CustomMessage ; otp?: string ; payload?: PayloadType ; principalId?: string ; receiver?: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

A function that returns a mocked custom message.

Type parameters

Name
PayloadType

Parameters

NameType
eventNamestring
payloadPayloadType
input?Partial<{ contentEncoding: string ; contentType: string ; correlationId?: string ; eventName: string ; id: string ; messageType: CustomMessage ; otp?: string ; payload?: PayloadType ; principalId?: string ; receiver?: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

Returns

Readonly<{ contentEncoding: string ; contentType: string ; correlationId?: string ; eventName: string ; id: string ; messageType: CustomMessage ; otp?: string ; payload?: PayloadType ; principalId?: string ; receiver?: EBMessageAddress ; sender: { instanceId: string ; serviceName: string ; serviceTarget: string ; serviceVersion: string } ; tenantId?: string ; timestamp: number ; traceId?: string }>

Defined in

mocks/messages/getCustomMessage.mock.ts:15


getEventBridgeMock

getEventBridgeMock(sandbox?): Object

Mocks the eventBridge and stubs the methods

Parameters

NameType
sandbox?SinonSandbox

Returns

Object

EventBridge mocked

NameType
mockEventBridge
stubsRecord<string, SinonStub<any[], any>>

Defined in

mocks/getEventBridge.mock.ts:11


getLoggerMock

getLoggerMock(sandbox?): Object

Mocks the logger and methods are stubs

Parameters

NameType
sandbox?SinonSandbox

Returns

Object

logger mocked

NameType
mockLogger
stubs{ debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> }
stubs.debugSinonStub<any[], any>
stubs.errorSinonStub<any[], any>
stubs.fatalSinonStub<any[], any>
stubs.infoSinonStub<any[], any>
stubs.traceSinonStub<any[], any>
stubs.warnSinonStub<any[], any>

Defined in

mocks/getLogger.mock.ts:11


getSubscriptionContextMock

getSubscriptionContextMock<Invokes, EmitListType>(message, sandbox?, _invokes?, emitList?): Object

A function that returns a mock object for subscription function context

Type parameters

NameType
Invokes{}
EmitListType{}

Parameters

NameType
messageEBMessage
sandbox?SinonSandbox
_invokes?FromInvokeToOtherType<Invokes, { outputSchema?: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> ; parameterSchema?: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> ; payloadSchema?: Schema<any, any, any, ""> | ZodType<any, ZodTypeDef, any> }>
emitList?EmitListType

Returns

Object

NameType
mock{ configs: { getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction } ; emit: EmitCustomMessageFunction<{}> ; invoke: InvokeFunction ; logger: Logger ; message: Readonly<EBMessage> ; secrets: { getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction } ; service: Invokes ; startActiveSpan: <F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F> ; states: { getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction } ; wrapInSpan: <F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F> }
mock.configs{ getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction }
mock.configs.getConfigConfigGetterFunction
mock.configs.removeConfigConfigDeleteFunction
mock.configs.setConfigConfigSetterFunction
mock.emitEmitCustomMessageFunction<{}>
mock.invokeInvokeFunction
mock.loggerLogger
mock.messageReadonly<EBMessage>
mock.secrets{ getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction }
mock.secrets.getSecretSecretGetterFunction
mock.secrets.removeSecretSecretDeleteFunction
mock.secrets.setSecretSecretSetterFunction
mock.serviceInvokes
mock.startActiveSpan<F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F>
mock.states{ getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction }
mock.states.getStateStateGetterFunction
mock.states.removeStateStateDeleteFunction
mock.states.setStateStateSetterFunction
mock.wrapInSpan<F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F>
stubs{ emit: FromEmitToOtherType<EmitListType, SinonStub<any[], any>> = eventList; getConfig: SinonStub<any[], any> ; getSecret: SinonStub<any[], any> ; getState: SinonStub<any[], any> ; invoke: SinonStub<any[], any> ; logger: { debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> } = logger.stubs; removeConfig: SinonStub<any[], any> ; removeSecret: SinonStub<any[], any> ; removeState: SinonStub<any[], any> ; service: FromInvokeToOtherType<Invokes, SinonStub<any[], any>> ; setConfig: SinonStub<any[], any> ; setSecret: SinonStub<any[], any> ; setState: SinonStub<any[], any> ; startActiveSpan: SinonStub<any[], any> ; wrapInSpan: SinonStub<any[], any> }
stubs.emitFromEmitToOtherType<EmitListType, SinonStub<any[], any>>
stubs.getConfigSinonStub<any[], any>
stubs.getSecretSinonStub<any[], any>
stubs.getStateSinonStub<any[], any>
stubs.invokeSinonStub<any[], any>
stubs.logger{ debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> }
stubs.logger.debugSinonStub<any[], any>
stubs.logger.errorSinonStub<any[], any>
stubs.logger.fatalSinonStub<any[], any>
stubs.logger.infoSinonStub<any[], any>
stubs.logger.traceSinonStub<any[], any>
stubs.logger.warnSinonStub<any[], any>
stubs.removeConfigSinonStub<any[], any>
stubs.removeSecretSinonStub<any[], any>
stubs.removeStateSinonStub<any[], any>
stubs.serviceFromInvokeToOtherType<Invokes, SinonStub<any[], any>>
stubs.setConfigSinonStub<any[], any>
stubs.setSecretSinonStub<any[], any>
stubs.setStateSinonStub<any[], any>
stubs.startActiveSpanSinonStub<any[], any>
stubs.wrapInSpanSinonStub<any[], any>

Defined in

mocks/getSubscriptionContext.mock.ts:19


getSubscriptionTransformContextMock

getSubscriptionTransformContextMock(message, sandbox?): Object

A function that returns a mock object for subscription transform function context

Parameters

NameType
messageEBMessage
sandbox?SinonSandbox

Returns

Object

NameType
mock{ configs: { getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction } ; logger: Logger ; message: Readonly<EBMessage> ; secrets: { getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction } ; startActiveSpan: <F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F> ; states: { getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction } ; wrapInSpan: <F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F> }
mock.configs{ getConfig: ConfigGetterFunction ; removeConfig: ConfigDeleteFunction ; setConfig: ConfigSetterFunction }
mock.configs.getConfigConfigGetterFunction
mock.configs.removeConfigConfigDeleteFunction
mock.configs.setConfigConfigSetterFunction
mock.loggerLogger
mock.messageReadonly<EBMessage>
mock.secrets{ getSecret: SecretGetterFunction ; removeSecret: SecretDeleteFunction ; setSecret: SecretSetterFunction }
mock.secrets.getSecretSecretGetterFunction
mock.secrets.removeSecretSecretDeleteFunction
mock.secrets.setSecretSecretSetterFunction
mock.startActiveSpan<F>(name: string, opts: SpanOptions, context: undefined | Context, fn: (span: Span) => Promise<F>) => Promise<F>
mock.states{ getState: StateGetterFunction ; removeState: StateDeleteFunction ; setState: StateSetterFunction }
mock.states.getStateStateGetterFunction
mock.states.removeStateStateDeleteFunction
mock.states.setStateStateSetterFunction
mock.wrapInSpan<F>(name: string, opts: SpanOptions, fn: (span: Span) => Promise<F>, context?: Context) => Promise<F>
stubs{ getConfig: SinonStub<any[], any> ; getSecret: SinonStub<any[], any> ; getState: SinonStub<any[], any> ; logger: { debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> } = logger.stubs; removeConfig: SinonStub<any[], any> ; removeSecret: SinonStub<any[], any> ; removeState: SinonStub<any[], any> ; setConfig: SinonStub<any[], any> ; setSecret: SinonStub<any[], any> ; setState: SinonStub<any[], any> ; startActiveSpan: SinonStub<any[], any> ; wrapInSpan: SinonStub<any[], any> }
stubs.getConfigSinonStub<any[], any>
stubs.getSecretSinonStub<any[], any>
stubs.getStateSinonStub<any[], any>
stubs.logger{ debug: SinonStub<any[], any> ; error: SinonStub<any[], any> ; fatal: SinonStub<any[], any> ; info: SinonStub<any[], any> ; trace: SinonStub<any[], any> ; warn: SinonStub<any[], any> }
stubs.logger.debugSinonStub<any[], any>
stubs.logger.errorSinonStub<any[], any>
stubs.logger.fatalSinonStub<any[], any>
stubs.logger.infoSinonStub<any[], any>
stubs.logger.traceSinonStub<any[], any>
stubs.logger.warnSinonStub<any[], any>
stubs.removeConfigSinonStub<any[], any>
stubs.removeSecretSinonStub<any[], any>
stubs.removeStateSinonStub<any[], any>
stubs.setConfigSinonStub<any[], any>
stubs.setSecretSinonStub<any[], any>
stubs.setStateSinonStub<any[], any>
stubs.startActiveSpanSinonStub<any[], any>
stubs.wrapInSpanSinonStub<any[], any>

Defined in

mocks/getSubscriptionTransformContext.mock.ts:12