Skip to main content Link Search Menu Expand Document (external link)

Message overview

Added in v1.0.0


Table of contents


models

Message (interface)

A Message is a request for an entity that will process it. A Message also has a PrimaryKey so that the receiver is eventually able to detect duplicated messages.

Signature

export interface Message<A, AI, E, EI>
  extends Serializable.SerializableWithResult<any, any, never, A, AI, E, EI, never>,
    PrimaryKey.PrimaryKey {}

Added in v1.0.0

Message (namespace)

Added in v1.0.0

Any (type alias)

Signature

export type Any = Message<any, any, any, any> | Message<any, any, never, never>

Added in v1.0.0

Error (type alias)

Extracts the error type from a Message.

Signature

export type Error<S> = S extends Message<infer _A, infer _AI, infer E, infer _EI> ? E : never

Added in v1.0.0

ErrorEncoded (type alias)

Extracts the error type from a Message.

Signature

export type ErrorEncoded<S> = S extends Message<infer _A, infer _AI, infer _E, infer _EI> ? _EI : never

Added in v1.0.0

Exit (type alias)

Extracts the exit type from a Message.

Signature

export type Exit<S> =
  S extends Serializable.WithResult<infer A, infer _AI, infer E, infer _EI, infer _R> ? Exit_.Exit<A, E> : never

Added in v1.0.0

Success (type alias)

Extracts the success type from a Message.

Signature

export type Success<S> = S extends Message<infer A, infer _AI, infer _E, infer _EI> ? A : never

Added in v1.0.0

SuccessEncoded (type alias)

Extracts the success type from a Message.

Signature

export type SuccessEncoded<S> = S extends Message<infer _A, infer _AI, infer _E, infer _EI> ? _AI : never

Added in v1.0.0

schemas

TaggedMessage

Signature

export declare const TaggedMessage: <Self>() => <Tag extends string, E, IE, A, IA, Fields extends Schema>(
  tag: Tag,
  failure: Schema<E, IE, never>,
  success: Schema<A, IA, never>,
  fields: Fields,
  messageToId: (message: Schema<Fields>) => string
) => TaggedMessageConstructor<
  Tag,
  Self,
  Schema<Fields[keyof Fields]>,
  Schema<Schema<Fields>>,
  Schema<Schema<Fields>>,
  IE,
  E,
  IA,
  A
>

Added in v1.0.0

TaggedMessageConstructor (interface)

Signature

export interface TaggedMessageConstructor<Tag extends string, Self, R, IS, S, IE, E, IA, A>
  extends Schema.Schema<Self, Types.Simplify<IS & { readonly _tag: Tag }>, R> {
  new (
    props: Types.Equals<S, {}> extends true ? void : S,
    disableValidation?: boolean
  ): Schema.TaggedRequest<Tag, S, IS & { readonly _tag: Tag }, never, A, IA, E, IE, never> & S & PrimaryKey.PrimaryKey
}

Added in v1.0.0

utils

exitSchema

Extracts the exit schema from a Message. This schema will be used to encode the remote exit of the Message processor.

Signature

export declare const exitSchema: <A extends Message.Any>(message: A) => Schema.Schema<Message.Exit<A>, unknown>

Added in v1.0.0

failureSchema

Extracts the failure schema from a Message. This schema will be used to encode remote failures of the Message processor.

Signature

export declare const failureSchema: <A extends Message.Any>(message: A) => Schema.Schema<Message.Error<A>, unknown>

Added in v1.0.0

isMessageWithResult

Signature

export declare const isMessageWithResult: (value: unknown) => value is Message<unknown, unknown, unknown, unknown>

Added in v1.0.0

successSchema

Extracts the success schema from a Message. This schema will be used to encode the remote success of the Message processor.

Signature

export declare const successSchema: <A extends Message.Any>(message: A) => Schema.Schema<Message.Success<A>, unknown>

Added in v1.0.0