@velony/contracts
v5.0.1
Published
TypeScript contracts library providing integration event interfaces for event-driven architecture
Maintainers
Readme
@velony/contracts
A TypeScript contracts library providing integration event interfaces for event-driven architecture.
Installation
npm install @velony/contractsOverview
This package provides TypeScript interfaces for integration events used across VelonY microservices. Integration events enable loose coupling between services in an event-driven architecture.
Usage
import {
UserCreatedIntegrationEvent,
UserEmailChangedIntegrationEvent,
UserPhoneNumberChangedIntegrationEvent
} from '@velony/contracts';
// Example: Handle a user created event
const event: UserCreatedIntegrationEvent = {
id: 'evt-123',
type: 'user.created',
version: '1.0.0',
occurredAt: new Date(),
payload: {
userId: 'user-123',
name: 'John Doe',
username: 'johndoe',
avatarPath: 'https://example.com/avatar.jpg',
email: '[email protected]',
phoneNumber: '+1234567890'
},
topic: 'identity.events',
partitionKey: 'user-123',
};Available Integration Events
Identity Domain
UserAvatarChangedIntegrationEvent- Fired when a user's avatar is changedUserCreatedIntegrationEvent- Fired when a new user is createdUserDeletedIntegrationEvent- Fired when a user is deletedUserEmailChangedIntegrationEvent- Fired when a user's email is changedUserEmailRemovedIntegrationEvent- Fired when an email is removed from a userUserNameChangedIntegrationEvent- Fired when a user's name is changedUserPhoneNumberChangedIntegrationEvent- Fired when a user's phone number is changedUserPhoneNumberRemovedIntegrationEvent- Fired when a phone number is removed from a userUserUsernameChangedIntegrationEvent- Fired when a user's username is changed
License
MIT
Repository
https://github.com/velony-ai/contracts
