Skip to content

Commit

Permalink
Add om.created and om.deleted event types (#1028)
Browse files Browse the repository at this point in the history
Add om.created and om.deleted event types and mark om.added and
om.removed as deprecated.
  • Loading branch information
mattgd authored Apr 30, 2024
1 parent 668ae08 commit 138060e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/common/interfaces/event.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,44 @@ export interface UserDeletedEventResponse extends EventResponseBase {
data: UserResponse;
}

/**
* @deprecated Use OrganizationMembershipCreated instead. Will be removed in a future major version.
*/
export interface OrganizationMembershipAdded extends EventBase {
event: 'organization_membership.added';
data: OrganizationMembership;
}

/**
* @deprecated Use OrganizationMembershipCreatedResponse instead. Will be removed in a future major version.
*/
export interface OrganizationMembershipAddedResponse extends EventResponseBase {
event: 'organization_membership.added';
data: OrganizationMembershipResponse;
}

export interface OrganizationMembershipCreated extends EventBase {
event: 'organization_membership.created';
data: OrganizationMembership;
}

export interface OrganizationMembershipCreatedResponse
extends EventResponseBase {
event: 'organization_membership.created';
data: OrganizationMembershipResponse;
}

export interface OrganizationMembershipDeleted extends EventBase {
event: 'organization_membership.deleted';
data: OrganizationMembership;
}

export interface OrganizationMembershipDeletedResponse
extends EventResponseBase {
event: 'organization_membership.deleted';
data: OrganizationMembershipResponse;
}

export interface OrganizationMembershipUpdated extends EventBase {
event: 'organization_membership.updated';
data: OrganizationMembership;
Expand All @@ -239,11 +267,17 @@ export interface OrganizationMembershipUpdatedResponse
data: OrganizationMembershipResponse;
}

/**
* @deprecated Use OrganizationMembershipDeleted instead. Will be removed in a future major version.
*/
export interface OrganizationMembershipRemoved extends EventBase {
event: 'organization_membership.removed';
data: OrganizationMembership;
}

/**
* @deprecated Use OrganizationMembershipDeletedResponse instead. Will be removed in a future major version.
*/
export interface OrganizationMembershipRemovedResponse
extends EventResponseBase {
event: 'organization_membership.removed';
Expand Down Expand Up @@ -309,6 +343,8 @@ export type Event =
| UserUpdatedEvent
| UserDeletedEvent
| OrganizationMembershipAdded
| OrganizationMembershipCreated
| OrganizationMembershipDeleted
| OrganizationMembershipUpdated
| OrganizationMembershipRemoved
| SessionCreatedEvent
Expand All @@ -335,6 +371,8 @@ export type EventResponse =
| UserUpdatedEventResponse
| UserDeletedEventResponse
| OrganizationMembershipAddedResponse
| OrganizationMembershipCreatedResponse
| OrganizationMembershipDeletedResponse
| OrganizationMembershipUpdatedResponse
| OrganizationMembershipRemovedResponse
| SessionCreatedEventResponse
Expand Down
2 changes: 2 additions & 0 deletions src/common/serializers/event.serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ export const deserializeEvent = (event: EventResponse): Event => {
data: deserializeUser(event.data),
};
case 'organization_membership.added':
case 'organization_membership.created':
case 'organization_membership.deleted':
case 'organization_membership.updated':
case 'organization_membership.removed':
return {
Expand Down

0 comments on commit 138060e

Please sign in to comment.