From 2bc47c28302ea364d452804c6a70132dc499164b Mon Sep 17 00:00:00 2001 From: Lambdius Date: Thu, 29 Oct 2026 00:19:50 +0000 Subject: [PATCH 1/2] feat(notification): add explicit delivery destination --- package.json | 2 +- src/enums.ts | 8 +++++++ src/kafka/notification.schema.json | 36 ++++++++++++++++++++++++++++++ src/types.ts | 7 ++++++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 33406ad..d889d4d 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.1.4", + "version": "3.1.5", "types": "dist/index.d.ts", "main": "dist/index.js", "exports": { diff --git a/src/enums.ts b/src/enums.ts index 17b7a6e..b1888d6 100644 --- a/src/enums.ts +++ b/src/enums.ts @@ -99,6 +99,14 @@ export enum InvalidationScope { /* eslint-enable prettier/prettier */ } +export enum ChannelType { + /* eslint-disable prettier/prettier */ + IN_APP = "IN_APP", + EMAIL = "EMAIL", + SMS = "SMS", + /* eslint-enable prettier/prettier */ +} + export enum NotificationContentKind { /* eslint-disable prettier/prettier */ TEMPLATE = "TEMPLATE", diff --git a/src/kafka/notification.schema.json b/src/kafka/notification.schema.json index cb62368..8a4e71c 100644 --- a/src/kafka/notification.schema.json +++ b/src/kafka/notification.schema.json @@ -41,6 +41,15 @@ ] }, "dedupKey": { "type": "string" }, + "delivery": { + "type": "object", + "additionalProperties": false, + "required": ["channelType", "address"], + "properties": { + "channelType": { "type": "string", "enum": ["EMAIL", "SMS"] }, + "address": { "type": "string", "minLength": 1 } + } + }, "language": { "type": "string", "minLength": 1 }, "title": { "type": "string" }, "text": { "type": "string" } @@ -78,6 +87,15 @@ ] }, "dedupKey": { "type": "string" }, + "delivery": { + "type": "object", + "additionalProperties": false, + "required": ["channelType", "address"], + "properties": { + "channelType": { "type": "string", "enum": ["EMAIL", "SMS"] }, + "address": { "type": "string", "minLength": 1 } + } + }, "params": { "type": "object", "additionalProperties": { "type": "string" } @@ -164,6 +182,15 @@ ] }, "dedupKey": { "type": "string" }, + "delivery": { + "type": "object", + "additionalProperties": false, + "required": ["channelType", "address"], + "properties": { + "channelType": { "type": "string", "enum": ["EMAIL", "SMS"] }, + "address": { "type": "string", "minLength": 1 } + } + }, "language": { "type": "string", "minLength": 1 }, "title": { "type": "string" }, "text": { "type": "string" } @@ -201,6 +228,15 @@ ] }, "dedupKey": { "type": "string" }, + "delivery": { + "type": "object", + "additionalProperties": false, + "required": ["channelType", "address"], + "properties": { + "channelType": { "type": "string", "enum": ["EMAIL", "SMS"] }, + "address": { "type": "string", "minLength": 1 } + } + }, "params": { "type": "object", "additionalProperties": { "type": "string" } diff --git a/src/types.ts b/src/types.ts index 8282af1..9559405 100644 --- a/src/types.ts +++ b/src/types.ts @@ -17,6 +17,7 @@ import { MessageTemplate, PlatformService, PrivilegeScope, + ChannelType, RealmType, } from "./enums"; @@ -513,7 +514,13 @@ declare global { realm?: string; }; + type Delivery = { + channelType: ChannelType.EMAIL | ChannelType.SMS; + address: string; + }; + type BaseInput = { + delivery?: Delivery; category: NotificationCategory; sourceService: PlatformService; recipient: string; From 9965ffd97e1a790cef08571b2ea2c8b8715e571f Mon Sep 17 00:00:00 2001 From: Lambdius Date: Thu, 29 Oct 2026 00:35:57 +0000 Subject: [PATCH 2/2] feat(notification): make template language optional --- src/kafka/notification.schema.json | 4 ++-- src/types.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kafka/notification.schema.json b/src/kafka/notification.schema.json index 8a4e71c..078fffe 100644 --- a/src/kafka/notification.schema.json +++ b/src/kafka/notification.schema.json @@ -67,7 +67,7 @@ "input": { "type": "object", "additionalProperties": false, - "required": ["kind", "recipient", "category", "sourceService", "template", "language"], + "required": ["kind", "recipient", "category", "sourceService", "template"], "properties": { "kind": { "const": "TEMPLATE" }, "recipient": { "type": "string" }, @@ -208,7 +208,7 @@ "input": { "type": "object", "additionalProperties": false, - "required": ["kind", "recipient", "category", "sourceService", "template", "language"], + "required": ["kind", "recipient", "category", "sourceService", "template"], "properties": { "kind": { "const": "TEMPLATE" }, "recipient": { "type": "string" }, diff --git a/src/types.ts b/src/types.ts index 9559405..40d765e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -538,7 +538,7 @@ declare global { kind: NotificationContentKind.TEMPLATE; params?: Record; template: MessageTemplate; - language: string; + language?: string; }; }