@twin.org/messaging-service 0.0.2-next.2 → 0.0.2-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +121 -42
- package/dist/esm/index.mjs +122 -44
- package/dist/types/index.d.ts +3 -0
- package/dist/types/messagingAdminService.d.ts +53 -0
- package/dist/types/messagingService.d.ts +0 -9
- package/dist/types/models/IMessagingAdminServiceConfig.d.ts +20 -0
- package/dist/types/models/IMessagingAdminServiceConstructorOptions.d.ts +15 -0
- package/dist/types/models/IMessagingServiceConstructorOptions.d.ts +3 -3
- package/docs/changelog.md +28 -0
- package/docs/reference/classes/MessagingAdminService.md +179 -0
- package/docs/reference/classes/MessagingService.md +0 -40
- package/docs/reference/index.md +3 -0
- package/docs/reference/interfaces/IMessagingAdminServiceConfig.md +41 -0
- package/docs/reference/interfaces/IMessagingAdminServiceConstructorOptions.md +25 -0
- package/docs/reference/interfaces/IMessagingServiceConstructorOptions.md +4 -4
- package/locales/en.json +3 -1
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -48,6 +48,120 @@ exports.TemplateEntry = __decorate([
|
|
|
48
48
|
entity.entity()
|
|
49
49
|
], exports.TemplateEntry);
|
|
50
50
|
|
|
51
|
+
// Copyright 2024 IOTA Stiftung.
|
|
52
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
53
|
+
/**
|
|
54
|
+
* Service for performing email messaging operations to a connector.
|
|
55
|
+
*/
|
|
56
|
+
class MessagingAdminService {
|
|
57
|
+
/**
|
|
58
|
+
* Default locale for the messaging service.
|
|
59
|
+
*/
|
|
60
|
+
static _DEFAULT_LOCALE = "en";
|
|
61
|
+
/**
|
|
62
|
+
* Runtime name for the class.
|
|
63
|
+
*/
|
|
64
|
+
CLASS_NAME = "MessagingAdminService";
|
|
65
|
+
/**
|
|
66
|
+
* Entity storage connector used by the service.
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
_entityStorageConnector;
|
|
70
|
+
/**
|
|
71
|
+
* The default locale to use for the messaging service.
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
_defaultLocale;
|
|
75
|
+
/**
|
|
76
|
+
* Initial set of templates to create on startup.
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
_initialTemplates;
|
|
80
|
+
/**
|
|
81
|
+
* Create a new instance of MessagingAdminService.
|
|
82
|
+
* @param options The options for the connector.
|
|
83
|
+
*/
|
|
84
|
+
constructor(options) {
|
|
85
|
+
this._entityStorageConnector = entityStorageModels.EntityStorageConnectorFactory.get(options?.templateEntryStorageConnectorType ?? "template-entry");
|
|
86
|
+
this._defaultLocale = options?.config?.defaultLocale ?? MessagingAdminService._DEFAULT_LOCALE;
|
|
87
|
+
this._initialTemplates = options?.config?.templates;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The component needs to be started when the node is initialized.
|
|
91
|
+
* @param nodeIdentity The identity of the node starting the component.
|
|
92
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
93
|
+
* @returns Nothing.
|
|
94
|
+
*/
|
|
95
|
+
async start(nodeIdentity, nodeLoggingComponentType) {
|
|
96
|
+
if (core.Is.arrayValue(this._initialTemplates)) {
|
|
97
|
+
for (const template of this._initialTemplates) {
|
|
98
|
+
for (const locale of Object.keys(template.content)) {
|
|
99
|
+
await this.setTemplate(template.templateId, locale, template.title, template.content[locale]);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Create or update a template.
|
|
106
|
+
* @param templateId The id of the template.
|
|
107
|
+
* @param locale The locale of the template.
|
|
108
|
+
* @param title The title of the template.
|
|
109
|
+
* @param content The content of the template.
|
|
110
|
+
* @returns Nothing.
|
|
111
|
+
*/
|
|
112
|
+
async setTemplate(templateId, locale, title, content) {
|
|
113
|
+
core.Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
114
|
+
core.Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
115
|
+
core.Guards.stringValue(this.CLASS_NAME, "title", title);
|
|
116
|
+
core.Guards.stringValue(this.CLASS_NAME, "content", content);
|
|
117
|
+
const templateEntry = new exports.TemplateEntry();
|
|
118
|
+
templateEntry.id = `${templateId}:${locale}`;
|
|
119
|
+
templateEntry.dateCreated = new Date(Date.now()).toISOString();
|
|
120
|
+
templateEntry.title = title;
|
|
121
|
+
templateEntry.content = content;
|
|
122
|
+
await this._entityStorageConnector.set(templateEntry);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get the email template by id and locale.
|
|
126
|
+
* @param templateId The id of the email template.
|
|
127
|
+
* @param locale The locale of the email template.
|
|
128
|
+
* @returns The email template.
|
|
129
|
+
*/
|
|
130
|
+
async getTemplate(templateId, locale) {
|
|
131
|
+
core.Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
132
|
+
core.Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
133
|
+
let templateEntry;
|
|
134
|
+
try {
|
|
135
|
+
// First try to get the template for the requested locale
|
|
136
|
+
templateEntry = await this._entityStorageConnector.get(`${templateId}:${locale}`);
|
|
137
|
+
}
|
|
138
|
+
catch { }
|
|
139
|
+
// If the template is not found for the requested locale, try to get it for the default locale
|
|
140
|
+
// only if the requested locale is different from the default locale
|
|
141
|
+
if (core.Is.empty(templateEntry) && this._defaultLocale !== locale) {
|
|
142
|
+
try {
|
|
143
|
+
templateEntry = await this._entityStorageConnector.get(`${templateId}:${this._defaultLocale}`);
|
|
144
|
+
}
|
|
145
|
+
catch { }
|
|
146
|
+
}
|
|
147
|
+
if (core.Is.empty(templateEntry)) {
|
|
148
|
+
throw new core.GeneralError(this.CLASS_NAME, "getTemplateFailed", { templateId, locale });
|
|
149
|
+
}
|
|
150
|
+
return templateEntry;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Remove a template.
|
|
154
|
+
* @param templateId The id of the template.
|
|
155
|
+
* @param locale The locale of the template.
|
|
156
|
+
* @returns Nothing
|
|
157
|
+
*/
|
|
158
|
+
async removeTemplate(templateId, locale) {
|
|
159
|
+
core.Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
160
|
+
core.Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
161
|
+
return this._entityStorageConnector.remove(`${templateId}:${locale}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
51
165
|
// Copyright 2024 IOTA Stiftung.
|
|
52
166
|
// SPDX-License-Identifier: Apache-2.0.
|
|
53
167
|
/**
|
|
@@ -74,10 +188,10 @@ class MessagingService {
|
|
|
74
188
|
*/
|
|
75
189
|
_smsMessagingConnector;
|
|
76
190
|
/**
|
|
77
|
-
*
|
|
191
|
+
* The admin component for the messaging.
|
|
78
192
|
* @internal
|
|
79
193
|
*/
|
|
80
|
-
|
|
194
|
+
_messagingAdminComponent;
|
|
81
195
|
/**
|
|
82
196
|
* Create a new instance of MessagingService.
|
|
83
197
|
* @param options The options for the connector.
|
|
@@ -92,7 +206,7 @@ class MessagingService {
|
|
|
92
206
|
if (core.Is.stringValue(options?.messagingSmsConnectorType)) {
|
|
93
207
|
this._smsMessagingConnector = messagingModels.MessagingSmsConnectorFactory.get(options.messagingSmsConnectorType);
|
|
94
208
|
}
|
|
95
|
-
this.
|
|
209
|
+
this._messagingAdminComponent = core.ComponentFactory.get(options?.messagingAdminComponentType ?? "messaging-admin");
|
|
96
210
|
}
|
|
97
211
|
/**
|
|
98
212
|
* Send a custom email.
|
|
@@ -112,7 +226,7 @@ class MessagingService {
|
|
|
112
226
|
core.Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
113
227
|
core.Guards.object(this.CLASS_NAME, "data", data);
|
|
114
228
|
core.Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
115
|
-
const template = await this.getTemplate(templateId, locale);
|
|
229
|
+
const template = await this._messagingAdminComponent.getTemplate(templateId, locale);
|
|
116
230
|
const populatedTemplate = this.populateTemplate(template, data);
|
|
117
231
|
return this._emailMessagingConnector.sendCustomEmail(sender, recipients, populatedTemplate.title, populatedTemplate.content);
|
|
118
232
|
}
|
|
@@ -146,7 +260,7 @@ class MessagingService {
|
|
|
146
260
|
core.Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
147
261
|
core.Guards.object(this.CLASS_NAME, "data", data);
|
|
148
262
|
core.Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
149
|
-
const template = await this.getTemplate(templateId, locale);
|
|
263
|
+
const template = await this._messagingAdminComponent.getTemplate(templateId, locale);
|
|
150
264
|
const populatedTemplate = this.populateTemplate(template, data);
|
|
151
265
|
return this._pushNotificationMessagingConnector.sendSinglePushNotification(deviceAddress, populatedTemplate.title, populatedTemplate.content);
|
|
152
266
|
}
|
|
@@ -166,46 +280,10 @@ class MessagingService {
|
|
|
166
280
|
core.Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
167
281
|
core.Guards.object(this.CLASS_NAME, "data", data);
|
|
168
282
|
core.Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
169
|
-
const template = await this.getTemplate(templateId, locale);
|
|
283
|
+
const template = await this._messagingAdminComponent.getTemplate(templateId, locale);
|
|
170
284
|
const populatedTemplate = this.populateTemplate(template, data);
|
|
171
285
|
return this._smsMessagingConnector.sendSMS(phoneNumber, populatedTemplate.content);
|
|
172
286
|
}
|
|
173
|
-
/**
|
|
174
|
-
* Create or update a template.
|
|
175
|
-
* @param templateId The id of the template.
|
|
176
|
-
* @param locale The locale of the template.
|
|
177
|
-
* @param title The title of the template.
|
|
178
|
-
* @param content The content of the template.
|
|
179
|
-
* @returns If the template was created or updated successfully.
|
|
180
|
-
*/
|
|
181
|
-
async createOrUpdateTemplate(templateId, locale, title, content) {
|
|
182
|
-
core.Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
183
|
-
core.Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
184
|
-
core.Guards.stringValue(this.CLASS_NAME, "title", title);
|
|
185
|
-
core.Guards.stringValue(this.CLASS_NAME, "content", content);
|
|
186
|
-
const templateEntry = new exports.TemplateEntry();
|
|
187
|
-
templateEntry.id = `${templateId}:${locale}`;
|
|
188
|
-
templateEntry.dateCreated = new Date(Date.now()).toISOString();
|
|
189
|
-
templateEntry.title = title;
|
|
190
|
-
templateEntry.content = content;
|
|
191
|
-
await this._entityStorageConnector.set(templateEntry);
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Get the email template by id and locale.
|
|
196
|
-
* @param templateId The id of the email template.
|
|
197
|
-
* @param locale The locale of the email template.
|
|
198
|
-
* @returns The email template.
|
|
199
|
-
* @internal
|
|
200
|
-
*/
|
|
201
|
-
async getTemplate(templateId, locale) {
|
|
202
|
-
const entityId = `${templateId}:${locale}`;
|
|
203
|
-
const templateInfo = await this._entityStorageConnector.get(entityId);
|
|
204
|
-
if (!templateInfo) {
|
|
205
|
-
throw new core.GeneralError(this.CLASS_NAME, "getTemplateFailed", { templateId, locale });
|
|
206
|
-
}
|
|
207
|
-
return templateInfo;
|
|
208
|
-
}
|
|
209
287
|
/**
|
|
210
288
|
* Populate the template with data.
|
|
211
289
|
* @param template The template.
|
|
@@ -240,5 +318,6 @@ function initSchema() {
|
|
|
240
318
|
entity.EntitySchemaFactory.register("TemplateEntry", () => entity.EntitySchemaHelper.getSchema(exports.TemplateEntry));
|
|
241
319
|
}
|
|
242
320
|
|
|
321
|
+
exports.MessagingAdminService = MessagingAdminService;
|
|
243
322
|
exports.MessagingService = MessagingService;
|
|
244
323
|
exports.initSchema = initSchema;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { property, SortDirection, entity, EntitySchemaFactory, EntitySchemaHelper } from '@twin.org/entity';
|
|
2
|
-
import { Is, GeneralError,
|
|
2
|
+
import { Is, Guards, GeneralError, ComponentFactory } from '@twin.org/core';
|
|
3
3
|
import { EntityStorageConnectorFactory } from '@twin.org/entity-storage-models';
|
|
4
4
|
import { MessagingEmailConnectorFactory, MessagingPushNotificationsConnectorFactory, MessagingSmsConnectorFactory } from '@twin.org/messaging-models';
|
|
5
5
|
|
|
@@ -46,6 +46,120 @@ TemplateEntry = __decorate([
|
|
|
46
46
|
entity()
|
|
47
47
|
], TemplateEntry);
|
|
48
48
|
|
|
49
|
+
// Copyright 2024 IOTA Stiftung.
|
|
50
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
51
|
+
/**
|
|
52
|
+
* Service for performing email messaging operations to a connector.
|
|
53
|
+
*/
|
|
54
|
+
class MessagingAdminService {
|
|
55
|
+
/**
|
|
56
|
+
* Default locale for the messaging service.
|
|
57
|
+
*/
|
|
58
|
+
static _DEFAULT_LOCALE = "en";
|
|
59
|
+
/**
|
|
60
|
+
* Runtime name for the class.
|
|
61
|
+
*/
|
|
62
|
+
CLASS_NAME = "MessagingAdminService";
|
|
63
|
+
/**
|
|
64
|
+
* Entity storage connector used by the service.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
_entityStorageConnector;
|
|
68
|
+
/**
|
|
69
|
+
* The default locale to use for the messaging service.
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
_defaultLocale;
|
|
73
|
+
/**
|
|
74
|
+
* Initial set of templates to create on startup.
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
_initialTemplates;
|
|
78
|
+
/**
|
|
79
|
+
* Create a new instance of MessagingAdminService.
|
|
80
|
+
* @param options The options for the connector.
|
|
81
|
+
*/
|
|
82
|
+
constructor(options) {
|
|
83
|
+
this._entityStorageConnector = EntityStorageConnectorFactory.get(options?.templateEntryStorageConnectorType ?? "template-entry");
|
|
84
|
+
this._defaultLocale = options?.config?.defaultLocale ?? MessagingAdminService._DEFAULT_LOCALE;
|
|
85
|
+
this._initialTemplates = options?.config?.templates;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The component needs to be started when the node is initialized.
|
|
89
|
+
* @param nodeIdentity The identity of the node starting the component.
|
|
90
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
91
|
+
* @returns Nothing.
|
|
92
|
+
*/
|
|
93
|
+
async start(nodeIdentity, nodeLoggingComponentType) {
|
|
94
|
+
if (Is.arrayValue(this._initialTemplates)) {
|
|
95
|
+
for (const template of this._initialTemplates) {
|
|
96
|
+
for (const locale of Object.keys(template.content)) {
|
|
97
|
+
await this.setTemplate(template.templateId, locale, template.title, template.content[locale]);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Create or update a template.
|
|
104
|
+
* @param templateId The id of the template.
|
|
105
|
+
* @param locale The locale of the template.
|
|
106
|
+
* @param title The title of the template.
|
|
107
|
+
* @param content The content of the template.
|
|
108
|
+
* @returns Nothing.
|
|
109
|
+
*/
|
|
110
|
+
async setTemplate(templateId, locale, title, content) {
|
|
111
|
+
Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
112
|
+
Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
113
|
+
Guards.stringValue(this.CLASS_NAME, "title", title);
|
|
114
|
+
Guards.stringValue(this.CLASS_NAME, "content", content);
|
|
115
|
+
const templateEntry = new TemplateEntry();
|
|
116
|
+
templateEntry.id = `${templateId}:${locale}`;
|
|
117
|
+
templateEntry.dateCreated = new Date(Date.now()).toISOString();
|
|
118
|
+
templateEntry.title = title;
|
|
119
|
+
templateEntry.content = content;
|
|
120
|
+
await this._entityStorageConnector.set(templateEntry);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get the email template by id and locale.
|
|
124
|
+
* @param templateId The id of the email template.
|
|
125
|
+
* @param locale The locale of the email template.
|
|
126
|
+
* @returns The email template.
|
|
127
|
+
*/
|
|
128
|
+
async getTemplate(templateId, locale) {
|
|
129
|
+
Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
130
|
+
Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
131
|
+
let templateEntry;
|
|
132
|
+
try {
|
|
133
|
+
// First try to get the template for the requested locale
|
|
134
|
+
templateEntry = await this._entityStorageConnector.get(`${templateId}:${locale}`);
|
|
135
|
+
}
|
|
136
|
+
catch { }
|
|
137
|
+
// If the template is not found for the requested locale, try to get it for the default locale
|
|
138
|
+
// only if the requested locale is different from the default locale
|
|
139
|
+
if (Is.empty(templateEntry) && this._defaultLocale !== locale) {
|
|
140
|
+
try {
|
|
141
|
+
templateEntry = await this._entityStorageConnector.get(`${templateId}:${this._defaultLocale}`);
|
|
142
|
+
}
|
|
143
|
+
catch { }
|
|
144
|
+
}
|
|
145
|
+
if (Is.empty(templateEntry)) {
|
|
146
|
+
throw new GeneralError(this.CLASS_NAME, "getTemplateFailed", { templateId, locale });
|
|
147
|
+
}
|
|
148
|
+
return templateEntry;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Remove a template.
|
|
152
|
+
* @param templateId The id of the template.
|
|
153
|
+
* @param locale The locale of the template.
|
|
154
|
+
* @returns Nothing
|
|
155
|
+
*/
|
|
156
|
+
async removeTemplate(templateId, locale) {
|
|
157
|
+
Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
158
|
+
Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
159
|
+
return this._entityStorageConnector.remove(`${templateId}:${locale}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
49
163
|
// Copyright 2024 IOTA Stiftung.
|
|
50
164
|
// SPDX-License-Identifier: Apache-2.0.
|
|
51
165
|
/**
|
|
@@ -72,10 +186,10 @@ class MessagingService {
|
|
|
72
186
|
*/
|
|
73
187
|
_smsMessagingConnector;
|
|
74
188
|
/**
|
|
75
|
-
*
|
|
189
|
+
* The admin component for the messaging.
|
|
76
190
|
* @internal
|
|
77
191
|
*/
|
|
78
|
-
|
|
192
|
+
_messagingAdminComponent;
|
|
79
193
|
/**
|
|
80
194
|
* Create a new instance of MessagingService.
|
|
81
195
|
* @param options The options for the connector.
|
|
@@ -90,7 +204,7 @@ class MessagingService {
|
|
|
90
204
|
if (Is.stringValue(options?.messagingSmsConnectorType)) {
|
|
91
205
|
this._smsMessagingConnector = MessagingSmsConnectorFactory.get(options.messagingSmsConnectorType);
|
|
92
206
|
}
|
|
93
|
-
this.
|
|
207
|
+
this._messagingAdminComponent = ComponentFactory.get(options?.messagingAdminComponentType ?? "messaging-admin");
|
|
94
208
|
}
|
|
95
209
|
/**
|
|
96
210
|
* Send a custom email.
|
|
@@ -110,7 +224,7 @@ class MessagingService {
|
|
|
110
224
|
Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
111
225
|
Guards.object(this.CLASS_NAME, "data", data);
|
|
112
226
|
Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
113
|
-
const template = await this.getTemplate(templateId, locale);
|
|
227
|
+
const template = await this._messagingAdminComponent.getTemplate(templateId, locale);
|
|
114
228
|
const populatedTemplate = this.populateTemplate(template, data);
|
|
115
229
|
return this._emailMessagingConnector.sendCustomEmail(sender, recipients, populatedTemplate.title, populatedTemplate.content);
|
|
116
230
|
}
|
|
@@ -144,7 +258,7 @@ class MessagingService {
|
|
|
144
258
|
Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
145
259
|
Guards.object(this.CLASS_NAME, "data", data);
|
|
146
260
|
Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
147
|
-
const template = await this.getTemplate(templateId, locale);
|
|
261
|
+
const template = await this._messagingAdminComponent.getTemplate(templateId, locale);
|
|
148
262
|
const populatedTemplate = this.populateTemplate(template, data);
|
|
149
263
|
return this._pushNotificationMessagingConnector.sendSinglePushNotification(deviceAddress, populatedTemplate.title, populatedTemplate.content);
|
|
150
264
|
}
|
|
@@ -164,46 +278,10 @@ class MessagingService {
|
|
|
164
278
|
Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
165
279
|
Guards.object(this.CLASS_NAME, "data", data);
|
|
166
280
|
Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
167
|
-
const template = await this.getTemplate(templateId, locale);
|
|
281
|
+
const template = await this._messagingAdminComponent.getTemplate(templateId, locale);
|
|
168
282
|
const populatedTemplate = this.populateTemplate(template, data);
|
|
169
283
|
return this._smsMessagingConnector.sendSMS(phoneNumber, populatedTemplate.content);
|
|
170
284
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Create or update a template.
|
|
173
|
-
* @param templateId The id of the template.
|
|
174
|
-
* @param locale The locale of the template.
|
|
175
|
-
* @param title The title of the template.
|
|
176
|
-
* @param content The content of the template.
|
|
177
|
-
* @returns If the template was created or updated successfully.
|
|
178
|
-
*/
|
|
179
|
-
async createOrUpdateTemplate(templateId, locale, title, content) {
|
|
180
|
-
Guards.stringValue(this.CLASS_NAME, "templateId", templateId);
|
|
181
|
-
Guards.stringValue(this.CLASS_NAME, "locale", locale);
|
|
182
|
-
Guards.stringValue(this.CLASS_NAME, "title", title);
|
|
183
|
-
Guards.stringValue(this.CLASS_NAME, "content", content);
|
|
184
|
-
const templateEntry = new TemplateEntry();
|
|
185
|
-
templateEntry.id = `${templateId}:${locale}`;
|
|
186
|
-
templateEntry.dateCreated = new Date(Date.now()).toISOString();
|
|
187
|
-
templateEntry.title = title;
|
|
188
|
-
templateEntry.content = content;
|
|
189
|
-
await this._entityStorageConnector.set(templateEntry);
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Get the email template by id and locale.
|
|
194
|
-
* @param templateId The id of the email template.
|
|
195
|
-
* @param locale The locale of the email template.
|
|
196
|
-
* @returns The email template.
|
|
197
|
-
* @internal
|
|
198
|
-
*/
|
|
199
|
-
async getTemplate(templateId, locale) {
|
|
200
|
-
const entityId = `${templateId}:${locale}`;
|
|
201
|
-
const templateInfo = await this._entityStorageConnector.get(entityId);
|
|
202
|
-
if (!templateInfo) {
|
|
203
|
-
throw new GeneralError(this.CLASS_NAME, "getTemplateFailed", { templateId, locale });
|
|
204
|
-
}
|
|
205
|
-
return templateInfo;
|
|
206
|
-
}
|
|
207
285
|
/**
|
|
208
286
|
* Populate the template with data.
|
|
209
287
|
* @param template The template.
|
|
@@ -238,4 +316,4 @@ function initSchema() {
|
|
|
238
316
|
EntitySchemaFactory.register("TemplateEntry", () => EntitySchemaHelper.getSchema(TemplateEntry));
|
|
239
317
|
}
|
|
240
318
|
|
|
241
|
-
export { MessagingService, TemplateEntry, initSchema };
|
|
319
|
+
export { MessagingAdminService, MessagingService, TemplateEntry, initSchema };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./entities/templateEntry";
|
|
2
|
+
export * from "./messagingAdminService";
|
|
2
3
|
export * from "./messagingService";
|
|
4
|
+
export * from "./models/IMessagingAdminServiceConfig";
|
|
5
|
+
export * from "./models/IMessagingAdminServiceConstructorOptions";
|
|
3
6
|
export * from "./models/IMessagingServiceConstructorOptions";
|
|
4
7
|
export * from "./schema";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { IMessagingAdminComponent } from "@twin.org/messaging-models";
|
|
2
|
+
import type { IMessagingAdminServiceConstructorOptions } from "./models/IMessagingAdminServiceConstructorOptions";
|
|
3
|
+
/**
|
|
4
|
+
* Service for performing email messaging operations to a connector.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MessagingAdminService implements IMessagingAdminComponent {
|
|
7
|
+
/**
|
|
8
|
+
* Default locale for the messaging service.
|
|
9
|
+
*/
|
|
10
|
+
private static readonly _DEFAULT_LOCALE;
|
|
11
|
+
/**
|
|
12
|
+
* Runtime name for the class.
|
|
13
|
+
*/
|
|
14
|
+
readonly CLASS_NAME: string;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new instance of MessagingAdminService.
|
|
17
|
+
* @param options The options for the connector.
|
|
18
|
+
*/
|
|
19
|
+
constructor(options?: IMessagingAdminServiceConstructorOptions);
|
|
20
|
+
/**
|
|
21
|
+
* The component needs to be started when the node is initialized.
|
|
22
|
+
* @param nodeIdentity The identity of the node starting the component.
|
|
23
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
24
|
+
* @returns Nothing.
|
|
25
|
+
*/
|
|
26
|
+
start(nodeIdentity?: string, nodeLoggingComponentType?: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Create or update a template.
|
|
29
|
+
* @param templateId The id of the template.
|
|
30
|
+
* @param locale The locale of the template.
|
|
31
|
+
* @param title The title of the template.
|
|
32
|
+
* @param content The content of the template.
|
|
33
|
+
* @returns Nothing.
|
|
34
|
+
*/
|
|
35
|
+
setTemplate(templateId: string, locale: string, title: string, content: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the email template by id and locale.
|
|
38
|
+
* @param templateId The id of the email template.
|
|
39
|
+
* @param locale The locale of the email template.
|
|
40
|
+
* @returns The email template.
|
|
41
|
+
*/
|
|
42
|
+
getTemplate(templateId: string, locale: string): Promise<{
|
|
43
|
+
title: string;
|
|
44
|
+
content: string;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Remove a template.
|
|
48
|
+
* @param templateId The id of the template.
|
|
49
|
+
* @param locale The locale of the template.
|
|
50
|
+
* @returns Nothing
|
|
51
|
+
*/
|
|
52
|
+
removeTemplate(templateId: string, locale: string): Promise<void>;
|
|
53
|
+
}
|
|
@@ -54,13 +54,4 @@ export declare class MessagingService implements IMessagingComponent {
|
|
|
54
54
|
sendSMS(phoneNumber: string, templateId: string, data: {
|
|
55
55
|
[key: string]: string;
|
|
56
56
|
}, locale: string): Promise<boolean>;
|
|
57
|
-
/**
|
|
58
|
-
* Create or update a template.
|
|
59
|
-
* @param templateId The id of the template.
|
|
60
|
-
* @param locale The locale of the template.
|
|
61
|
-
* @param title The title of the template.
|
|
62
|
-
* @param content The content of the template.
|
|
63
|
-
* @returns If the template was created or updated successfully.
|
|
64
|
-
*/
|
|
65
|
-
createOrUpdateTemplate(templateId: string, locale: string, title: string, content: string): Promise<boolean>;
|
|
66
57
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the messaging service.
|
|
3
|
+
*/
|
|
4
|
+
export interface IMessagingAdminServiceConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The default locale to use for the messaging service.
|
|
7
|
+
* @default en
|
|
8
|
+
*/
|
|
9
|
+
defaultLocale?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Initial set of templates to create on startup.
|
|
12
|
+
*/
|
|
13
|
+
templates?: {
|
|
14
|
+
templateId: string;
|
|
15
|
+
title: string;
|
|
16
|
+
content: {
|
|
17
|
+
[locale: string]: string;
|
|
18
|
+
};
|
|
19
|
+
}[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IMessagingAdminServiceConfig } from "./IMessagingAdminServiceConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Options for the messaging admin service.
|
|
4
|
+
*/
|
|
5
|
+
export interface IMessagingAdminServiceConstructorOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The type of the entity connector to use.
|
|
8
|
+
* @default template-entry
|
|
9
|
+
*/
|
|
10
|
+
templateEntryStorageConnectorType?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The configuration for the messaging admin service.
|
|
13
|
+
*/
|
|
14
|
+
config?: IMessagingAdminServiceConfig;
|
|
15
|
+
}
|
|
@@ -15,8 +15,8 @@ export interface IMessagingServiceConstructorOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
messagingSmsConnectorType?: string;
|
|
17
17
|
/**
|
|
18
|
-
* The type of the
|
|
19
|
-
* @default
|
|
18
|
+
* The type of the messaging admin component to use.
|
|
19
|
+
* @default messaging-admin
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
messagingAdminComponentType?: string;
|
|
22
22
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @twin.org/messaging-service - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.4](https://github.com/twinfoundation/messaging/compare/messaging-service-v0.0.2-next.3...messaging-service-v0.0.2-next.4) (2025-09-29)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add initial templates config ([66b40eb](https://github.com/twinfoundation/messaging/commit/66b40eb57a478d9f79de540eb847a4fb37894235))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/messaging-models bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
16
|
+
|
|
17
|
+
## [0.0.2-next.3](https://github.com/twinfoundation/messaging/compare/messaging-service-v0.0.2-next.2...messaging-service-v0.0.2-next.3) (2025-09-29)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add messaging admin component ([cbaaca3](https://github.com/twinfoundation/messaging/commit/cbaaca34db6a9f5c51438c201535b4b43a1aea1f))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/messaging-models bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
30
|
+
|
|
3
31
|
## [0.0.2-next.2](https://github.com/twinfoundation/messaging/compare/messaging-service-v0.0.2-next.1...messaging-service-v0.0.2-next.2) (2025-08-29)
|
|
4
32
|
|
|
5
33
|
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Class: MessagingAdminService
|
|
2
|
+
|
|
3
|
+
Service for performing email messaging operations to a connector.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IMessagingAdminComponent`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new MessagingAdminService**(`options?`): `MessagingAdminService`
|
|
14
|
+
|
|
15
|
+
Create a new instance of MessagingAdminService.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`IMessagingAdminServiceConstructorOptions`](../interfaces/IMessagingAdminServiceConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
The options for the connector.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`MessagingAdminService`
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
### CLASS\_NAME
|
|
32
|
+
|
|
33
|
+
> `readonly` **CLASS\_NAME**: `string`
|
|
34
|
+
|
|
35
|
+
Runtime name for the class.
|
|
36
|
+
|
|
37
|
+
#### Implementation of
|
|
38
|
+
|
|
39
|
+
`IMessagingAdminComponent.CLASS_NAME`
|
|
40
|
+
|
|
41
|
+
## Methods
|
|
42
|
+
|
|
43
|
+
### start()
|
|
44
|
+
|
|
45
|
+
> **start**(`nodeIdentity?`, `nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
46
|
+
|
|
47
|
+
The component needs to be started when the node is initialized.
|
|
48
|
+
|
|
49
|
+
#### Parameters
|
|
50
|
+
|
|
51
|
+
##### nodeIdentity?
|
|
52
|
+
|
|
53
|
+
`string`
|
|
54
|
+
|
|
55
|
+
The identity of the node starting the component.
|
|
56
|
+
|
|
57
|
+
##### nodeLoggingComponentType?
|
|
58
|
+
|
|
59
|
+
`string`
|
|
60
|
+
|
|
61
|
+
The node logging component type.
|
|
62
|
+
|
|
63
|
+
#### Returns
|
|
64
|
+
|
|
65
|
+
`Promise`\<`void`\>
|
|
66
|
+
|
|
67
|
+
Nothing.
|
|
68
|
+
|
|
69
|
+
#### Implementation of
|
|
70
|
+
|
|
71
|
+
`IMessagingAdminComponent.start`
|
|
72
|
+
|
|
73
|
+
***
|
|
74
|
+
|
|
75
|
+
### setTemplate()
|
|
76
|
+
|
|
77
|
+
> **setTemplate**(`templateId`, `locale`, `title`, `content`): `Promise`\<`void`\>
|
|
78
|
+
|
|
79
|
+
Create or update a template.
|
|
80
|
+
|
|
81
|
+
#### Parameters
|
|
82
|
+
|
|
83
|
+
##### templateId
|
|
84
|
+
|
|
85
|
+
`string`
|
|
86
|
+
|
|
87
|
+
The id of the template.
|
|
88
|
+
|
|
89
|
+
##### locale
|
|
90
|
+
|
|
91
|
+
`string`
|
|
92
|
+
|
|
93
|
+
The locale of the template.
|
|
94
|
+
|
|
95
|
+
##### title
|
|
96
|
+
|
|
97
|
+
`string`
|
|
98
|
+
|
|
99
|
+
The title of the template.
|
|
100
|
+
|
|
101
|
+
##### content
|
|
102
|
+
|
|
103
|
+
`string`
|
|
104
|
+
|
|
105
|
+
The content of the template.
|
|
106
|
+
|
|
107
|
+
#### Returns
|
|
108
|
+
|
|
109
|
+
`Promise`\<`void`\>
|
|
110
|
+
|
|
111
|
+
Nothing.
|
|
112
|
+
|
|
113
|
+
#### Implementation of
|
|
114
|
+
|
|
115
|
+
`IMessagingAdminComponent.setTemplate`
|
|
116
|
+
|
|
117
|
+
***
|
|
118
|
+
|
|
119
|
+
### getTemplate()
|
|
120
|
+
|
|
121
|
+
> **getTemplate**(`templateId`, `locale`): `Promise`\<\{ `title`: `string`; `content`: `string`; \}\>
|
|
122
|
+
|
|
123
|
+
Get the email template by id and locale.
|
|
124
|
+
|
|
125
|
+
#### Parameters
|
|
126
|
+
|
|
127
|
+
##### templateId
|
|
128
|
+
|
|
129
|
+
`string`
|
|
130
|
+
|
|
131
|
+
The id of the email template.
|
|
132
|
+
|
|
133
|
+
##### locale
|
|
134
|
+
|
|
135
|
+
`string`
|
|
136
|
+
|
|
137
|
+
The locale of the email template.
|
|
138
|
+
|
|
139
|
+
#### Returns
|
|
140
|
+
|
|
141
|
+
`Promise`\<\{ `title`: `string`; `content`: `string`; \}\>
|
|
142
|
+
|
|
143
|
+
The email template.
|
|
144
|
+
|
|
145
|
+
#### Implementation of
|
|
146
|
+
|
|
147
|
+
`IMessagingAdminComponent.getTemplate`
|
|
148
|
+
|
|
149
|
+
***
|
|
150
|
+
|
|
151
|
+
### removeTemplate()
|
|
152
|
+
|
|
153
|
+
> **removeTemplate**(`templateId`, `locale`): `Promise`\<`void`\>
|
|
154
|
+
|
|
155
|
+
Remove a template.
|
|
156
|
+
|
|
157
|
+
#### Parameters
|
|
158
|
+
|
|
159
|
+
##### templateId
|
|
160
|
+
|
|
161
|
+
`string`
|
|
162
|
+
|
|
163
|
+
The id of the template.
|
|
164
|
+
|
|
165
|
+
##### locale
|
|
166
|
+
|
|
167
|
+
`string`
|
|
168
|
+
|
|
169
|
+
The locale of the template.
|
|
170
|
+
|
|
171
|
+
#### Returns
|
|
172
|
+
|
|
173
|
+
`Promise`\<`void`\>
|
|
174
|
+
|
|
175
|
+
Nothing
|
|
176
|
+
|
|
177
|
+
#### Implementation of
|
|
178
|
+
|
|
179
|
+
`IMessagingAdminComponent.removeTemplate`
|
|
@@ -201,43 +201,3 @@ If the SMS was sent successfully.
|
|
|
201
201
|
#### Implementation of
|
|
202
202
|
|
|
203
203
|
`IMessagingComponent.sendSMS`
|
|
204
|
-
|
|
205
|
-
***
|
|
206
|
-
|
|
207
|
-
### createOrUpdateTemplate()
|
|
208
|
-
|
|
209
|
-
> **createOrUpdateTemplate**(`templateId`, `locale`, `title`, `content`): `Promise`\<`boolean`\>
|
|
210
|
-
|
|
211
|
-
Create or update a template.
|
|
212
|
-
|
|
213
|
-
#### Parameters
|
|
214
|
-
|
|
215
|
-
##### templateId
|
|
216
|
-
|
|
217
|
-
`string`
|
|
218
|
-
|
|
219
|
-
The id of the template.
|
|
220
|
-
|
|
221
|
-
##### locale
|
|
222
|
-
|
|
223
|
-
`string`
|
|
224
|
-
|
|
225
|
-
The locale of the template.
|
|
226
|
-
|
|
227
|
-
##### title
|
|
228
|
-
|
|
229
|
-
`string`
|
|
230
|
-
|
|
231
|
-
The title of the template.
|
|
232
|
-
|
|
233
|
-
##### content
|
|
234
|
-
|
|
235
|
-
`string`
|
|
236
|
-
|
|
237
|
-
The content of the template.
|
|
238
|
-
|
|
239
|
-
#### Returns
|
|
240
|
-
|
|
241
|
-
`Promise`\<`boolean`\>
|
|
242
|
-
|
|
243
|
-
If the template was created or updated successfully.
|
package/docs/reference/index.md
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
## Classes
|
|
4
4
|
|
|
5
5
|
- [TemplateEntry](classes/TemplateEntry.md)
|
|
6
|
+
- [MessagingAdminService](classes/MessagingAdminService.md)
|
|
6
7
|
- [MessagingService](classes/MessagingService.md)
|
|
7
8
|
|
|
8
9
|
## Interfaces
|
|
9
10
|
|
|
11
|
+
- [IMessagingAdminServiceConfig](interfaces/IMessagingAdminServiceConfig.md)
|
|
12
|
+
- [IMessagingAdminServiceConstructorOptions](interfaces/IMessagingAdminServiceConstructorOptions.md)
|
|
10
13
|
- [IMessagingServiceConstructorOptions](interfaces/IMessagingServiceConstructorOptions.md)
|
|
11
14
|
|
|
12
15
|
## Functions
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Interface: IMessagingAdminServiceConfig
|
|
2
|
+
|
|
3
|
+
Options for the messaging service.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### defaultLocale?
|
|
8
|
+
|
|
9
|
+
> `optional` **defaultLocale**: `string`
|
|
10
|
+
|
|
11
|
+
The default locale to use for the messaging service.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
en
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### templates?
|
|
22
|
+
|
|
23
|
+
> `optional` **templates**: `object`[]
|
|
24
|
+
|
|
25
|
+
Initial set of templates to create on startup.
|
|
26
|
+
|
|
27
|
+
#### templateId
|
|
28
|
+
|
|
29
|
+
> **templateId**: `string`
|
|
30
|
+
|
|
31
|
+
#### title
|
|
32
|
+
|
|
33
|
+
> **title**: `string`
|
|
34
|
+
|
|
35
|
+
#### content
|
|
36
|
+
|
|
37
|
+
> **content**: `object`
|
|
38
|
+
|
|
39
|
+
##### Index Signature
|
|
40
|
+
|
|
41
|
+
\[`locale`: `string`\]: `string`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: IMessagingAdminServiceConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the messaging admin service.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### templateEntryStorageConnectorType?
|
|
8
|
+
|
|
9
|
+
> `optional` **templateEntryStorageConnectorType**: `string`
|
|
10
|
+
|
|
11
|
+
The type of the entity connector to use.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
template-entry
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### config?
|
|
22
|
+
|
|
23
|
+
> `optional` **config**: [`IMessagingAdminServiceConfig`](IMessagingAdminServiceConfig.md)
|
|
24
|
+
|
|
25
|
+
The configuration for the messaging admin service.
|
|
@@ -28,14 +28,14 @@ The type of the sms messaging connector to use, defaults to not configured.
|
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
31
|
-
###
|
|
31
|
+
### messagingAdminComponentType?
|
|
32
32
|
|
|
33
|
-
> `optional` **
|
|
33
|
+
> `optional` **messagingAdminComponentType**: `string`
|
|
34
34
|
|
|
35
|
-
The type of the
|
|
35
|
+
The type of the messaging admin component to use.
|
|
36
36
|
|
|
37
37
|
#### Default
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
|
-
|
|
40
|
+
messaging-admin
|
|
41
41
|
```
|
package/locales/en.json
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
},
|
|
5
5
|
"error": {
|
|
6
6
|
"messagingService": {
|
|
7
|
-
"getTemplateFailed": "Failed to get template with id: \"{templateId}\" and locale: \"{locale}\"",
|
|
8
7
|
"notConfiguredEmailMessagingConnector": "Email messaging connector was not configured",
|
|
9
8
|
"notConfiguredPushNotificationMessagingConnector": "Push notification messaging connector was not configured",
|
|
10
9
|
"notConfiguredSmsMessagingConnector": "SMS messaging connector was not configured"
|
|
10
|
+
},
|
|
11
|
+
"messagingAdminService": {
|
|
12
|
+
"getTemplateFailed": "Failed to get template with id: \"{templateId}\" and locale: \"{locale}\""
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/messaging-service",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.4",
|
|
4
4
|
"description": "Messaging service implementation",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@twin.org/entity": "next",
|
|
19
19
|
"@twin.org/entity-storage-models": "next",
|
|
20
20
|
"@twin.org/logging-models": "next",
|
|
21
|
-
"@twin.org/messaging-models": "0.0.2-next.
|
|
21
|
+
"@twin.org/messaging-models": "0.0.2-next.4",
|
|
22
22
|
"@twin.org/nameof": "next"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/cjs/index.cjs",
|