@morgan-stanley/composeui-messaging-abstractions
v0.1.0-alpha.11
Published
TypeScript abstractions library for ComposeUI's messaging
Downloads
119
Keywords
Readme
@morgan-stanley/composeui-messaging-abstractions
Messaging helpers that wrap a lower‑level IMessaging abstraction (publish/subscribe plus request/response). Provides simple, typed APIs for sending and receiving structured data as JSON without duplicating serialization logic in callers. Provides JSON focused extension methods available using the JsonMessaging class.
Features
- Thin adapter: JsonMessaging delegates to any IMessaging implementation.
- Typed publish/subscribe via JSON (subscribeJson / publishJson).
- Typed request/response services (registerJsonService / invokeJsonService / invokeJsonServiceNoRequest).
- Automatic serialization/deserialization.
- String short‑circuit: if a typed service handler returns a string it is passed through without double JSON.stringify.
Installation
Install as a workspace dependency
npm install @morgan-stanley/composeui-messaging-abstractionsUsage
Implement the IMessaging API to declare your own communication.
import { IMessaging } from "@morgan-stanley/composeui-messaging-abstractions";
import { HubConnection } from '@microsoft/signalr';
export class MyMessaging implements IMessaging {
constructor(private readonly signalRMessaging: MySignalWrapper) {}
//Implement the IMessging API...
}Module format
Rollup emits dual builds:
- ES Module: dist/index.js
- CommonJS: dist/index.cjs
package.json exports map require to CJS and import to ESM. Use:
// CJS
const { JsonMessaging } = require('@morgan-stanley/composeui-messaging-abstractions');
// ESM / TypeScript
import { JsonMessaging } from '@morgan-stanley/composeui-messaging-abstractions';Dependencies
Runtime:
- rxjs (Unsubscribable type)
Build / Dev:
- typescript
- @rollup/plugin-typescript
- @rollup/plugin-node-resolve
License
Apache-2.0 (see NOTICE and LICENSE files).
Documentation
© Morgan Stanley. See NOTICE file for additional information.
