Message
Type parameters
▪ T: SuperConstructor
▪ T: SuperConstructor
Hierarchy
Implements
Index
Constructors
Properties
Methods
- assignMetadata
- equals
- getActions
- getCorrelationId
- getHook
- getHookOrThrow
- getHooks
- getLegacyTransformer
- getLegacyTransformers
- getMetadata
- getPropTypes
- getPropertyInitializers
- getSchemaVersion
- getTimestamp
- getTypeName
- hasAction
- hasCorrelationId
- hasHook
- hasLegacyTransformer
- hasMetadata
- in
- overrideHook
- overrideLegacyTransformer
- processSerializableList
- registerHook
- registerLegacyTransformer
- removeHook
- setCorrelationId
- toJSONValue
- toPlainObject
- toString
- transformLegacyProps
- typeName
- validateProps
- disableSerializableLists
- enableSerializableLists
- from
- getPropTypes
- getPropertyInitializers
- getTypeName
- toString
- typeName
Constructors
constructor
+ new Message(props?
: Props): Message
Overrides Serializable.constructor
Creates an instance of Message. Creates an instance of Message.
remarks
Since were dealing with special cases, mixins and limits of TypeScript, we
use of "invoking multiple base constructors" from polytype to pass props to Struct's
constructor:
https://www.npmjs.com/package/polytype#invoking-multiple-base-constructors
remarks
Since were dealing with special cases, mixins and limits of TypeScript, we
use of "invoking multiple base constructors" from polytype to pass props to Struct's
constructor:
https://www.npmjs.com/package/polytype#invoking-multiple-base-constructors
Parameters:
Name | Type | Description |
---|---|---|
props? | Props | Properties of the type required for construction. |
Returns: Message
Properties
Optional
metadata
• metadata? : Record‹string, any›
Implementation of Message.metadata
remarks
Since Command & Event are frozen after construction, metadata
property must be assigning on construction. This ensures that
content of message is immutable; however metadata as an object will
be unaffected by Object.freeze - thus allowing for additional data
to be assigned later on.
Exposed as optional - but always assigned with use of
Message.prototype.processProps
for easier interaction.
Optional
schemaVersion
• schemaVersion? : number
Inherited from Serializable.schemaVersion
Overrides VersionableMixin.schemaVersion
Optional
timestamp
• timestamp? : Date
Implementation of Message.timestamp
remarks
Exposed as optional - but always assigned with use of
Message.prototype.processProps
for easier interaction.
Methods
assignMetadata
▸ assignMetadata(props
: Record‹string, any›): void
Implementation of Message
Assigns metadata to message.
Parameters:
Name | Type | Description |
---|---|---|
props | Record‹string, any› | Metadata properties object with all information related to Message . |
Returns: void
equals
▸ equals(other
: any): boolean
Implementation of Message
Inherited from DefinableMixin.equals
Overrides CreateEmployee.equals
Parameters:
Name | Type |
---|---|
other | any |
Returns: boolean
getActions
▸ getActions(): Actions
Implementation of Hookable
Inherited from HookableMixin.getActions
Overrides CreateEmployee.getActions
Returns: Actions
getCorrelationId
▸ getCorrelationId(key
: string): string | undefined
Implementation of Message
Returns metadata correlation id for message.
Parameters:
Name | Type | Description |
---|---|---|
key | string | Key under which correlation is set with support of dotted notation for nested objects. |
Returns: string | undefined
String identifier of correlating element.
getHook
▸ getHook(action
: string, id
: string): Hook | undefined
Implementation of Hookable
Inherited from HookableMixin.getHook
Overrides CreateEmployee.getHook
Parameters:
Name | Type |
---|---|
action | string |
id | string |
Returns: Hook | undefined
getHookOrThrow
▸ getHookOrThrow(action
: string, id
: string): Hook
Implementation of Hookable
Inherited from HookableMixin.getHookOrThrow
Overrides CreateEmployee.getHookOrThrow
Parameters:
Name | Type |
---|---|
action | string |
id | string |
Returns: Hook
getHooks
▸ getHooks(action
: string): Mappings
Implementation of Hookable
Inherited from HookableMixin.getHooks
Overrides CreateEmployee.getHooks
Parameters:
Name | Type |
---|---|
action | string |
Returns: Mappings
getLegacyTransformer
▸ getLegacyTransformer(schemaVersion
: number): Hook
Implementation of Message
Inherited from VersionableMixin.getLegacyTransformer
Overrides CreateEmployee.getLegacyTransformer
Parameters:
Name | Type |
---|---|
schemaVersion | number |
Returns: Hook
getLegacyTransformers
▸ getLegacyTransformers(): LegacyTransformers
Implementation of Message
Inherited from VersionableMixin.getLegacyTransformers
Overrides CreateEmployee.getLegacyTransformers
Returns: LegacyTransformers
getMetadata
▸ getMetadata(): Record‹string, any›
Implementation of Message
Returns metadata assigned to the message.
Returns: Record‹string, any›
Returns metadata assigned to the message as an object.
getPropTypes
▸ getPropTypes(): Props
Implementation of Message
Inherited from DefinableMixin.getPropTypes
Overrides CreateEmployee.getPropTypes
Returns: Props
getPropertyInitializers
▸ getPropertyInitializers(): Props
Implementation of Message
Inherited from DefinableMixin.getPropertyInitializers
Overrides CreateEmployee.getPropertyInitializers
Returns: Props
getSchemaVersion
▸ getSchemaVersion(): number | undefined
Implementation of Message
Inherited from VersionableMixin.getSchemaVersion
Overrides CreateEmployee.getSchemaVersion
Returns: number | undefined
getTimestamp
▸ getTimestamp(): Date
Implementation of Message
Returns time when message was created.
Returns: Date
Returns instance of Date
.
getTypeName
▸ getTypeName(): TypeName
Implementation of Message
Inherited from SerializableMixin.getTypeName
Overrides CreateEmployee.getTypeName
Returns: TypeName
hasAction
▸ hasAction(action
: string): boolean
Implementation of Hookable
Inherited from HookableMixin.hasAction
Overrides CreateEmployee.hasAction
Parameters:
Name | Type |
---|---|
action | string |
Returns: boolean
hasCorrelationId
▸ hasCorrelationId(key
: string): boolean
Implementation of Message
Evaluates if message contains correlation id on metadata.
Parameters:
Name | Type | Description |
---|---|---|
key | string | Key under which correlation is set with support of dotted notation for nested objects. |
Returns: boolean
Returns true
if metadata contains correlated element, else false
.
hasHook
▸ hasHook(action
: string, id
: string): boolean
Implementation of Hookable
Inherited from HookableMixin.hasHook
Overrides CreateEmployee.hasHook
Parameters:
Name | Type |
---|---|
action | string |
id | string |
Returns: boolean
hasLegacyTransformer
▸ hasLegacyTransformer(schemaVersion
: number): boolean
Implementation of Message
Inherited from VersionableMixin.hasLegacyTransformer
Overrides CreateEmployee.hasLegacyTransformer
Parameters:
Name | Type |
---|---|
schemaVersion | number |
Returns: boolean
hasMetadata
▸ hasMetadata(): boolean
Implementation of Message
Evaluates if there is assigned metadata to message.
Returns: boolean
Returns true if message
has assigned metadata, else false
.
in
▸ in‹T›(listName
: string): List‹T›
Inherited from Serializable.in
Overrides CreateEmployee.in
Type parameters:
▪ T
Parameters:
Name | Type |
---|---|
listName | string |
Returns: List‹T›
overrideHook
▸ overrideHook(action
: string, id
: string, hook
: Hook): void
Implementation of Hookable
Inherited from HookableMixin.overrideHook
Overrides CreateEmployee.overrideHook
Parameters:
Name | Type |
---|---|
action | string |
id | string |
hook | Hook |
Returns: void
overrideLegacyTransformer
▸ overrideLegacyTransformer(schemaVersion
: number, transformer
: Hook): void
Implementation of Message
Inherited from VersionableMixin.overrideLegacyTransformer
Overrides CreateEmployee.overrideLegacyTransformer
Parameters:
Name | Type |
---|---|
schemaVersion | number |
transformer | Hook |
Returns: void
processSerializableList
▸ processSerializableList(props?
: Props): Props
Inherited from Serializable.processSerializableList
Overrides CreateEmployee.processSerializableList
Parameters:
Name | Type |
---|---|
props? | Props |
Returns: Props
registerHook
▸ registerHook(action
: string, id
: string, hook
: Hook, shouldOverride?
: boolean): void
Implementation of Hookable
Inherited from HookableMixin.registerHook
Overrides CreateEmployee.registerHook
Parameters:
Name | Type |
---|---|
action | string |
id | string |
hook | Hook |
shouldOverride? | boolean |
Returns: void
registerLegacyTransformer
▸ registerLegacyTransformer(schemaVersion
: number, transformer
: Hook, shouldOverride?
: boolean): void
Implementation of Message
Inherited from VersionableMixin.registerLegacyTransformer
Overrides CreateEmployee.registerLegacyTransformer
Parameters:
Name | Type |
---|---|
schemaVersion | number |
transformer | Hook |
shouldOverride? | boolean |
Returns: void
removeHook
▸ removeHook(action
: string, id
: string): void
Implementation of Hookable
Inherited from HookableMixin.removeHook
Overrides CreateEmployee.removeHook
Parameters:
Name | Type |
---|---|
action | string |
id | string |
Returns: void
setCorrelationId
▸ setCorrelationId(key
: string, id
: Stringifiable): void
Implementation of Message
Sets correlation id metadata on message.
remarks
Databases like MongoDB does not support object keys with dots like: my.nested.key
Since for correlation key - namespaced 'type name' like MyNamespace.MyMessage
can be used we utilize lodash'es 'set' method to construct nested object from
such notation.
Parameters:
Name | Type | Description |
---|---|---|
key | string | Key under which correlation is set with support of dotted notation for nested objects. |
id | Stringifiable | Identifier of correlating element. |
Returns: void
toJSONValue
▸ toJSONValue(): Record‹string, any›
Implementation of Ejsonable
Inherited from SerializableMixin.toJSONValue
Overrides CreateEmployee.toJSONValue
Returns: Record‹string, any›
toPlainObject
▸ toPlainObject(): Props
Implementation of Message
Inherited from DefinableMixin.toPlainObject
Overrides CreateEmployee.toPlainObject
Returns: Props
toString
▸ toString(): TypeName
Implementation of Message
Inherited from SerializableMixin.toString
Overrides CreateEmployee.toString
Returns: TypeName
transformLegacyProps
▸ transformLegacyProps(props
: Props): Props
Implementation of Message
Inherited from VersionableMixin.transformLegacyProps
Overrides CreateEmployee.transformLegacyProps
Parameters:
Name | Type |
---|---|
props | Props |
Returns: Props
typeName
▸ typeName(): TypeName
Implementation of Ejsonable
Inherited from EjsonableMixin.typeName
Overrides CreateEmployee.typeName
Returns: TypeName
validateProps
▸ validateProps(props
: Record‹string | number | symbol, any› | undefined, propTypes
: PropTypes, isStrict?
: boolean): boolean
Inherited from DefinableMixin.validateProps
Overrides CreateEmployee.validateProps
Parameters:
Name | Type |
---|---|
props | Record‹string | number | symbol, any› | undefined |
propTypes | PropTypes |
isStrict? | boolean |
Returns: boolean
Static
disableSerializableLists
▸ disableSerializableLists(): void
Inherited from Serializable.disableSerializableLists
Overrides CreateEmployee.disableSerializableLists
Returns: void
Static
enableSerializableLists
▸ enableSerializableLists(): void
Inherited from Serializable.enableSerializableLists
Overrides CreateEmployee.enableSerializableLists
Returns: void
Static
from
▸ from(...sources
: Record‹string, any›[]): any
Inherited from Serializable.from
Overrides CreateEmployee.from
Parameters:
Name | Type |
---|---|
...sources | Record‹string, any›[] |
Returns: any
Static
getPropTypes
▸ getPropTypes(): Props
Inherited from DefinableMixin.getPropTypes
Overrides CreateEmployee.getPropTypes
Returns: Props
Static
getPropertyInitializers
▸ getPropertyInitializers(): Props
Inherited from DefinableMixin.getPropertyInitializers
Overrides CreateEmployee.getPropertyInitializers
Returns: Props
Static
getTypeName
▸ getTypeName(): TypeName
Inherited from SerializableMixin.getTypeName
Overrides CreateEmployee.getTypeName
Returns: TypeName
Static
toString
▸ toString(): TypeName
Inherited from SerializableMixin.toString
Overrides CreateEmployee.toString
Returns: TypeName
Static
typeName
▸ typeName(): TypeName
Inherited from EjsonableMixin.typeName
Overrides CreateEmployee.typeName
Returns: TypeName