Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 8 additions & 0 deletions src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
40 changes: 38 additions & 2 deletions src/kafka/notification.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -58,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" },
Expand All @@ -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" }
Expand Down Expand Up @@ -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" }
Expand All @@ -181,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" },
Expand All @@ -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" }
Expand Down
9 changes: 8 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
MessageTemplate,
PlatformService,
PrivilegeScope,
ChannelType,
RealmType,
} from "./enums";

Expand Down Expand Up @@ -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;
Expand All @@ -531,7 +538,7 @@ declare global {
kind: NotificationContentKind.TEMPLATE;
params?: Record<string, string>;
template: MessageTemplate;
language: string;
language?: string;
};
}

Expand Down
Loading