Packages · @purista/core
@purista/core
This is the main package of PURISTA.
Signature
@purista/core Enumerations
5 entries
EBMessageType
Enums
enum EBMessageType Type of event bridge message
PuristaSpanName
Enums
enum PuristaSpanName Opentelemetry span names used by PURISTA framework
PuristaSpanTag
Enums
enum PuristaSpanTag Opentelemetry tags set by PURISTA framework
StatusCode
Enums
enum StatusCode Message and error status codes. The codes are based on HTTP status codes
StoreType
Enums
enum StoreType Classes
14 entries
AgentQueueBuilder
Classes
class AgentQueueBuilder<S> Builds an attached PURISTA agent from normal core queue, worker, command, stream definitions, and a provider-neutral agent manifest.
ClientBuilder
Classes
class ClientBuilder ClientBuilder to generate clients, based on service definitions.
DefaultLogger
Classes
class DefaultLogger GenericEventEmitter
Classes
class GenericEventEmitter<T> HandledError
Classes
class HandledError A handled error is an error which is handled or thrown by business logic. It is wanted to expose it the outside world. Scenarios are input validation failures or "404 Not Found" errors which should be returned to the caller.
HttpClient
Classes
class HttpClient<CustomConfig> HTTP client with JSON helpers, timeout handling, tracing, metrics, and normalized errors.
Logger
Classes
class Logger PuristaMetricsRecorder
Classes
class PuristaMetricsRecorder OpenTelemetry API backed PURISTA metrics recorder.
QueueDefinitionBuilder
Classes
class QueueDefinitionBuilder Builds a durable queue contract for background work.
QueueWorkerBuilder
Classes
class QueueWorkerBuilder Builds a queue worker definition for one queue.
ScheduleDefinitionBuilder
Classes
class ScheduleDefinitionBuilder Builds a schedule contract for an external scheduler.
StreamDefinitionBuilder
Classes
class StreamDefinitionBuilder<S, C> Builds a stream definition for incremental output or aggregate stream results.
SubscriptionConsumerControlError
Classes
class SubscriptionConsumerControlError UnhandledError
Classes
class UnhandledError A unhandled error will be thrown if some error response is returned during invoking a service function or when the invocation timed out. This error is not handled by business logic and it is maybe unwanted to expose this error outside.
Interfaces
11 entries
GlobalContext
Interfaces
interface GlobalContext Context passed to all submodules
IEmitter
Interfaces
interface IEmitter<T> ILogger
Interfaces
interface ILogger MemoryMetricRecord
Interfaces
interface MemoryMetricRecord Deterministic metric record captured by the memory recorder.
PuristaMetricDefinition
Interfaces
interface PuristaMetricDefinition<AttributesSchema> Declares one framework or application metric.
PuristaMetricsRecorderInterface
Interfaces
interface PuristaMetricsRecorderInterface A provider-neutral recorder used by framework code and metric contexts.
PuristaMetricsRuntimeOptions
Interfaces
interface PuristaMetricsRuntimeOptions Runtime metrics options consumed by PURISTA recorders.
RestClient
Interfaces
interface RestClient REST API client abstraction for JSON-oriented HTTP calls.
StreamHandle
Interfaces
interface StreamHandle<Chunk, Final> StreamWriter
Interfaces
interface StreamWriter<Chunk, Final> TransformSchemaObjectOptions
Interfaces
interface TransformSchemaObjectOptions Type Aliases
233 entries
addPrefixToObject
Types
type addPrefixToObject = mapped Helper for better typescript type. All keys of given object must start with the given prefix. Otherwise Typescript will complain.
AgentDefinition
Types
type AgentDefinition = void Attached agent definition before expansion into service definitions.
AgentExecutionDefinition
Types
type AgentExecutionDefinition = { definition: HarnessAgentDefinition<any, any, any>; kind: "harnessAgent" } | { definition: HarnessWorkflowDefinition<any, any, any>; kind: "harnessWorkflow" } | { handler: AgentHandler<Payload, Parameter, Resources, Models, CommandTools, AgentTools, Output, Metrics>; kind: "runFunction" } Internal execution definition selected by exactly one agent execution setter.
AgentExecutionKind
Types
type AgentExecutionKind = "harnessAgent" | "harnessWorkflow" | "runFunction" Execution implementation kind used by an attached agent definition.
AgentExecutionPolicy
Types
type AgentExecutionPolicy = void Queue execution policy applied to the generated agent worker and queue.
AgentHandler
Types
type AgentHandler = (context: AgentHandlerContext<Payload, Parameter, Resources, Models, CommandTools, AgentTools, Metrics>) => Promise<Output> Run function shape accepted by `AgentQueueBuilder.setRunFunction(...)`.
AgentHandlerContext
Types
type AgentHandlerContext = void Context passed to an attached agent run function.
AgentHandlerModelBindings
Types
type AgentHandlerModelBindings = mapped Typed model handles exposed to an agent run function.
AgentHttpExposure
Types
type AgentHttpExposure = void HTTP projection metadata for the generated agent command or stream.
AgentInvokeMap
Types
type AgentInvokeMap = mapped Typed child-agent invocation map exposed at `context.invoke.agents`.
AgentManifest
Types
type AgentManifest = void Provider-neutral manifest describing an attached PURISTA agent.
AgentModelBinding
Types
type AgentModelBinding = void Declares a model alias required by an attached PURISTA agent.
AgentModelCapability
Types
type AgentModelCapability = ModelCapability Model capability names supported by `@purista/harness` model bindings.
AgentQueueBuilderTypes
Types
type AgentQueueBuilderTypes = void Type accumulator used by `AgentQueueBuilder` to preserve typed schemas, tools, models, and metrics.
AgentQueueResultPolicy
Types
type AgentQueueResultPolicy = void Controls how generated queues persist and/or emit agent worker completion metadata.
AgentQueueResultPolicyMode
Types
type AgentQueueResultPolicyMode = "none" | "event" | "state" | "state-and-event" Storage or event side effect used for queued agent run results.
AgentResponseMode
Types
type AgentResponseMode = "accepted" | "status" | "stream" | "event" | "callback" Public response contract exposed by the generated agent command or stream.
AgentResponseModeOptions
Types
type AgentResponseModeOptions = void Options for long-running agent response contracts.
AgentRunEvent
Types
type AgentRunEvent = void Harness run event decorated with PURISTA agent identity metadata.
AgentRunIdentity
Types
type AgentRunIdentity = void Stable run identity propagated through attached agent execution events and results.
AgentRunResult
Types
type AgentRunResult = void Aggregate result returned by an attached agent runtime.
AgentRuntimeInvocationInput
Types
type AgentRuntimeInvocationInput = void Aggregate invocation input passed from generated PURISTA definitions into the agent runtime.
AgentRuntimeModelBinding
Types
type AgentRuntimeModelBinding = { capabilities: typeOperator; defaults: ModelDefaults; model: string; provider: ModelProvider; providerOptions: Record<string, unknown> } & Partial<Pick<Binding, "model">> AgentRuntimeModelBindings
Types
type AgentRuntimeModelBindings = mapped Runtime model bindings keyed by every model alias declared on an agent builder.
AgentRuntimeOptions
Types
type AgentRuntimeOptions = void Runtime options required to initialize attached agents for a service instance.
AgentRuntimeRef
Types
type AgentRuntimeRef = void Mutable runtime reference bound when the owning service instance is created.
AgentRuntimeStreamInvocationInput
Types
type AgentRuntimeStreamInvocationInput = AgentRuntimeInvocationInput & { writer: { close: void; fail: void; onCancel: void; write: void } } Streaming invocation input passed from generated PURISTA stream definitions into the agent runtime.
AgentSandboxPolicy
Types
type AgentSandboxPolicy = void Optional sandbox adapter configuration passed through to the agent runtime.
AgentSessionPolicy
Types
type AgentSessionPolicy = { mode: "ephemeral" } | { mode: "conversation"; payloadPath: typeOperator } Session behavior used by the harness runtime for each agent run.
AllowedAgentDefinition
Types
type AllowedAgentDefinition = void Declares one attached agent that this attached agent may call.
AllowedCommandToolDefinition
Types
type AllowedCommandToolDefinition = void Declares one service command that an attached agent may call as a typed tool.
AnyAgentQueueBuilderTypes
Types
type AnyAgentQueueBuilderTypes = AgentQueueBuilderTypes<Schema, Schema, Schema, Record<string, unknown>, Record<string, AgentModelBinding>, Record<string, AllowedCommandToolDefinition>, Record<string, AllowedAgentDefinition>, AgentExecutionKind | undefined, PuristaMetricDefinitions> Broad agent builder type used where any attached agent definition is accepted.
AttachedAgentDefinition
Types
type AttachedAgentDefinition = AgentDefinition<S> & { command: AttachedCoreDefinition & { commandName: string }; queue: AttachedCoreDefinition & { queueName: string }; stream: AttachedCoreDefinition & { streamName: string }; worker: AttachedCoreDefinition & { name: string; queueName: string } } Agent plus the generated queue, worker, command, and stream definitions added to a service.
AttachedCoreDefinition
Types
type AttachedCoreDefinition = object Core definition metadata attached to generated queue, worker, command, and stream artifacts.
AuthCredentials
Types
type AuthCredentials = void HTTP authentication information kept in memory by HttpClient.
BrokerHeaderCommandMsg
Types
type BrokerHeaderCommandMsg = Prettify<BrokerHeaderCustomMsg & { receiverInstanceId: InstanceId; receiverServiceName: string; receiverServiceTarget: string; receiverServiceVersion: string }> BrokerHeaderCommandResponseMsg
Types
type BrokerHeaderCommandResponseMsg = Prettify<BrokerHeaderCommandMsg & { receiverInstanceId: InstanceId }> BrokerHeaderCustomMsg
Types
type BrokerHeaderCustomMsg = void ClientBuilderConfig
Types
type ClientBuilderConfig = z.infer<typeof httpClientConfigSchema> ClientBuilderEvents
Types
type ClientBuilderEvents = void CloudEvent
Types
type CloudEvent = void Command
Types
type Command = Prettify<{ correlationId: CorrelationId; messageType: EBMessageType.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.
CommandContextMockResult
Types
type CommandContextMockResult = void CommandContextMockServiceClass
Types
type CommandContextMockServiceClass = T extends CommandDefinitionBuilder<S, any> ? S : ServiceClass CommandDefinitionBuilderTypes
Types
type CommandDefinitionBuilderTypes = void Type accumulator used by `CommandDefinitionBuilder` for schemas, hooks, invocations, events, and queues.
CommandDefinitionList
Types
type CommandDefinitionList = Promise<CommandDefinition<S, any, any, any, any, any, any, any, any, any, any, any, any, any, CommandDefinitionMetadataBase, any>>[] Helper type for creating list of service commands to be passed as input to service class
CommandDefinitionListResolved
Types
type CommandDefinitionListResolved = CommandDefinition<S, any, any, any, any, any, any, any, any, any, any, any, any, any, CommandDefinitionMetadataBase, any>[] CommandDefinitionMetadataBase
Types
type CommandDefinitionMetadataBase = void CommandToolInvokeMap
Types
type CommandToolInvokeMap = mapped Typed command tool call map exposed at `context.invoke.tools`.
Complete
Types
type Complete = mapped A helper which forces to provide all object keys, even if they are optional.
CompressionMethod
Types
type CompressionMethod = "gzip" | "deflat" | "br" | undefined Config
Types
type Config = z.infer<typeof configSchema> ConfigFull
Types
type ConfigFull = z.infer<typeof configFullSchema> ConfigStoreCacheMap
Types
type ConfigStoreCacheMap = Map<string, { createdAt: number; value: string }> Constructor
Types
type Constructor = (...args: A) => T Generic constructor type that preserves argument tuple inference.
ContentType
Types
type 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.
ContextBase
Types
type ContextBase = void 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.
CorrelationId
Types
type CorrelationId = string the correlation id links the command invocation message with the command response message
CreateCommandContextMockInput
Types
type CreateCommandContextMockInput = void CreateCommandTestHarnessOptions
Types
type CreateCommandTestHarnessOptions = InstanceConfigType<InferCommandHarnessServiceBuilderConfig<TServiceBuilder>> & { eventBridge: EventBridge; queueBridge: QueueBridge } CreateStreamContextMockInput
Types
type CreateStreamContextMockInput = void CreateSubscriptionContextMockInput
Types
type CreateSubscriptionContextMockInput = void CustomMessage
Types
type CustomMessage = Prettify<{ eventName: string; messageType: EBMessageType.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.
DefaultConfigStoreConfig
Types
type DefaultConfigStoreConfig = Record<string, unknown> DefaultEventBridgeConfig
Types
type DefaultEventBridgeConfig = void The configuration for the DefaultEventBridge.
DefaultSecretStoreConfig
Types
type DefaultSecretStoreConfig = Record<string, unknown> DefaultStateStoreConfig
Types
type DefaultStateStoreConfig = Record<string, unknown> EBMessage
Types
type EBMessage = Command | CommandResponse | InfoMessage | CustomMessage | StreamMessage EBMessage is some message which is handled by the event bridge.
EBMessageAddress
Types
type EBMessageAddress = void A event bridge message address describes the sender or receiver of a message.
EBMessageBase
Types
type EBMessageBase = void Default fields which are part of any purista message
EBMessageId
Types
type EBMessageId = string Unique id of the event bridge message
EBMessageSenderAddress
Types
type EBMessageSenderAddress = Prettify<Omit<EBMessageAddress, "instanceId"> & Required<Pick<EBMessageAddress, "instanceId">>> A event bridge message address describes the sender or receiver of a message.
EmitCustomMessageFunction
Types
type EmitCustomMessageFunction = (eventName: K, payload: EmitList[K], contentType?: ContentType, contentEncoding?: string) => Promise<void> Emits the given payload as custom message with the given event name.
EmitSchemaList
Types
type EmitSchemaList = mapped EmptyObject
Types
type EmptyObject = object ErrorResponsePayload
Types
type ErrorResponsePayload = void Error message payload
EventBridgeCapabilityOverrides
Types
type EventBridgeCapabilityOverrides = Partial<Omit<EventBridgeCapabilities, "consumerFailureHandling">> & { consumerFailureHandling: Partial<EventBridgeCapabilities["consumerFailureHandling"]> } Capability overrides accepted by `getEventBridgeMock` for strict reliability tests.
EventBridgeConfig
Types
type EventBridgeConfig = Prettify<{ defaultCommandTimeout: number; instanceId: string; logger: Logger; logLevel: LogLevelName; metrics: PuristaMetricsRuntimeOptions; metricsRecorder: PuristaMetricsRecorder; ... } & CustomConfig> The config object for an event bridge. Every event bridge implementation must use this type for configuration.
EventKey
Types
type EventKey = string & typeOperator EventMap
Types
type EventMap = Record<string, unknown> Event payload map where key is the event name and value is the payload type.
EventReceiver
Types
type EventReceiver = (parameter: T) => void ExportAsyncApiOptions
Types
type ExportAsyncApiOptions = void ExportKubernetesCronJobsOptions
Types
type ExportKubernetesCronJobsOptions = void ExportRuntimeCapabilitiesOptions
Types
type ExportRuntimeCapabilitiesOptions = void ExportScheduleManifestOptions
Types
type ExportScheduleManifestOptions = void FromCloudEventOptions
Types
type FromCloudEventOptions = void FromEmitToOtherType
Types
type FromEmitToOtherType = mapped Changes the canEmit proxy type to given type
FromInvokeToOtherType
Types
type FromInvokeToOtherType = mapped Changes the canInvoke proxy type to given type
FullDefinition
Types
type FullDefinition = void FullServiceDefinition
Types
type FullServiceDefinition = object GetMessageParamsType
Types
type GetMessageParamsType = TransformInputParamsSchema extends Schema ? InferIn<TransformInputParamsSchema> : ParamsSchema extends Schema ? InferIn<ParamsSchema> : unknown GetMessagePayloadType
Types
type GetMessagePayloadType = TransformInputPayloadSchema extends Schema ? InferIn<TransformInputPayloadSchema> : PayloadSchema extends Schema ? InferIn<PayloadSchema> : unknown HttpClientConfig
Types
type HttpClientConfig = Prettify<{ baseUrl: string; basicAuth: { password: string; username: string }; bearerToken: string; defaultHeaders: Record<string, string>; defaultTimeout: number; enableOpentelemetry: boolean; ... } & CustomConfig> Basic configuration for HttpClient.
HttpClientRequestOptions
Types
type HttpClientRequestOptions = void Options for a single HTTP request.
HttpExposedServiceMeta
Types
type HttpExposedServiceMeta = Prettify<CommandDefinitionMetadataBase & { expose: { http: { method: unknown; mode: unknown; openApi: unknown; path: unknown; stream: unknown } } }> HttpExposureOptions
Types
type HttpExposureOptions = void Infer
Types
type Infer = StandardSchemaV1.InferOutput<TSchema> Infers output type from a schema.
InferIn
Types
type InferIn = StandardSchemaV1.InferInput<TSchema> Infers input type from a schema.
InferMetricAttributes
Types
type InferMetricAttributes = Definition extends PuristaMetricDefinition<AttributesSchema> ? AttributesSchema extends Schema ? InferIn<AttributesSchema> : undefined : never Infers the attribute input type for a metric definition.
InferOptionalInput
Types
type InferOptionalInput = [NonNullable<T>] extends [never] ? unknown : NonNullable<T> extends Schema ? InferIn<NonNullable<T>> : unknown Infers an agent tool input schema when one is declared, otherwise falls back to `unknown`.
InferOptionalOutput
Types
type InferOptionalOutput = [NonNullable<T>] extends [never] ? unknown : NonNullable<T> extends Schema ? Infer<NonNullable<T>> : unknown Infers an agent tool output schema when one is declared, otherwise falls back to `unknown`.
InferParameter
Types
type InferParameter = S extends Schema ? InferIn<S> : unknown InferPayload
Types
type InferPayload = S extends Schema ? InferIn<S> : unknown InferTypeOrEmptyObject
Types
type InferTypeOrEmptyObject = T extends Schema ? Infer<T> extends EmptyObject ? Infer<T> : EmptyObject : EmptyObject InFlightDiagnostics
Types
type InFlightDiagnostics = void InFlightExecutionCounts
Types
type InFlightExecutionCounts = Record<"command" | "subscription" | "stream" | "generic", number> InfoInvokeTimeout
Types
type InfoInvokeTimeout = { messageType: EBMessageType.InfoInvokeTimeout } & InfoServiceBase InfoInvokeTimeoutPayload
Types
type InfoInvokeTimeoutPayload = void InfoMessage
Types
type InfoMessage = InfoServiceDrain | InfoServiceFunctionAdded | InfoServiceInit | InfoServiceNotReady | InfoServiceReady | InfoServiceShutdown | InfoInvokeTimeout | InfoSubscriptionError InfoMessageType
Types
type InfoMessageType = EBMessageType.InfoServiceDrain | EBMessageType.InfoServiceFunctionAdded | EBMessageType.InfoServiceInit | EBMessageType.InfoServiceNotReady | EBMessageType.InfoServiceReady | EBMessageType.InfoServiceShutdown | EBMessageType.InfoInvokeTimeout | EBMessageType.InfoSubscriptionError InfoServiceBase
Types
type InfoServiceBase = Prettify<{ contentEncoding: "utf-8"; contentType: "application/json"; payload: unknown } & EBMessageBase> InfoServiceDrain
Types
type InfoServiceDrain = Prettify<{ messageType: EBMessageType.InfoServiceDrain } & InfoServiceBase> InfoServiceFunctionAdded
Types
type InfoServiceFunctionAdded = Prettify<{ messageType: EBMessageType.InfoServiceFunctionAdded } & InfoServiceBase> InfoServiceInit
Types
type InfoServiceInit = Prettify<{ messageType: EBMessageType.InfoServiceInit } & InfoServiceBase> InfoServiceNotReady
Types
type InfoServiceNotReady = Prettify<{ messageType: EBMessageType.InfoServiceNotReady } & InfoServiceBase> InfoServiceReady
Types
type InfoServiceReady = Prettify<{ messageType: EBMessageType.InfoServiceReady } & InfoServiceBase> InfoServiceShutdown
Types
type InfoServiceShutdown = Prettify<{ messageType: EBMessageType.InfoServiceShutdown } & InfoServiceBase> InfoSubscriptionError
Types
type InfoSubscriptionError = Prettify<{ messageType: EBMessageType.InfoSubscriptionError } & InfoServiceBase> InstanceConfigType
Types
type InstanceConfigType = Prettify<{ ai: AgentRuntimeOptions<Record<unknown, unknown>>; configStore: ConfigStore; logger: Logger; logLevel: LogLevelName; metrics: PuristaMetricsRuntimeOptions; metricsRecorder: PuristaMetricsRecorder; ... } & typeOperator extends never ? { resources: never } : { resources: unknown[unknown] } & typeOperator extends never ? { serviceConfig: never } : { serviceConfig: unknown[unknown] }> Runtime configuration accepted by `ServiceBuilder.getInstance(...)`.
InstanceId
Types
type InstanceId = string the instance id of the event bridge
InstanceOrType
Types
type InstanceOrType = T extends Constructor ? InstanceType<T> : T InvokeFunction
Types
type InvokeFunction = (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.
InvokeList
Types
type InvokeList = Record<string, Record<string, Record<string, { outputSchema: Schema; parameterSchema: Schema; payloadSchema: Schema }>>> InvokeValidationMap
Types
type InvokeValidationMap = object IsConstructor
Types
type IsConstructor = T extends Constructor ? true : false JsonRecord
Types
type JsonRecord = Record<string, unknown> JSON object shape used by provider export helpers for provider-native manifest fragments.
JsonSchemaOptions
Types
type JsonSchemaOptions = void KubernetesCronJobManifest
Types
type KubernetesCronJobManifest = void KubernetesCronJobScheduleInput
Types
type KubernetesCronJobScheduleInput = void KubernetesCronJobTriggerTemplate
Types
type KubernetesCronJobTriggerTemplate = void LogFnParamType
Types
type LogFnParamType = [unknown, optional, rest] | [string, rest] LoggerOptions
Types
type LoggerOptions = void LoggerStubs
Types
type LoggerStubs = void LogLevelName
Types
type LogLevelName = "info" | "error" | "warn" | "debug" | "trace" | "fatal" MetricAttributeArgs
Types
type MetricAttributeArgs = [Attributes] extends [undefined] ? [] : [attributes] Method argument tuple for metric attributes.
NeverObject
Types
type NeverObject = Record<string, never> Newable
Types
type Newable = (config: ServiceConstructorInput<S>) => T Constructor type accepted by `ServiceBuilder.setCustomClass(...)`.
NonEmptyString
Types
type NonEmptyString = "" extends T ? never : T ObjectWithKeysFromStringArray
Types
type ObjectWithKeysFromStringArray = mapped Type helper which can create a typed record, based on given string array type.
OpenStreamFunction
Types
type OpenStreamFunction = (address: EBMessageAddress, payload: PayloadType, parameter: ParameterType) => Promise<StreamHandle<Chunk, Final>> PausedQueueWorkerState
Types
type PausedQueueWorkerState = void PausedSubscriptionConsumerHealthState
Types
type PausedSubscriptionConsumerHealthState = PausedSubscriptionConsumerState & { registrationKey: string } PausedSubscriptionConsumersByRegistrationKey
Types
type PausedSubscriptionConsumersByRegistrationKey = Record<string, PausedSubscriptionConsumerState> PausedSubscriptionConsumerState
Types
type PausedSubscriptionConsumerState = void PendigInvocation
Types
type PendigInvocation = void Prettify
Types
type Prettify = mapped & object PrincipalId
Types
type PrincipalId = string the principal id
PuristaMetricAttributes
Types
type PuristaMetricAttributes = Record<string, PuristaMetricAttributeValue> Attribute map accepted by PURISTA metrics after low-cardinality policy checks.
PuristaMetricAttributeValue
Types
type PuristaMetricAttributeValue = string | number | boolean Scalar metric attribute value accepted by PURISTA.
PuristaMetricContext
Types
type PuristaMetricContext = mapped Typed metric context exposed to handlers.
PuristaMetricContextProperty
Types
type PuristaMetricContextProperty = void Adds the typed PURISTA metric context to a handler context type.
PuristaMetricDefinitions
Types
type PuristaMetricDefinitions = Record<string, PuristaMetricDefinition<any>> Named metric definitions keyed by their metric name.
PuristaMetricHandle
Types
type PuristaMetricHandle = Definition extends { kind: "histogram" } ? { record: void } : { add: void } Handler-facing metric handle. Counters use `add`; histograms use `record`.
PuristaMetricKind
Types
type PuristaMetricKind = "counter" | "upDownCounter" | "histogram" Supported PURISTA metric instrument kinds.
PuristaMetricRecord
Types
type PuristaMetricRecord = MemoryMetricRecord QueryParameter
Types
type QueryParameter = void QueueContext
Types
type QueueContext = void QueueDefinitionList
Types
type QueueDefinitionList = Promise<QueueDefinition>[] QueueDefinitionListResolved
Types
type QueueDefinitionListResolved = QueueDefinition[] QueueHealthState
Types
type QueueHealthState = void QueueHealthStatus
Types
type QueueHealthStatus = "ok" | "warn" | "error" QueueInvokeClientMap
Types
type QueueInvokeClientMap = mapped QueueInvokeFunction
Types
type QueueInvokeFunction = (queueName: string, payload: Payload, parameter?: Params, options?: Omit<QueueEnqueueOptions<Payload, Params>, "queueName" | "payload" | "parameter">) => Promise<QueueEnqueueResult> QueueInvokeList
Types
type QueueInvokeList = Record<string, { parameterSchema: Schema; payloadSchema: Schema }> QueueJobStatusRecord
Types
type QueueJobStatusRecord = void QueueJobStore
Types
type QueueJobStore = void QueueLease
Types
type QueueLease = void QueueResultPolicyDelivery
Types
type QueueResultPolicyDelivery = "required" | "best-effort" Delivery requirement for queue result publication.
QueueResultStatus
Types
type QueueResultStatus = "success" | "failed" | "cancelled" | "dead-lettered" | "progress" Canonical queue result status values.
QueueScheduleFunction
Types
type QueueScheduleFunction = (queueName: string, runAt: Date | number, payload: Payload, parameter?: Params, options?: Omit<QueueEnqueueOptions<Payload, Params>, "queueName" | "payload" | "parameter" | "delayMs">) => Promise<QueueEnqueueResult> QueueScheduleProxy
Types
type QueueScheduleProxy = mapped QueueWorkerAfterGuardHook
Types
type QueueWorkerAfterGuardHook = (this: S, context: QueueJobContext<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes>, result: Readonly<QueueHandlerResult | undefined>, message: Readonly<QueueMessage<MessagePayloadType, MessageParamsType>>) => Promise<void> QueueWorkerBeforeGuardHook
Types
type QueueWorkerBeforeGuardHook = (this: S, context: QueueJobContext<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes>, message: Readonly<QueueMessage<MessagePayloadType, MessageParamsType>>) => Promise<void> QueueWorkerDefinitionList
Types
type QueueWorkerDefinitionList = Promise<QueueWorkerDefinition>[] QueueWorkerDefinitionListResolved
Types
type QueueWorkerDefinitionListResolved = QueueWorkerDefinition[] QueueWorkerPauseHealthState
Types
type QueueWorkerPauseHealthState = PausedQueueWorkerState & { queueName: string } QueueWorkerPauseStateByQueue
Types
type QueueWorkerPauseStateByQueue = Record<string, PausedQueueWorkerState> RuntimeBridgeCapabilities
Types
type RuntimeBridgeCapabilities = void RuntimeCapabilityReportMode
Types
type RuntimeCapabilityReportMode = "definition-only" | "runtime-inspect" ScheduleConcurrencyPolicy
Types
type ScheduleConcurrencyPolicy = "allow" | "forbid" | "replace" ScheduleDefinition
Types
type ScheduleDefinition = void Provider-neutral schedule metadata exported from PURISTA definitions.
ScheduleExpression
Types
type ScheduleExpression = { kind: "cron"; timezone: string; value: string } | { everyMs: number; kind: "interval" } | { kind: "oneShot"; runAt: string | number | Date } ScheduleManifest
Types
type ScheduleManifest = void ScheduleMissedRunPolicy
Types
type ScheduleMissedRunPolicy = "skip" | "runOnce" | "backfill" ScheduleOptions
Types
type ScheduleOptions = void ScheduleTargetKind
Types
type ScheduleTargetKind = "event" | "queue" | "command" Schema
Types
type Schema = StandardSchemaV1 Common Standard Schema abstraction used across PURISTA boundaries.
SecretStoreCacheMap
Types
type SecretStoreCacheMap = Map<string, { createdAt: number; value: string }> ServiceBuilderTypes
Types
type ServiceBuilderTypes = void ServiceClassMetrics
Types
type ServiceClassMetrics = S extends { __serviceClassTypes: Types } ? Types extends ServiceClassTypes<any, any, Metrics> ? Metrics extends PuristaMetricDefinitions ? Metrics : EmptyObject : EmptyObject : EmptyObject ServiceClassTypes
Types
type ServiceClassTypes = void ServiceContractInput
Types
type ServiceContractInput = FullDefinition | FullServiceDefinition ServiceDefinitions
Types
type ServiceDefinitions = void ServiceHealthState
Types
type ServiceHealthState = void ServiceHealthStatus
Types
type ServiceHealthStatus = "ok" | "warn" | "error" ServiceInfoType
Types
type ServiceInfoType = void General service information
SetNewTypeValue
Types
type SetNewTypeValue = mapped SetNewTypeValues
Types
type SetNewTypeValues = mapped ShutdownEntry
Types
type ShutdownEntry = void Entry of thing you like to shutdown gracefully
StoreBaseConfig
Types
type StoreBaseConfig = Prettify<{ cacheTtl: number; enableCache: boolean; enableGet: boolean; enableRemove: boolean; enableSet: boolean; logger: Logger; ... } & Config> Basic configuration object which is used by any store
StreamContextMockResult
Types
type StreamContextMockResult = void StreamContextMockServiceClass
Types
type StreamContextMockServiceClass = T extends StreamDefinitionBuilder<S, any> ? S : ServiceClass StreamControl
Types
type StreamControl = Prettify<{ correlationId: CorrelationId; messageType: EBMessageType.Stream; payload: StreamControlPayload; receiver: EBMessageAddress & Required<unknown> } & EBMessageBase> StreamControlPayload
Types
type StreamControlPayload = void StreamDefinition
Types
type StreamDefinition = void StreamDefinitionBuilderTypes
Types
type StreamDefinitionBuilderTypes = void Type accumulator used by `StreamDefinitionBuilder` for schemas, invocations, events, and queue access.
StreamDefinitionList
Types
type StreamDefinitionList = Promise<StreamDefinition<S, any, any, any, any, any, any, any, any, any, any, StreamDefinitionMetadataBase, any>>[] StreamDefinitionListResolved
Types
type StreamDefinitionListResolved = StreamDefinition<S, any, any, any, any, any, any, any, any, any, any, StreamDefinitionMetadataBase, any>[] StreamDefinitionMetadataBase
Types
type StreamDefinitionMetadataBase = void StreamErrorPayload
Types
type StreamErrorPayload = void StreamFrame
Types
type StreamFrame = Prettify<{ correlationId: CorrelationId; messageType: EBMessageType.Stream; payload: StreamFramePayload<Chunk, Final>; receiver: EBMessageSenderAddress } & EBMessageBase> StreamFramePayload
Types
type StreamFramePayload = void StreamFrameType
Types
type StreamFrameType = "open" | "start" | "chunk" | "complete" | "error" | "cancel" | "heartbeat" StreamFunction
Types
type StreamFunction = (this: S, context: StreamFunctionContext<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes, EmitList, QueueInvokes, ServiceClassMetrics<S>>, payload: Readonly<FunctionPayloadType>, parameter: Readonly<FunctionParamsType>, writer: StreamWriter<ChunkType, FinalType>) => Promise<void> StreamFunctionContext
Types
type StreamFunctionContext = Prettify<ContextBase<Metrics> & PuristaMetricContextProperty<Metrics> & StreamFunctionContextEnhancements<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes, EmitList, QueueInvokes>> StreamFunctionContextEnhancements
Types
type StreamFunctionContextEnhancements = void StreamInvokeList
Types
type StreamInvokeList = Record<string, Record<string, Record<string, { chunkSchema: Schema; finalSchema: Schema; parameterSchema: Schema; payloadSchema: Schema; validateChunk: boolean; validateFinal: boolean }>>> StreamMessage
Types
type StreamMessage = StreamOpenRequest | StreamControl | StreamFrame<Chunk, Final> StreamOpenRequest
Types
type StreamOpenRequest = Prettify<{ correlationId: CorrelationId; messageType: EBMessageType.Stream; payload: StreamOpenRequestPayload<PayloadType, ParameterType>; receiver: EBMessageAddress } & EBMessageBase> StreamOpenRequestPayload
Types
type StreamOpenRequestPayload = void SubscriptionContextMockResult
Types
type SubscriptionContextMockResult = void SubscriptionContextMockServiceClass
Types
type SubscriptionContextMockServiceClass = T extends SubscriptionDefinitionBuilder<S, any> ? S : ServiceClass SubscriptionDefinitionBuilderTypes
Types
type SubscriptionDefinitionBuilderTypes = void Type accumulator used by `SubscriptionDefinitionBuilder` for schemas, hooks, invocations, events, and queues.
SubscriptionDefinitionList
Types
type SubscriptionDefinitionList = Promise<SubscriptionDefinition<ServiceClassType, any, any, any, any, any, any, any, any, any, any, any, SubscriptionDefinitionMetadataBase, any>>[] Helper type for creating list of service commands to be passed as input to service class
SubscriptionDefinitionListResolved
Types
type SubscriptionDefinitionListResolved = SubscriptionDefinition<ServiceClassType, any, any, any, any, any, any, any, any, any, any, any, SubscriptionDefinitionMetadataBase, any>[] SubscriptionDefinitionMetadataBase
Types
type SubscriptionDefinitionMetadataBase = void SubscriptionHandlerControlResult
Types
type SubscriptionHandlerControlResult = Exclude<SubscriptionHandlerResult, { status: "ack" }> SubscriptionHandlerResult
Types
type SubscriptionHandlerResult = { status: "ack" } | { delayMs: number; reason: string; status: "retry" } | { reason: string; status: "deadLetter" } | { reason: string; status: "drop" } | { reason: string; status: "stop-consumer" } SubscriptionStorageEntry
Types
type SubscriptionStorageEntry = void SupportedHttpMethod
Types
type SupportedHttpMethod = "GET" | "POST" | "PATCH" | "PUT" | "DELETE" Supported HTTP-Methods for defining endpoints
TenantId
Types
type TenantId = string the tenant id
TraceId
Types
type TraceId = string The trace id which will be passed through all commands, invocations and subscriptions
ValidationResult
Types
type ValidationResult = { data: TOutput; success: true } | { issues: ReadonlyArray<StandardSchemaV1.Issue>; success: false } Unified validation result shape for all supported schema vendors.
Variables
11 entries
CONFIG_FILE_NAME
Variables
const CONFIG_FILE_NAME: "purista.client.json" configFullSchema
Variables
const configFullSchema: ZodObject<{ buildAs: ZodDefault<ZodLiteral<"esm">>; definitionPath: ZodString; eventBridgeClient: ZodObject<{ clientName: ZodDefault<unknown> }, $strip>; httpClient: ZodObject<{ clientName: ZodDefault<unknown> }, $strip>; outputPath: ZodString; package: ZodOptional<ZodObject<{ description: unknown; name: unknown; private: unknown }, $strip>>; ... }, $strip> configSchema
Variables
const configSchema: ZodObject<{ buildAs: ZodDefault<ZodLiteral<"esm">>; definitionPath: ZodString; eventBridgeClient: ZodOptional<ZodObject<{ clientName: unknown }, $strip>>; httpClient: ZodOptional<ZodObject<{ clientName: unknown }, $strip>>; outputPath: ZodString; package: ZodOptional<ZodObject<{ description: unknown; name: unknown; private: unknown }, $strip>>; ... }, $strip> defaultQueueLifecycleConfig
Variables
const defaultQueueLifecycleConfig: QueueLifecycleConfig Opinionated defaults for queues so builders can omit lifecycle overrides yet still get resilient behaviour.
eventBridgeClientConfigSchema
Variables
const eventBridgeClientConfigSchema: ZodObject<{ clientName: ZodDefault<ZodString> }, $strip> frameworkMetricDefinitions
Variables
const frameworkMetricDefinitions: { http.client.request.duration: PuristaMetricDefinition<undefined>; http.server.active_requests: PuristaMetricDefinition<undefined>; http.server.request.duration: PuristaMetricDefinition<undefined>; messaging.client.consumed.messages: PuristaMetricDefinition<undefined>; messaging.client.operation.duration: PuristaMetricDefinition<undefined>; messaging.client.sent.messages: PuristaMetricDefinition<undefined>; ... } PURISTA framework metric catalog.
httpClientConfigSchema
Variables
const httpClientConfigSchema: ZodObject<{ clientName: ZodDefault<ZodString> }, $strip> infoMessageTypes
Variables
const infoMessageTypes: EBMessageType[] MIN_CONTENT_SIZE_FOR_COMPRESSION
Variables
const MIN_CONTENT_SIZE_FOR_COMPRESSION: 1024 puristaVersion
Variables
const puristaVersion: "3.0.1" The PURISTA package version embedded in the published runtime build.
ServiceInfoValidator
Variables
const ServiceInfoValidator: { set: void } Functions
54 entries
assertNonArrowFunction
Functions
assertNonArrowFunction(fn: (...args: never[]) => unknown, label: string): void convertEmitValidationsToSchema
Functions
convertEmitValidationsToSchema<T>(emits: T): Promise<FromEmitToOtherType<T, SchemaObject>> convertInvokeValidationsToSchema
Functions
convertInvokeValidationsToSchema<T>(invokes: T): Promise<FromInvokeToOtherType<T, { outputSchema: SchemaObject; parameterSchema: SchemaObject; payloadSchema: SchemaObject }>> createInvokeFunctionProxy
Functions
createInvokeFunctionProxy<TFaux>(invokeOg: InvokeFunction, address?: EBMessageAddress, lvl: number): TFaux createMemoryMetricsRecorder
Functions
createMemoryMetricsRecorder(options: PuristaMetricsRuntimeOptions): PuristaMetricsRecorder & { records: MemoryMetricRecord[]; clear: void } createMetricContext
Functions
createMetricContext<Definitions>(definitions: Definitions, recorder: PuristaMetricsRecorder): PuristaMetricContext<Definitions> createNoopMetricsRecorder
Functions
createNoopMetricsRecorder(): PuristaMetricsRecorder createOpenStreamFunctionProxy
Functions
createOpenStreamFunctionProxy<TFaux>(openStreamOg: OpenStreamFunction, address?: EBMessageAddress, lvl: number): TFaux createQueueEnqueueProxy
Functions
createQueueEnqueueProxy<TQueues>(enqueueFn: QueueInvokeFunction, queues?: TQueues): QueueInvokeFunction & QueueInvokeClientMap<TQueues> createQueueScheduleProxy
Functions
createQueueScheduleProxy<TQueues>(scheduleFn: QueueScheduleFunction, queues?: TQueues): QueueScheduleFunction & QueueScheduleProxy<QueueInvokeClientMap<TQueues>> createStateStoreQueueJobStore
Functions
createStateStoreQueueJobStore(stateStore: StateStore, prefix: string): QueueJobStore exportAsyncApi
Functions
exportAsyncApi(options: ExportAsyncApiOptions): Promise<{ asyncapi: string; channels: JsonRecord; components: { messages: JsonRecord; schemas: { PuristaHeaders: { properties: unknown; type: unknown } } }; defaultContentType: string; info: { title: string; version: string }; operations: JsonRecord; ... }> exportCloudEventsSchema
Functions
exportCloudEventsSchema(): { $schema: string; properties: { contentencoding: { type: string }; correlationid: { type: string }; data: boolean; datacontenttype: { type: string }; id: { type: string }; instanceId: { type: string }; ... }; required: string[]; title: string; type: string } exportKubernetesCronJobs
Functions
exportKubernetesCronJobs(options: ExportKubernetesCronJobsOptions): Promise<KubernetesCronJobManifest[]> exportRuntimeCapabilities
Functions
exportRuntimeCapabilities(options: ExportRuntimeCapabilitiesOptions): { eventBridge: { capabilities: EventBridgeCapabilities | undefined; name: string } | undefined; mode: RuntimeCapabilityReportMode; queueBridge: { capabilities: QueueBridgeCapabilities | undefined; idempotency: { enforced: unknown; exactlyOnce: unknown } | undefined; longRunning: { leaseExtension: unknown; leaseInspection: unknown; strictStartupValidation: unknown } | undefined; name: string; resultPolicies: { event: unknown; state: unknown; stateAndEvent: unknown } | undefined } | undefined; version: string } exportScheduleManifest
Functions
exportScheduleManifest(options: ExportScheduleManifestOptions): Promise<ScheduleManifest> exportServiceDefinitions
Functions
exportServiceDefinitions(serviceBuilders: ServiceBuilder<ServiceBuilderTypes>[]): Promise<FullDefinition> fromCloudEvent
Functions
fromCloudEvent<Payload>(cloudEvent: JsonRecord | CloudEvent, options: FromCloudEventOptions): { contentEncoding: string; contentType: string; correlationId: string; eventName: string; id: string; messageType: CustomMessage; ... } getCommandFunctionWithValidation
Functions
getCommandFunctionWithValidation<S>(fn: CommandFunction<S, unknown, unknown, unknown, unknown, unknown, any, any, any, any, any>, inputPayloadSchema: Schema | undefined, inputParameterSchema: Schema | undefined, outputPayloadSchema: Schema | undefined, beforeGuards: Record<string, CommandBeforeGuardHook<S, unknown, unknown, unknown, unknown, any, any, any, any, any>>): (this: S, context: { configs: { getConfig: ConfigGetterFunction; removeConfig: ConfigDeleteFunction; setConfig: ConfigSetterFunction }; emit: EmitCustomMessageFunction<any>; logger: Logger; message: Readonly<Command<MessagePayloadType, MessageParamsType>>; metrics: PuristaMetricContext<Metrics>; queue: QueueContext & QueueContext<any>; ... }, payload: unknown, parameter: unknown) => Promise<unknown> getDefaultEventBridgeConfig
Functions
getDefaultEventBridgeConfig(): Complete<DefaultEventBridgeConfig> getDefaultLogLevel
Functions
getDefaultLogLevel(): LogLevelName getFrameworkMetricDefinition
Functions
getFrameworkMetricDefinition(name: string): PuristaMetricDefinition<undefined> | undefined getNewSubscriptionStorageEntry
Functions
getNewSubscriptionStorageEntry(subscription: Subscription, cb: (message: EBMessage) => Promise<Omit<{ contentEncoding: unknown; contentType: unknown; correlationId: unknown; eventName: unknown; id: unknown; messageType: unknown; ... }, unknown | unknown> | undefined>): SubscriptionStorageEntry getSubscriptionFunctionWithValidation
Functions
getSubscriptionFunctionWithValidation<S>(fn: SubscriptionFunction<S, unknown, unknown, unknown, any, any, any, any, any>, inputPayloadSchema: Schema | undefined, inputParameterSchema: Schema | undefined, outputPayloadSchema: Schema | undefined, beforeGuards: Record<string, SubscriptionBeforeGuardHook<S, unknown, unknown, any, any, any, any, any>>): (this: S, context: { configs: { getConfig: ConfigGetterFunction; removeConfig: ConfigDeleteFunction; setConfig: ConfigSetterFunction }; emit: EmitCustomMessageFunction<any>; logger: Logger; message: Readonly<EBMessage>; metrics: PuristaMetricContext<Metrics>; queue: QueueContext & QueueContext<any>; ... }, payload: unknown, parameter: unknown) => Promise<unknown> getTimeoutPromise
Functions
getTimeoutPromise<T>(fn: Promise<T>, ttl: number): Promise<T> initDefaultConfigStore
Functions
initDefaultConfigStore(options: { logger: Logger }): DefaultConfigStore initDefaultSecretStore
Functions
initDefaultSecretStore(options: { logger: Logger }): DefaultSecretStore initDefaultStateStore
Functions
initDefaultStateStore(options: { logger: Logger }): DefaultStateStore initLogger
Functions
initLogger(level: LogLevelName, opt?: LoggerOptions<never, boolean>): Logger isAllowedMetricAttributeKey
Functions
isAllowedMetricAttributeKey(key: string): boolean isCustomMessage
Functions
isCustomMessage(message: EBMessage): message isHttpExposedServiceMeta
Functions
isHttpExposedServiceMeta(input?: unknown): input isInfoMessage
Functions
isInfoMessage(message: EBMessage): message isInfoServiceFunctionAdded
Functions
isInfoServiceFunctionAdded(message: EBMessage): message isMessageMatchingSubscription
Functions
isMessageMatchingSubscription(_log: Logger, message: EBMessage, subscription: SubscriptionStorageEntry): boolean isStreamControl
Functions
isStreamControl(message: StreamMessage): message isStreamFrame
Functions
isStreamFrame<Chunk, Final>(message: StreamMessage<Chunk, Final>): message isStreamMessage
Functions
isStreamMessage(message: EBMessage): message isStreamOpenRequest
Functions
isStreamOpenRequest(message: StreamMessage): message isSubscriptionConsumerControlError
Functions
isSubscriptionConsumerControlError(value: unknown): value isSubscriptionHandlerControlResult
Functions
isSubscriptionHandlerControlResult(value: unknown): value isSubscriptionHandlerResult
Functions
isSubscriptionHandlerResult(value: unknown): value mergeMetricAttributes
Functions
mergeMetricAttributes(defaultAttributes?: PuristaMetricAttributes, attributes?: PuristaMetricAttributes): { attributes: PuristaMetricAttributes; droppedAttributeKeys: string[] } mergeServiceDefinition
Functions
mergeServiceDefinition<T>(existing: FullServiceDefinition, definitionToAdd: ServiceDefinitions): T safeBind
Functions
safeBind<ThisType, Args, ReturnType>(fn: (this: ThisType, ...args: Args) => ReturnType, thisArg: ThisType): (...args: Args) => ReturnType schemaObjectToTsType
Functions
schemaObjectToTsType(schemaObject: SchemaObject | ReferenceObject, options?: Partial<GlobalContext>): string throwIfNotValidMessage
Functions
throwIfNotValidMessage(input: unknown): void toCloudEvent
Functions
toCloudEvent<Payload>(message: { contentEncoding: string; contentType: string; correlationId: string; eventName: string; id: string; messageType: CustomMessage; ... }): CloudEvent toJSONSchema
Functions
toJSONSchema(schema: Schema, options?: JsonSchemaOptions): Promise<SchemaObject> transformSchemaObject
Functions
transformSchemaObject(schemaObject: SchemaObject | ReferenceObject, ctx: GlobalContext, path: string): string validate
Functions
validate<TSchema>(schema: TSchema, value: unknown): Promise<ValidationResult<Infer<TSchema>>> validateMetricAttributes
Functions
validateMetricAttributes(attributes?: Record<string, unknown>): { attributes: PuristaMetricAttributes; droppedAttributeKeys: string[] } validateMetricDefinition
Functions
validateMetricDefinition(name: string, definition: PuristaMetricDefinition<any>, knownMetricNames: Iterable<string>): Promise<void> validateMetricDefinitions
Functions
validateMetricDefinitions(definitions: Record<string, PuristaMetricDefinition<any>>): Promise<void> Command
17 entries
CommandDefinitionBuilder
Classes
class CommandDefinitionBuilder<S, C> 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.
CommandAfterGuardHook
Types
type CommandAfterGuardHook = (this: S, context: CommandFunctionContext<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes, EmitList, QueueInvokes>, result: Readonly<FunctionOutputType>, originalPayload: Readonly<FunctionPayloadType>, originalParameter: Readonly<FunctionParamsType>) => Promise<void> Definition of after guard hook functions. This guard is called after function successfully returns and after output validation.
CommandBeforeGuardHook
Types
type CommandBeforeGuardHook = (this: S, context: CommandFunctionContext<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes, EmitList, QueueInvokes>, 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.
CommandDefinition
Types
type CommandDefinition = void The definition for a command provided by some service.
CommandErrorResponse
Types
type CommandErrorResponse = Prettify<{ contentEncoding: "utf-8"; contentType: "application/json"; correlationId: CorrelationId; isHandledError: boolean; messageType: EBMessageType.CommandErrorResponse; payload: { data: unknown; message: string; status: StatusCode }; ... } & EBMessageBase> CommandErrorResponse is a response to a specific previously received command which indicates some failure.
CommandFunction
Types
type CommandFunction = (this: S, context: CommandFunctionContext<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes, EmitList, QueueInvokes, ServiceClassMetrics<S>>, payload: Readonly<FunctionPayloadType>, parameter: Readonly<FunctionParamsType>) => Promise<FunctionOutputType> CommandFunction is a function which will be triggered when a matching event bridge message is received by the service
CommandFunctionContext
Types
type CommandFunctionContext = Prettify<ContextBase<Metrics> & PuristaMetricContextProperty<Metrics> & CommandFunctionContextEnhancements<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes, EmitList, QueueInvokes>> The command function context which will be passed into command function.
CommandFunctionContextEnhancements
Types
type CommandFunctionContextEnhancements = void It provides the original command message with types for payload and parameter. Also, the methods:
CommandResponse
Types
type CommandResponse = CommandSuccessResponse<T> | CommandErrorResponse CommandResponse is a response to a specific previously received command which can be either a success or failure
CommandSuccessResponse
Types
type CommandSuccessResponse = Prettify<{ correlationId: CorrelationId; messageType: EBMessageType.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
CommandTransformFunctionContext
Types
type CommandTransformFunctionContext = Prettify<ContextBase & { message: Readonly<Command<unknown, unknown>>; resources: Resources }> CommandTransformInputHook
Types
type CommandTransformInputHook = (this: S, context: CommandTransformFunctionContext<MessagePayloadType, MessageParamsType, Resources>, payload: Readonly<TransformInputPayload>, parameter: Readonly<TransformInputParams>) => Promise<{ parameter: FunctionParamsType; payload: FunctionPayloadType }> 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.
CommandTransformOutputHook
Types
type CommandTransformOutputHook = (this: S, context: CommandTransformFunctionContext<MessagePayloadType, MessageParamsType, Resources>, input: Readonly<FinalFunctionOutputType>, params: Readonly<FunctionParamsType>) => Promise<TransformOutputHookOutput> This transform hook is executed after function output validation and AfterGuardHooks.
isCommand
Functions
isCommand(message: EBMessage): message isCommandErrorResponse
Functions
isCommandErrorResponse(message: unknown): message isCommandResponse
Functions
isCommandResponse(message: EBMessage): message isCommandSuccessResponse
Functions
isCommandSuccessResponse(message: EBMessage): message Event bridge
23 entries
EventBridgeCommandTransport
Enums
enum EventBridgeCommandTransport Command request/response transport strategy used by an event bridge.
EventBridgeLateResponseHandling
Enums
enum EventBridgeLateResponseHandling Policy for command responses that arrive after invocation timeout.
EventBridgeResponseConfirmationLevel
Enums
enum EventBridgeResponseConfirmationLevel Confirmation level available for command responses.
EventBridgeStreamLateFrameHandling
Enums
enum EventBridgeStreamLateFrameHandling Policy for stream frames that arrive after stream timeout.
DefaultEventBridge
Classes
class DefaultEventBridge Process-local in-memory event bridge for development and tests.
EventBridgeBaseClass
Classes
class EventBridgeBaseClass<ConfigType> The base class to be extended by event bridge implementations
InFlightExecutionTracker
Classes
class InFlightExecutionTracker Tracks active event bridge handler promises for drain and health reporting.
PendingInvocationRegistry
Classes
class PendingInvocationRegistry<T> Registry for command invocations awaiting correlated responses.
PendingStreamRegistry
Classes
class PendingStreamRegistry<Chunk, Final> Registry for stream invocations awaiting correlated frames.
EventBridge
Interfaces
interface EventBridge Event transport adapter contract used by PURISTA services.
DefinitionEventBridgeConfig
Types
type DefinitionEventBridgeConfig = void Event bridge delivery requirements requested by command, stream, or subscription definitions.
DefinitionEventBridgeConsumerFailureHandling
Types
type DefinitionEventBridgeConsumerFailureHandling = void Advisory failure handling for broker-backed consumers such as subscriptions.
DefinitionEventBridgeConsumerFailureMode
Types
type DefinitionEventBridgeConsumerFailureMode = "strict" | "best-effort" Startup behavior when requested consumer failure semantics are unsupported.
EventBridgeCapabilities
Types
type EventBridgeCapabilities = void Capability matrix reported by an EventBridge.
EventBridgeCommandCapabilities
Types
type EventBridgeCommandCapabilities = void Command reliability capabilities for an event bridge.
EventBridgeConsumerFailureCapabilities
Types
type EventBridgeConsumerFailureCapabilities = void Subscription consumer failure capabilities for an event bridge.
EventBridgeInFlightExecutionCounts
Types
type EventBridgeInFlightExecutionCounts = Record<InFlightExecutionKind, number> In-flight execution counts grouped by work kind.
EventBridgeStreamCapabilities
Types
type EventBridgeStreamCapabilities = void Stream transport capabilities for an event bridge.
InFlightExecutionKind
Types
type InFlightExecutionKind = "command" | "subscription" | "stream" | "generic" Work kind tracked during event bridge drain and diagnostics.
PendingInvocation
Types
type PendingInvocation = void Internal pending command invocation callbacks and timeout handle.
PendingStreamSession
Types
type PendingStreamSession = void Mutable stream session stored for one pending stream invocation.
PushResult
Types
type PushResult = "accepted" | "late" | "missing" Result of routing a stream frame or error to a pending stream session.
getCommandQueueName
Functions
getCommandQueueName(address: EBMessageAddress): string Helper
19 entries
convertToCamelCase
Functions
convertToCamelCase(str: string): string convertToKebabCase
Functions
convertToKebabCase(str: string): string convertToPascalCase
Functions
convertToPascalCase(str: string): string convertToSnakeCase
Functions
convertToSnakeCase(str: string): string createErrorResponse
Functions
createErrorResponse(instanceId: string, originalEBMessage: Readonly<Command>, statusCode: StatusCode, error?: unknown): Readonly<Omit<CommandErrorResponse, "instanceId">> createInfoMessage
Functions
createInfoMessage(messageType: InfoMessageType, sender: { instanceId: string; serviceName: string; serviceTarget: string; serviceVersion: string }, additional?: Partial<InfoMessage>): InfoMessage createSuccessResponse
Functions
createSuccessResponse<T>(instanceId: string, originalEBMessage: Readonly<Command>, payload: T, eventName?: string, contentType: string, contentEncoding: string): Readonly<CommandSuccessResponse<T>> deserializeOtp
Functions
deserializeOtp(logger: Logger, otp?: string): Context | undefined getCleanedMessage
Functions
getCleanedMessage(message: Readonly<EBMessage>, stripeOutContent: boolean): Record<string, unknown> getErrorMessageForCode
Functions
getErrorMessageForCode(code: StatusCode): string getNewCorrelationId
Functions
getNewCorrelationId(): string getNewEBMessageId
Functions
getNewEBMessageId(): string getNewInstanceId
Functions
getNewInstanceId(): string getNewTraceId
Functions
getNewTraceId(): string getSubscriptionQueueName
Functions
getSubscriptionQueueName(address: EBMessageAddress): string getUniqueId
Functions
getUniqueId(): string gracefulShutdown
Functions
gracefulShutdown(logger: Logger, list: ShutdownEntry[], timeoutMs: number): void isDevelop
Functions
isDevelop(): boolean serializeOtp
Functions
serializeOtp(): string Queue
25 entries
DefinitionQueueBridgeConfig
Types
type DefinitionQueueBridgeConfig = void Queue bridge delivery requirements requested by the service definition.
EventToQueueBindingDefinition
Types
type EventToQueueBindingDefinition = void Binds an emitted event to a queue enqueue operation.
EventToQueueIdempotencyMode
Types
type EventToQueueIdempotencyMode = "advisory" | "strict" Idempotency requirement for event-to-queue bindings.
EventToQueueIdempotencyStrategy
Types
type EventToQueueIdempotencyStrategy = "messageId" | "correlationId" | "eventField" | "none" | (event: any) => string | undefined Strategy used to derive an idempotency key from the source event.
QueueDefinition
Types
type QueueDefinition = void Public definition of a queue contract attached to a PURISTA service.
QueueEnqueueOptions
Types
type QueueEnqueueOptions = void Options passed to a queue bridge when enqueueing work.
QueueExecutionProfileName
Types
type QueueExecutionProfileName = "longRunning" Named execution profile for queue workers.
QueueHandlerResult
Types
type QueueHandlerResult = { headers: Record<string, string>; output: unknown; status: "success" } | { delayMs: number; reason: string; status: "retry" } | { delayMs: number; fatal: boolean; reason: string; status: "fail" } Result returned by a queue worker handler.
QueueJobContext
Types
type QueueJobContext = ContextBase<Metrics> & PuristaMetricContextProperty<Metrics> & { emit: EmitCustomMessageFunction<EmitList>; job: QueueJobControls; message: Readonly<QueueMessage<MessagePayloadType, MessageParamsType>>; queue: QueueContext<QueueInvokes>; resources: Resources; service: Invokes; ... } Context object passed to queue worker handlers.
QueueJobControls
Types
type QueueJobControls = void Runtime controls available to a queue worker for the currently leased job.
QueueLifecycleConfig
Types
type QueueLifecycleConfig = void Queue retry, leasing, heartbeat, and poison-message policy.
QueueLongRunningExecutionProfile
Types
type QueueLongRunningExecutionProfile = void Runtime policy for work that may exceed a normal lease interval.
QueueMessage
Types
type QueueMessage = void Provider-neutral queue message shape used by bridges and workers.
QueueMetrics
Types
type QueueMetrics = void Queue operational metrics returned by a bridge.
QueueOrderingGuarantee
Types
type QueueOrderingGuarantee = "none" | "fifo" | "partition" Ordering guarantee requested by a queue definition.
QueueResultEventIdStrategy
Types
type QueueResultEventIdStrategy = "jobIdAndStatus" | (input: { attempt: number; jobId: string; queueName: string; status: QueueResultStatus }) => string Strategy used to generate result event ids.
QueueResultEventPayload
Types
type QueueResultEventPayload = void Payload emitted for queue result events.
QueueResultPolicy
Types
type QueueResultPolicy = void Controls how queue worker outcomes are persisted or emitted.
QueueResultPolicyMode
Types
type QueueResultPolicyMode = "none" | "event" | "state" | "state-and-event" Queue result publication mode.
QueueRetryStrategy
Types
type QueueRetryStrategy = void Exponential backoff settings for queue retries.
QueueTransformContext
Types
type QueueTransformContext = ContextBase & { resources: Resources } Context passed to queue transform hooks.
QueueTransformHook
Types
type QueueTransformHook = (this: S, context: QueueTransformContext<Resources>, payload: Readonly<Payload>, parameter: Readonly<Params | undefined>) => Promise<{ parameter: Params; payload: Payload }> Hook that can normalize queue payload and parameters before enqueue or execute.
QueueWorkerDefinition
Types
type QueueWorkerDefinition = void Public definition of a worker attached to a queue.
QueueWorkerHandler
Types
type QueueWorkerHandler = (context: QueueJobContext<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes, EmitList, QueueInvokes, Metrics>, message: QueueMessage<MessagePayloadType, MessageParamsType>) => Promise<QueueHandlerResult | undefined> Function that processes one leased queue message.
QueueWorkerMode
Types
type QueueWorkerMode = "continuous" | "interval" | "sequential" Queue worker polling mode.
Queue bridge
10 entries
DefaultQueueBridge
Classes
class DefaultQueueBridge In-memory queue bridge for development and unit tests.
QueueBridge
Interfaces
interface QueueBridge Queue transport adapter contract used by PURISTA services and queue workers.
DefaultQueueBridgeOptions
Types
type DefaultQueueBridgeOptions = void Configuration for the process-local DefaultQueueBridge.
QueueBridgeCapabilities
Types
type QueueBridgeCapabilities = void Capability matrix reported by a QueueBridge.
QueueDeadLetterListOptions
Types
type QueueDeadLetterListOptions = void Pagination options for dead-letter and lease inspection APIs.
QueueDeadLetterRedriveOptions
Types
type QueueDeadLetterRedriveOptions = void Options for moving dead-letter messages back to the live queue.
QueueEnqueueResult
Types
type QueueEnqueueResult = void Metadata returned after a message has been accepted for queue delivery.
QueueLeaseInspectionRecord
Types
type QueueLeaseInspectionRecord = void Diagnostic view of an active queue lease.
QueueLeaseOptions
Types
type QueueLeaseOptions = void Options used when leasing work from a queue.
QueueRetryRequest
Types
type QueueRetryRequest = void Retry request returned to a queue bridge when work should run again.
Schema
3 entries
OpenApiZodAny
Types
type OpenApiZodAny = ZodType & { metaOpenApi: SchemaObject | SchemaObject[] } Zod schema augmented with PURISTA OpenAPI metadata.
extendApi
Functions
extendApi<TSchema>(schema: TSchema, meta: SchemaObject | SchemaObject[]): TSchema validationToSchema
Functions
validationToSchema<T>(schema?: T): Promise<SchemaObject | undefined> Service
4 entries
Service
Classes
class Service<S> Base class for all services. This class provides base functions to work with the event bridge, logging and so on
ServiceBuilder
Classes
class ServiceBuilder<S> This class is used to build a service.
ServiceClass
Interfaces
interface ServiceClass<S> The ServiceClass interface
ServiceConstructorInput
Types
type ServiceConstructorInput = void Store
18 entries
ConfigStoreBaseClass
Classes
class ConfigStoreBaseClass<ConfigStoreConfigType> Base class for config store adapters.
DefaultConfigStore
Classes
class DefaultConfigStore Process-local in-memory config store for development and tests.
DefaultSecretStore
Classes
class DefaultSecretStore Process-local in-memory secret store for development and tests.
DefaultStateStore
Classes
class DefaultStateStore Process-local in-memory state store for development and tests.
SecretStoreBaseClass
Classes
class SecretStoreBaseClass<SecretStoreConfigType> Base class for secret store adapters.
StateStoreBaseClass
Classes
class StateStoreBaseClass<StateStoreConfigType> Base class for state store implementations.
ConfigStore
Interfaces
interface ConfigStore Interface definition for config store adapters
SecretStore
Interfaces
interface SecretStore Interface definition for a secret store implementation
StateStore
Interfaces
interface StateStore Interface definition for state store implementations
ConfigDeleteFunction
Types
type ConfigDeleteFunction = (configName: string) => Promise<void> delete a config value from the config store
ConfigGetterFunction
Types
type ConfigGetterFunction = (...configNames: ConfigNames) => Promise<ObjectWithKeysFromStringArray<ConfigNames>> get a config value from the config store
ConfigSetterFunction
Types
type ConfigSetterFunction = (configName: string, configValue: unknown) => Promise<void> set a config value in the config store
SecretDeleteFunction
Types
type SecretDeleteFunction = (secretName: string) => Promise<void> delete a secret from the secret store
SecretGetterFunction
Types
type SecretGetterFunction = (...secretNames: SecretNames) => Promise<ObjectWithKeysFromStringArray<SecretNames, string | undefined>> get a secret from the secret store
SecretSetterFunction
Types
type SecretSetterFunction = (secretName: string, secretValue: string) => Promise<void> set a secret in the secret store
StateDeleteFunction
Types
type StateDeleteFunction = (stateName: string) => Promise<void> delete a state value from the state store
StateGetterFunction
Types
type StateGetterFunction = (...stateNames: StateNames) => Promise<ObjectWithKeysFromStringArray<StateNames>> get a state value from the state store
StateSetterFunction
Types
type StateSetterFunction = (stateName: string, stateValue: unknown) => Promise<void> set a state value in the state store
Stream
2 entries
StreamAfterGuardHook
Types
type StreamAfterGuardHook = (this: S, context: StreamFunctionContext<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes, EmitList, QueueInvokes>, result: Readonly<FunctionFinalType>, originalPayload: Readonly<FunctionPayloadType>, originalParameter: Readonly<FunctionParamsType>) => Promise<void> Guard called after a stream completes successfully and the final payload has been validated.
StreamBeforeGuardHook
Types
type StreamBeforeGuardHook = (this: S, context: StreamFunctionContext<MessagePayloadType, MessageParamsType, Resources, Invokes, StreamInvokes, EmitList, QueueInvokes>, payload: Readonly<FunctionPayloadType>, parameter: Readonly<FunctionParamsType>) => Promise<void> Guard called after stream input validation and before the stream handler runs.
Subscription
11 entries
SubscriptionDefinitionBuilder
Classes
class SubscriptionDefinitionBuilder<S, C> Subscription definition builder is a helper to create and define a subscriptions for a service. It helps to set all needed filters.
Subscription
Types
type Subscription = void A subscription managed by the event bridge
SubscriptionAfterGuardHook
Types
type SubscriptionAfterGuardHook = (this: ServiceClassType, context: SubscriptionFunctionContext<Resources, Invokes, StreamInvokes, EmitList, QueueInvokes>, 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.
SubscriptionBeforeGuardHook
Types
type SubscriptionBeforeGuardHook = (this: S, context: SubscriptionFunctionContext<Resources, Invokes, StreamInvokes, EmitList, QueueInvokes>, 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.
SubscriptionDefinition
Types
type SubscriptionDefinition = void The definition for a subscription provided by some service.
SubscriptionFunction
Types
type SubscriptionFunction = (this: ServiceClassType, context: SubscriptionFunctionContext<Resources, Invokes, StreamInvokes, EmitList, QueueInvokes, ServiceClassMetrics<ServiceClassType>>, payload: Readonly<FunctionPayloadType>, parameter: Readonly<FunctionParamsType>) => Promise<FunctionOutputType | SubscriptionHandlerResult> CommandFunction is a function which will be triggered when a matching event bridge message is received by the service
SubscriptionFunctionContext
Types
type SubscriptionFunctionContext = Prettify<ContextBase<Metrics> & PuristaMetricContextProperty<Metrics> & SubscriptionFunctionContextEnhancements<Resources, Invokes, StreamInvokes, EmitList, QueueInvokes>> The subscription function context which will be passed into subscription function.
SubscriptionFunctionContextEnhancements
Types
type SubscriptionFunctionContextEnhancements = void It provides the original command message. Also, the methods:
SubscriptionTransformFunctionContext
Types
type SubscriptionTransformFunctionContext = Prettify<ContextBase & { message: Readonly<EBMessage>; resources: Resources }> SubscriptionTransformInputHook
Types
type SubscriptionTransformInputHook = (this: S, context: SubscriptionTransformFunctionContext, payload: Readonly<TransformInputPayload>, parameter: Readonly<TransformInputParams>) => Promise<{ parameter: Readonly<FunctionParamsType>; payload: Readonly<FunctionPayloadType> }> SubscriptionTransformOutputHook
Types
type SubscriptionTransformOutputHook = (this: S, context: SubscriptionTransformFunctionContext, payload: Readonly<FinalFunctionOutputType>, parameter: Readonly<FunctionParamsType>) => Promise<TransformOutputHookOutput> This transform hook is executed after function output validation and AfterGuardHooks.
Unit test helper
26 entries
CommandContextMockBuilderTypes
Types
type CommandContextMockBuilderTypes = T extends CommandDefinitionBuilder<any, C> ? C : never Infer the internal builder type configuration from a command builder.
CreateQueueWorkerContextMockInput
Types
type CreateQueueWorkerContextMockInput = void Input for createQueueWorkerContextMock.
InferCommandBuilderConfig
Types
type InferCommandBuilderConfig = T extends CommandDefinitionBuilder<any, C> ? C : never Infer the definition config type from a command builder.
InferCommandHarnessServiceBuilderConfig
Types
type InferCommandHarnessServiceBuilderConfig = T extends ServiceBuilder<S> ? S : never Infer the instance config type from a service builder.
InferQueueWorkerHarnessServiceBuilderConfig
Types
type InferQueueWorkerHarnessServiceBuilderConfig = T extends ServiceBuilder<S> ? S : never Infer the instance config type from a service builder.
InferStreamBuilderConfig
Types
type InferStreamBuilderConfig = T extends StreamDefinitionBuilder<any, C> ? C : never Infer the definition config type from a stream builder.
InferStreamHarnessServiceBuilderConfig
Types
type InferStreamHarnessServiceBuilderConfig = T extends ServiceBuilder<S> ? S : never Infer the instance config type from a service builder.
QueueWorkerContextMockResult
Types
type QueueWorkerContextMockResult = void Result returned by createQueueWorkerContextMock.
StreamContextMockBuilderTypes
Types
type StreamContextMockBuilderTypes = T extends StreamDefinitionBuilder<any, C> ? C : never Infer the internal builder type configuration from a stream builder.
SubscriptionContextMockBuilderTypes
Types
type SubscriptionContextMockBuilderTypes = T extends SubscriptionDefinitionBuilder<any, C> ? C : never Infer the internal builder type configuration from a subscription builder.
createCommandContextMock
Functions
createCommandContextMock<TBuilder>(builder: TBuilder, input: CreateCommandContextMockInput<TBuilder>): CommandContextMockResult<TBuilder> createCommandTestHarness
Functions
createCommandTestHarness<TServiceBuilder, TCommandBuilder>(serviceBuilder: TServiceBuilder, commandBuilder: TCommandBuilder, options: CreateCommandTestHarnessOptions<TServiceBuilder>): Promise<{ destroy: () => Promise<void>; eventBridge: EventBridge; run: (input: { parameter: InferIn<InferCommandBuilderConfig<TCommandBuilder>["ParamsSchema"]>; payload: InferIn<InferCommandBuilderConfig<TCommandBuilder>["PayloadSchema"]> }) => Promise<{ message: unknown; result: unknown }>; service: Service<ServiceClassTypes<EmptyObject, EmptyObject>>; stubs: { eventBridge: Record<unknown, unknown> | undefined } }> createQueueWorkerContextMock
Functions
createQueueWorkerContextMock<Payload, Parameter, Resources>(_builder: QueueWorkerBuilder, input: CreateQueueWorkerContextMockInput<Payload, Parameter, Resources>): QueueWorkerContextMockResult<Payload, Parameter, Resources> createQueueWorkerTestHarness
Functions
createQueueWorkerTestHarness<TServiceBuilder>(serviceBuilder: TServiceBuilder, workerBuilder: QueueWorkerBuilder, options: mapped & { eventBridge: EventBridge; queueBridge: QueueBridge }): Promise<{ destroy: () => Promise<void>; eventBridge: EventBridge; queueBridge: QueueBridge; run: (message: QueueMessage<Payload, Parameter>) => Promise<{ ackCalls: unknown; deadLetterCalls: unknown; extendLeaseCalls: unknown; nackCalls: unknown }>; service: Service<ServiceClassTypes<EmptyObject, EmptyObject>>; stubs: { eventBridge: Record<unknown, unknown> | undefined; queueBridge: Record<unknown, unknown> | undefined } }> createStreamContextMock
Functions
createStreamContextMock<TBuilder>(builder: TBuilder, input: CreateStreamContextMockInput<TBuilder>): StreamContextMockResult<TBuilder> createStreamTestHarness
Functions
createStreamTestHarness<TServiceBuilder, TStreamBuilder>(serviceBuilder: TServiceBuilder, streamBuilder: TStreamBuilder, options: mapped & { eventBridge: EventBridge }): Promise<{ destroy: () => Promise<void>; eventBridge: EventBridge; run: (input: { parameter: InferIn<InferStreamBuilderConfig<TStreamBuilder>["ParamsSchema"]>; payload: InferIn<InferStreamBuilderConfig<TStreamBuilder>["PayloadSchema"]> }) => Promise<{ chunks: unknown; final: unknown; frames: unknown }>; service: Service<ServiceClassTypes<EmptyObject, EmptyObject>>; stubs: { eventBridge: Record<unknown, unknown> | undefined } }> createSubscriptionContextMock
Functions
createSubscriptionContextMock<TBuilder>(builder: TBuilder, input: CreateSubscriptionContextMockInput<TBuilder>): SubscriptionContextMockResult<TBuilder> getCommandErrorMessageMock
Functions
getCommandErrorMessageMock(error?: HandledError | UnhandledError, input?: Partial<{ contentEncoding: "utf-8"; contentType: "application/json"; correlationId: string; eventName: string; id: string; isHandledError: boolean; ... }>, commandMessage?: { contentEncoding: string; contentType: string; correlationId: string; eventName: string; id: string; messageType: Command; ... }): Readonly<CommandErrorResponse> getCommandMessageMock
Functions
getCommandMessageMock<Payload, Parameter>(input?: Partial<{ contentEncoding: string; contentType: string; correlationId: string; eventName: string; id: string; messageType: Command; ... }> & { payload: { parameter: Parameter; payload: Payload } }): Readonly<Command<Payload, Parameter>> getCommandSuccessMessageMock
Functions
getCommandSuccessMessageMock<PayloadType>(payload: PayloadType, input?: Partial<{ contentEncoding: string; contentType: string; correlationId: string; eventName: string; id: string; messageType: CommandSuccessResponse; ... }>, commandMessage?: { contentEncoding: string; contentType: string; correlationId: string; eventName: string; id: string; messageType: Command; ... }): Readonly<CommandSuccessResponse<PayloadType>> getCommandTransformContextMock
Functions
getCommandTransformContextMock<MessagePayloadType, MessageParamsType, Resources>(input: { parameter: MessageParamsType; payload: MessagePayloadType; resources: Partial<Resources>; sandbox: SinonSandbox }): { mock: { configs: { getConfig: ConfigGetterFunction; removeConfig: ConfigDeleteFunction; setConfig: ConfigSetterFunction }; logger: Logger; message: Readonly<Command<PayloadType, ParameterType>>; metrics: PuristaMetricContext<Metrics>; queue: QueueContext; resources: Resources; ... }; stubs: { enqueue: SinonStub<any[], any>; getConfig: SinonStub<any[], any>; getSecret: SinonStub<any[], any>; getState: SinonStub<any[], any>; logger: { debug: SinonStub<unknown[], any>; error: SinonStub<unknown[], any>; fatal: SinonStub<unknown[], any>; info: SinonStub<unknown[], any>; trace: SinonStub<unknown[], any>; warn: SinonStub<unknown[], any> }; removeConfig: SinonStub<any[], any>; ... } } getCustomMessageMessageMock
Functions
getCustomMessageMessageMock<PayloadType>(eventName: string, payload: PayloadType, input?: Partial<{ contentEncoding: string; contentType: string; correlationId: string; eventName: string; id: string; messageType: CustomMessage; ... }>): Readonly<CustomMessage<PayloadType>> getEventBridgeMock
Functions
getEventBridgeMock(sandboxOrOptions?: SinonSandbox | { capabilities: EventBridgeCapabilityOverrides; sandbox: SinonSandbox }): { mock: EventBridge; stubs: Record<string, SinonStub> } getLoggerMock
Functions
getLoggerMock(sandbox?: SinonSandbox): { mock: Logger; 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> } } getQueueBridgeMock
Functions
getQueueBridgeMock(sandboxOrOptions?: SinonSandbox | { capabilities: Partial<QueueBridgeCapabilities>; sandbox: SinonSandbox }): { mock: QueueBridge; stubs: Record<string, SinonStub> } getSubscriptionTransformContextMock
Functions
getSubscriptionTransformContextMock<Resources>(input: { message: EBMessage; resources: Partial<Resources>; sandbox: SinonSandbox }): { mock: { configs: { getConfig: ConfigGetterFunction; removeConfig: ConfigDeleteFunction; setConfig: ConfigSetterFunction }; logger: Logger; message: Readonly<EBMessage>; metrics: PuristaMetricContext<Metrics>; queue: QueueContext; resources: EmptyObject; ... }; stubs: { enqueue: SinonStub<any[], any>; getConfig: SinonStub<any[], any>; getSecret: SinonStub<any[], any>; getState: SinonStub<any[], any>; logger: { debug: SinonStub<unknown[], any>; error: SinonStub<unknown[], any>; fatal: SinonStub<unknown[], any>; info: SinonStub<unknown[], any>; trace: SinonStub<unknown[], any>; warn: SinonStub<unknown[], any> }; removeConfig: SinonStub<any[], any>; ... } }