Mosaic managed services provide their message definition in the @axinom/mosaic-messages library. Every event and every command is defined in this library with its TypeScript type. This enables you to have strong type support when sending a command to a Mosaic service

@axinom/mosaic-messages

This library contains the TypeScript definitions of all events and commands that are used by managed services in the Mosaic ecosystem.

All message Types are exposed from the root of the library. You can import them like this:

import {
  ImageServiceMultiTenantMessagingSettings,
  DeclareImageTypesCommand
} from '@axinom/mosaic-messages';

In addition to the TypeScript definitions, the library also contains the JSON schema definitions of the messages. These are located in the ./dist/generated/schemas/payloads sub-folders grouped by service. For example, the JSON schema definition of the DeclareImageTypesCommand is located in ./dist/generated/schemas/payloads/image/commands/declare-image-types-command.json. This can be useful if you want to generate types or mappings for the programming language you are working with or implement additional validation.

For more information on message formats, code generation, conventions, etc. please refer to Messaging Usage.