From 942d9d666c64dbdf5b962b18b55ceddf435b4576 Mon Sep 17 00:00:00 2001 From: Vijay Oommen Date: Tue, 16 Sep 2025 13:35:21 -0500 Subject: [PATCH] PM-23366 Define Categories and map the events to the categories (#16444) --- libs/common/src/enums/event-category.enum.ts | 110 +++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 libs/common/src/enums/event-category.enum.ts diff --git a/libs/common/src/enums/event-category.enum.ts b/libs/common/src/enums/event-category.enum.ts new file mode 100644 index 0000000000..a00de47730 --- /dev/null +++ b/libs/common/src/enums/event-category.enum.ts @@ -0,0 +1,110 @@ +import { EventType } from "./event-type.enum"; + +export const EventCategory = { + UserEvents: "userEvents", + ItemEvents: "itemEvents", + CollectionEvents: "collectionEvents", + GroupEvents: "groupEvents", + OrganizationMemberEvents: "organizationMemberEvents", + OrganizationEvents: "organizationEvents", + ProviderEvents: "providerEvents", +} as const; + +export type EventCategory = (typeof EventCategory)[keyof typeof EventCategory]; + +export const EventCategoryEventTypes: Record = { + [EventCategory.UserEvents]: [ + EventType.User_LoggedIn, + EventType.User_ChangedPassword, + EventType.User_Updated2fa, + EventType.User_Disabled2fa, + EventType.User_Recovered2fa, + EventType.User_FailedLogIn, + EventType.User_FailedLogIn2fa, + EventType.User_ClientExportedVault, + EventType.User_UpdatedTempPassword, + EventType.User_MigratedKeyToKeyConnector, + EventType.User_RequestedDeviceApproval, + EventType.User_TdeOffboardingPasswordSet, + ], + [EventCategory.ItemEvents]: [ + EventType.Cipher_Created, + EventType.Cipher_Updated, + EventType.Cipher_Deleted, + EventType.Cipher_AttachmentCreated, + EventType.Cipher_AttachmentDeleted, + EventType.Cipher_Shared, + EventType.Cipher_UpdatedCollections, + EventType.Cipher_ClientViewed, + EventType.Cipher_ClientToggledPasswordVisible, + EventType.Cipher_ClientToggledHiddenFieldVisible, + EventType.Cipher_ClientToggledCardCodeVisible, + EventType.Cipher_ClientCopiedPassword, + EventType.Cipher_ClientCopiedHiddenField, + EventType.Cipher_ClientCopiedCardCode, + EventType.Cipher_ClientAutofilled, + EventType.Cipher_SoftDeleted, + EventType.Cipher_Restored, + EventType.Cipher_ClientToggledCardNumberVisible, + EventType.Cipher_ClientToggledTOTPSeedVisible, + ], + [EventCategory.CollectionEvents]: [ + EventType.Collection_Created, + EventType.Collection_Updated, + EventType.Collection_Deleted, + ], + [EventCategory.GroupEvents]: [ + EventType.Group_Created, + EventType.Group_Updated, + EventType.Group_Deleted, + ], + [EventCategory.OrganizationMemberEvents]: [ + EventType.OrganizationUser_Invited, + EventType.OrganizationUser_Confirmed, + EventType.OrganizationUser_Updated, + EventType.OrganizationUser_Removed, + EventType.OrganizationUser_UpdatedGroups, + EventType.OrganizationUser_UnlinkedSso, + EventType.OrganizationUser_ResetPassword_Enroll, + EventType.OrganizationUser_ResetPassword_Withdraw, + EventType.OrganizationUser_AdminResetPassword, + EventType.OrganizationUser_ResetSsoLink, + EventType.OrganizationUser_FirstSsoLogin, + EventType.OrganizationUser_Revoked, + EventType.OrganizationUser_Restored, + EventType.OrganizationUser_ApprovedAuthRequest, + EventType.OrganizationUser_RejectedAuthRequest, + EventType.OrganizationUser_Deleted, + EventType.OrganizationUser_Left, + ], + [EventCategory.OrganizationEvents]: [ + EventType.Organization_Updated, + EventType.Organization_PurgedVault, + EventType.Organization_ClientExportedVault, + EventType.Organization_VaultAccessed, + EventType.Organization_EnabledSso, + EventType.Organization_DisabledSso, + EventType.Organization_EnabledKeyConnector, + EventType.Organization_DisabledKeyConnector, + EventType.Organization_SponsorshipsSynced, + EventType.Organization_CollectionManagementUpdated, + EventType.Organization_CollectionManagement_LimitCollectionCreationEnabled, + EventType.Organization_CollectionManagement_LimitCollectionCreationDisabled, + EventType.Organization_CollectionManagement_LimitCollectionDeletionEnabled, + EventType.Organization_CollectionManagement_LimitCollectionDeletionDisabled, + EventType.Organization_CollectionManagement_LimitItemDeletionEnabled, + EventType.Organization_CollectionManagement_LimitItemDeletionDisabled, + EventType.Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsEnabled, + EventType.Organization_CollectionManagement_AllowAdminAccessToAllCollectionItemsDisabled, + ], + [EventCategory.ProviderEvents]: [ + EventType.ProviderUser_Invited, + EventType.ProviderUser_Confirmed, + EventType.ProviderUser_Updated, + EventType.ProviderUser_Removed, + EventType.ProviderOrganization_Created, + EventType.ProviderOrganization_Added, + EventType.ProviderOrganization_Removed, + EventType.ProviderOrganization_VaultAccessed, + ], +};