Перейти к основному содержимому

События

Зачем нужно

Документ описывает доменный каталог событий identity. Все события публикуются в платформенную шину по контракту ../../platform/events-bus.md.

Envelope

type IdentityEvent<TPayload> = {
messageId: string;
messageKind: 'event';
messageType: string;
messageVersion: number;
producer: 'identity';
producerInstance: string;
traceId: string;
occurredAt: string;
correlationId?: string;
actor?: {
type: 'user' | 'service' | 'system';
id?: string;
};
data: TPayload;
metadata?: Record<string, unknown>;
};

Исходящие события

EventКогдаPayload
identity.user.createdсоздан пользовательuserId, status
identity.user.registeredзавершена регистрация пользователяuserId, registeredAt
identity.user.activatedпользователь активированuserId, activatedAt
identity.user.updatedизменён профиль пользователяuserId, changedFields
identity.user.deactivatedпользователь деактивированuserId, reason
identity.user.blockedпользователь заблокированuserId, reason
identity.user.deletedпользователь удалён логически или анонимизированuserId, deletedAt, mode
identity.user_email.addedдобавлен emailuserId, emailId
identity.user_email.removedудалён emailuserId, emailId
identity.user_phone.addedдобавлен телефонuserId, phoneId
identity.user_phone.removedудалён телефонuserId, phoneId
identity.session.createdсоздана сессияsessionId, userId, deviceBindingId
identity.session.revokedсессия отозванаsessionId, userId, reason
identity.login.succeededуспешный входuserId, sessionId, authMethod
identity.login.failedнеуспешная попытка входаidentifierType, reason
identity.password.changedпароль изменёнuserId, changedAt
identity.password_reset.completedсброс пароля завершёнuserId, completedAt
identity.refresh_token.rotatedrefresh token ротированuserId, sessionId, tokenFamilyId
identity.role.assignedназначена рольuserId, roleKey, scope
identity.role.revokedроль снятаuserId, roleKey, scope
identity.family.createdсоздана семьяfamilyGroupId, createdByUserId
identity.family.updatedизменены настройки семьиfamilyGroupId, changedFields
identity.family_student_profile.createdсоздан student profile ребёнкаfamilyGroupId, studentProfileId, createdByUserId
identity.family_student_profile.updatedизменён student profile ребёнкаfamilyGroupId, studentProfileId, changedFields
identity.family_student_profile.linkedstudent profile связан с userfamilyGroupId, studentProfileId, userId
identity.family_member.addedучастник добавлен в семьюfamilyGroupId, userId, relation
identity.family_member.removedучастник удалён из семьи через admin/manual flow; self-service removal не входит в Family MVPfamilyGroupId, userId
identity.delegated_session.startedвзрослый открыл контекст ребёнкаdelegatedSessionId, actorUserId, studentProfileId
identity.delegated_session.endedвзрослый закрыл контекст ребёнкаdelegatedSessionId, actorUserId, studentProfileId
identity.child_device_authorization.createdсоздан запрос входа ребёнка на устройствеauthorizationId, familyGroupId, studentProfileId
identity.child_device_authorization.approvedвход ребёнка на устройстве подтверждёнauthorizationId, approvedByUserId
identity.child_device_authorization.completedна устройстве создана сессия ребёнкаauthorizationId, linkedUserId, studentProfileId, sessionId
identity.child_device_authorization.revokedзапрос входа ребёнка отозванauthorizationId, revokedByUserId
identity.organization_reference.createdсоздана справочная организацияorganizationReferenceId, countryId, regionId?
identity.organization_reference.updatedизменена справочная организацияorganizationReferenceId, changedFields
identity.organization.createdсоздана организацияorganizationId, createdByUserId
identity.organization.updatedизменена организацияorganizationId, changedFields
identity.organization.activatedорганизация стала activeorganizationId, ownerMembershipId
identity.organization.archivedорганизация архивированаorganizationId, archivedByUserId, archivedAt, reason?
identity.organization.restoredорганизация восстановленаorganizationId, restoredByUserId, restoredAt
identity.organization.disputedорганизация переведена в спорный статусorganizationId, reason
identity.organization.marked_duplicateорганизация помечена как возможный/подтверждённый дубльorganizationId, duplicateStatus, matchedOrganizationId?
identity.organization.mergedорганизация-дубль склеена с основнойprimaryOrganizationId, duplicateOrganizationId, mergeId
identity.organization_membership.requestedпользователь подал заявку на вступлениеorganizationId, membershipId, userId
identity.organization_invitation.createdсоздано приглашение в организациюorganizationId, invitationId, deliveryChannel, email?, phone?, invitedUserId?
identity.organization_invitation.sentприглашение в организацию отправленоorganizationId, invitationId, deliveryChannel
identity.organization_invitation.acceptedприглашение в организацию принятоorganizationId, invitationId, acceptedByUserId, membershipId
identity.organization_invitation.rejectedприглашение в организацию отклоненоorganizationId, invitationId, rejectedByUserId?
identity.organization_invitation.revokedприглашение в организацию отозваноorganizationId, invitationId, revokedByUserId
identity.organization_membership.activatedчленство стало activeorganizationId, membershipId, userId, roleId
identity.organization_membership.rejectedзаявка на членство отклоненаorganizationId, membershipId?, userId?
identity.organization_membership.suspendedчленство приостановленоorganizationId, membershipId, userId
identity.organization_membership.leftпользователь вышел из организацииorganizationId, membershipId, userId
identity.organization_ownership_claim.submittedподана заявка на владениеorganizationId, claimId, requestedByUserId
identity.organization_ownership_claim.approvedзаявка на владение одобренаorganizationId, claimId, ownerMembershipId
identity.organization_ownership_claim.rejectedзаявка на владение отклоненаorganizationId, claimId
identity.organization_ownership_claim.disputedзаявка признана спорнойorganizationId, claimId
identity.organization_ownership_transfer.createdсоздана передача владенияorganizationId, transferId, fromMembershipId, toMembershipId?
identity.organization_ownership_transfer.acceptedполучатель принял передачуorganizationId, transferId
identity.organization_ownership_transfer.completedвладение переданоorganizationId, transferId, newOwnerMembershipId
identity.organization_ownership_transfer.cancelledпередача отмененаorganizationId, transferId
identity.organization_student.createdсоздан ученик организацииorganizationId, organizationStudentId
identity.organization_student.updatedизменён ученик организацииorganizationId, organizationStudentId, changedFields
identity.organization_student.archivedученик организации архивированorganizationId, organizationStudentId
identity.organization_student.duplicate_detectedнайден возможный дубль ученикаorganizationId, organizationStudentId?, candidateIds
identity.organization_team.createdсоздана команда организацииorganizationId, teamId
identity.organization_team.updatedизменена команда организацииorganizationId, teamId, changedFields
identity.organization_team.archivedкоманда организации архивированаorganizationId, teamId
identity.organization_permission_grant.createdсоздан organization permission grantorganizationId, grantId, permission, subjectType, subjectId
identity.organization_permission_grant.revokedorganization permission grant отозванorganizationId, grantId
identity.invitation.createdсоздано generic family/system приглашение, не organization membershipinvitationId, targetType, targetId
identity.invitation.acceptedgeneric приглашение принятоinvitationId, acceptedByUserId
identity.invitation.rejectedgeneric приглашение отклоненоinvitationId, rejectedByUserId
identity.invitation.revokedgeneric приглашение отозваноinvitationId, revokedByUserId
identity.oauth_client.createdсоздан OAuth clientclientId
identity.oauth_client.updatedизменён OAuth clientclientId, changedFields
identity.oauth_consent.grantedпользователь выдал OAuth consentuserId, clientId, scopes
identity.oauth_consent.revokedOAuth consent отозванuserId, clientId

Правила

  • События не содержат password hash, refresh token, verification code, OTP, client secret и raw PII.
  • Payload содержит только идентификаторы и безопасные metadata, достаточные для downstream обработки.
  • При изменении payload используется messageVersion.
  • Organization invitation lifecycle публикуется через identity.organization_invitation.*; generic identity.invitation.* не используется для organization membership.
  • События платформенных capabilities (plugin.*, notification.*, settings/navigation) описываются в platform-документах по ADR-035, даже если endpoints временно хостит identity-api.

Входящие события

Identity не изменяет пользователей, роли, семьи или организации по событиям соседних доменов. Соседние домены обращаются в identity через API с user token или service token.

Связанные документы