From 6a1a5ce609b3409af768a078b35d7812b42d5265 Mon Sep 17 00:00:00 2001 From: Lambdius Date: Fri, 30 Oct 2026 21:28:13 +0000 Subject: [PATCH 1/2] feat(account): add notification email lifecycle events --- src/enums.ts | 9 ++++++--- src/kafka/account.schema.json | 36 ++++++++++++++++++++++++++++++++++- src/types.ts | 35 +++++++++++++++++++++++++++++++++- 3 files changed, 75 insertions(+), 5 deletions(-) diff --git a/src/enums.ts b/src/enums.ts index 352b0a3..eb3a74a 100644 --- a/src/enums.ts +++ b/src/enums.ts @@ -192,9 +192,12 @@ export enum NotificationTopicAction { export enum AccountTopicAction { /* eslint-disable prettier/prettier */ - CREATE = "CREATE", - VERIFY = "VERIFY", - PURGE = "PURGE", + EMAIL_VERIFIED = "EMAIL_VERIFIED", + EMAIL_SELECTED = "EMAIL_SELECTED", + EMAIL_PURGED = "EMAIL_PURGED", + CREATE = "CREATE", + VERIFY = "VERIFY", + PURGE = "PURGE", /* eslint-enable prettier/prettier */ } diff --git a/src/kafka/account.schema.json b/src/kafka/account.schema.json index 4667f7a..40dd65d 100644 --- a/src/kafka/account.schema.json +++ b/src/kafka/account.schema.json @@ -8,7 +8,7 @@ "properties": { "actionType": { "type": "string", - "enum": ["CREATE", "VERIFY", "PURGE"] + "enum": ["CREATE", "VERIFY", "PURGE", "EMAIL_VERIFIED", "EMAIL_SELECTED", "EMAIL_PURGED"] }, "payload": { "type": "object", @@ -36,6 +36,9 @@ } } }, + "replacement": { + "$ref": "#/properties/payload/properties/identifier" + }, "otp": { "type": "string", "minLength": 1 @@ -77,6 +80,37 @@ } } } + }, + { + "if": { + "properties": { + "actionType": { "enum": ["EMAIL_VERIFIED", "EMAIL_SELECTED", "EMAIL_PURGED"] } + } + }, + "then": { + "properties": { + "payload": { + "required": ["account", "identifier"], + "properties": { + "identifier": { "properties": { "type": { "const": "email" } } }, + "replacement": { "properties": { "type": { "const": "email" } } } + }, + "not": { "required": ["otp"] } + } + } + } + }, + { + "if": { + "properties": { + "actionType": { "not": { "const": "EMAIL_PURGED" } } + } + }, + "then": { + "properties": { + "payload": { "not": { "required": ["replacement"] } } + } + } } ] } diff --git a/src/types.ts b/src/types.ts index 61ac6ec..ddaed7d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -486,7 +486,40 @@ declare global { payload: { account: string }; }; - type Message = CreateMessage | VerifyMessage | PurgeMessage; + type EmailIdentifier = Identifier & { type: "email" }; + + type EmailVerifiedMessage = { + actionType: AccountTopicAction.EMAIL_VERIFIED; + payload: { + identifier: EmailIdentifier; + account: string; + }; + }; + + type EmailSelectedMessage = { + actionType: AccountTopicAction.EMAIL_SELECTED; + payload: { + identifier: EmailIdentifier; + account: string; + }; + }; + + type EmailPurgedMessage = { + actionType: AccountTopicAction.EMAIL_PURGED; + payload: { + replacement?: EmailIdentifier; + identifier: EmailIdentifier; + account: string; + }; + }; + + type Message = + | EmailVerifiedMessage + | EmailSelectedMessage + | EmailPurgedMessage + | CreateMessage + | VerifyMessage + | PurgeMessage; } namespace Notification { From c1d5156952d69d02980e29354f29afb604ce8d14 Mon Sep 17 00:00:00 2001 From: Daniil <108626255+Lambdius@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:35:44 +0000 Subject: [PATCH 2/2] chore(release): bump version to 3.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 655a674..8b35226 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "Shared Kafka/gRPC contracts and common enums between MonadIAM services", "author": "Daniil Egorov (https://github.com/Lambdius)", "license": "UNLICENSED", - "version": "3.2.0", + "version": "3.3.0", "types": "dist/index.d.ts", "main": "dist/index.js", "exports": {