@fliidotdev/protocols
v0.1.2
Published
Shared protocol definitions, message contracts, and handler interfaces used across the Flii platform. Centralized types ensure reliable communication between the visual editor, runtime, server, and client SDKs.
Readme
@fliidotdev/protocols
Shared protocol definitions, message contracts, and handler interfaces used across the Flii platform. Centralized types ensure reliable communication between the visual editor, runtime, server, and client SDKs.
Installation
npm install @fliidotdev/protocols
# or
yarn add @fliidotdev/protocols
# or
pnpm add @fliidotdev/protocolsWhat is inside?
- Type-safe message definitions
- Event and command contracts
- Handler interfaces
- Cross-package shared enums and constants
Why this package?
Keeping communication contracts in a single package ensures:
- Backward-compatible changes across services
- Single source of truth for types
- Easy upgrades in dependent packages
- Reduced runtime bugs via compile-time safety
Usage
import { ProtocolMessage, MessageType } from '@fliidotdev/protocols';
const message: ProtocolMessage = {
type: MessageType.Component.Update,
payload: {
id: 'button-1',
props: { variant: 'primary', label: 'Save' }
}
};
// Send across a WebSocket or postMessage channel
send(message);Versioning Strategy
- All message changes are versioned semantically
- Breaking changes bump the major version
- Additive changes bump the minor version
- Patch releases include bug fixes and docs
Contributing
When adding or changing protocols:
- Update types in
src/types - Document the change in the CHANGELOG
- Write migration notes for breaking changes
Development
pnpm install
pnpm build
pnpm testLicense
MIT © fliidotdev
