@twin.org/messaging-service 0.0.1-next.7 → 0.0.1-next.9
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 +4 -8
- package/dist/esm/index.mjs +4 -8
- package/dist/types/index.d.ts +1 -0
- package/dist/types/messagingService.d.ts +2 -10
- package/dist/types/models/IMessagingServiceConstructorOptions.d.ts +22 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/MessagingService.md +54 -36
- package/docs/reference/index.md +4 -0
- package/docs/reference/interfaces/IMessagingServiceConstructorOptions.md +41 -0
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -31,19 +31,19 @@ exports.TemplateEntry = class TemplateEntry {
|
|
|
31
31
|
__decorate([
|
|
32
32
|
entity.property({ type: "string", isPrimary: true }),
|
|
33
33
|
__metadata("design:type", String)
|
|
34
|
-
], exports.TemplateEntry.prototype, "id",
|
|
34
|
+
], exports.TemplateEntry.prototype, "id", undefined);
|
|
35
35
|
__decorate([
|
|
36
36
|
entity.property({ type: "string" }),
|
|
37
37
|
__metadata("design:type", String)
|
|
38
|
-
], exports.TemplateEntry.prototype, "title",
|
|
38
|
+
], exports.TemplateEntry.prototype, "title", undefined);
|
|
39
39
|
__decorate([
|
|
40
40
|
entity.property({ type: "string" }),
|
|
41
41
|
__metadata("design:type", String)
|
|
42
|
-
], exports.TemplateEntry.prototype, "content",
|
|
42
|
+
], exports.TemplateEntry.prototype, "content", undefined);
|
|
43
43
|
__decorate([
|
|
44
44
|
entity.property({ type: "integer" }),
|
|
45
45
|
__metadata("design:type", Number)
|
|
46
|
-
], exports.TemplateEntry.prototype, "ts",
|
|
46
|
+
], exports.TemplateEntry.prototype, "ts", undefined);
|
|
47
47
|
exports.TemplateEntry = __decorate([
|
|
48
48
|
entity.entity()
|
|
49
49
|
], exports.TemplateEntry);
|
|
@@ -85,10 +85,6 @@ class MessagingService {
|
|
|
85
85
|
/**
|
|
86
86
|
* Create a new instance of MessagingService.
|
|
87
87
|
* @param options The options for the connector.
|
|
88
|
-
* @param options.messagingEmailConnectorType The type of the email messaging connector to use, defaults to not configured.
|
|
89
|
-
* @param options.messagingPushNotificationConnectorType The type of the push notifications messaging connector to use, defaults to not configured.
|
|
90
|
-
* @param options.messagingSmsConnectorType The type of the sms messaging connector to use, defaults to not configured.
|
|
91
|
-
* @param options.templateEntryStorageConnectorType The type of the entity connector to use, defaults to "messaging-templates".
|
|
92
88
|
*/
|
|
93
89
|
constructor(options) {
|
|
94
90
|
if (core.Is.stringValue(options?.messagingEmailConnectorType)) {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -29,19 +29,19 @@ let TemplateEntry = class TemplateEntry {
|
|
|
29
29
|
__decorate([
|
|
30
30
|
property({ type: "string", isPrimary: true }),
|
|
31
31
|
__metadata("design:type", String)
|
|
32
|
-
], TemplateEntry.prototype, "id",
|
|
32
|
+
], TemplateEntry.prototype, "id", undefined);
|
|
33
33
|
__decorate([
|
|
34
34
|
property({ type: "string" }),
|
|
35
35
|
__metadata("design:type", String)
|
|
36
|
-
], TemplateEntry.prototype, "title",
|
|
36
|
+
], TemplateEntry.prototype, "title", undefined);
|
|
37
37
|
__decorate([
|
|
38
38
|
property({ type: "string" }),
|
|
39
39
|
__metadata("design:type", String)
|
|
40
|
-
], TemplateEntry.prototype, "content",
|
|
40
|
+
], TemplateEntry.prototype, "content", undefined);
|
|
41
41
|
__decorate([
|
|
42
42
|
property({ type: "integer" }),
|
|
43
43
|
__metadata("design:type", Number)
|
|
44
|
-
], TemplateEntry.prototype, "ts",
|
|
44
|
+
], TemplateEntry.prototype, "ts", undefined);
|
|
45
45
|
TemplateEntry = __decorate([
|
|
46
46
|
entity()
|
|
47
47
|
], TemplateEntry);
|
|
@@ -83,10 +83,6 @@ class MessagingService {
|
|
|
83
83
|
/**
|
|
84
84
|
* Create a new instance of MessagingService.
|
|
85
85
|
* @param options The options for the connector.
|
|
86
|
-
* @param options.messagingEmailConnectorType The type of the email messaging connector to use, defaults to not configured.
|
|
87
|
-
* @param options.messagingPushNotificationConnectorType The type of the push notifications messaging connector to use, defaults to not configured.
|
|
88
|
-
* @param options.messagingSmsConnectorType The type of the sms messaging connector to use, defaults to not configured.
|
|
89
|
-
* @param options.templateEntryStorageConnectorType The type of the entity connector to use, defaults to "messaging-templates".
|
|
90
86
|
*/
|
|
91
87
|
constructor(options) {
|
|
92
88
|
if (Is.stringValue(options?.messagingEmailConnectorType)) {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type IMessagingComponent } from "@twin.org/messaging-models";
|
|
2
|
+
import type { IMessagingServiceConstructorOptions } from "./models/IMessagingServiceConstructorOptions";
|
|
2
3
|
/**
|
|
3
4
|
* Service for performing email messaging operations to a connector.
|
|
4
5
|
*/
|
|
@@ -14,17 +15,8 @@ export declare class MessagingService implements IMessagingComponent {
|
|
|
14
15
|
/**
|
|
15
16
|
* Create a new instance of MessagingService.
|
|
16
17
|
* @param options The options for the connector.
|
|
17
|
-
* @param options.messagingEmailConnectorType The type of the email messaging connector to use, defaults to not configured.
|
|
18
|
-
* @param options.messagingPushNotificationConnectorType The type of the push notifications messaging connector to use, defaults to not configured.
|
|
19
|
-
* @param options.messagingSmsConnectorType The type of the sms messaging connector to use, defaults to not configured.
|
|
20
|
-
* @param options.templateEntryStorageConnectorType The type of the entity connector to use, defaults to "messaging-templates".
|
|
21
18
|
*/
|
|
22
|
-
constructor(options?:
|
|
23
|
-
messagingEmailConnectorType?: string;
|
|
24
|
-
messagingPushNotificationConnectorType?: string;
|
|
25
|
-
messagingSmsConnectorType?: string;
|
|
26
|
-
templateEntryStorageConnectorType?: string;
|
|
27
|
-
});
|
|
19
|
+
constructor(options?: IMessagingServiceConstructorOptions);
|
|
28
20
|
/**
|
|
29
21
|
* Send a custom email.
|
|
30
22
|
* @param sender The sender email address.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the messaging service.
|
|
3
|
+
*/
|
|
4
|
+
export interface IMessagingServiceConstructorOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The type of the email messaging connector to use, defaults to not configured.
|
|
7
|
+
*/
|
|
8
|
+
messagingEmailConnectorType?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The type of the push notifications messaging connector to use, defaults to not configured.
|
|
11
|
+
*/
|
|
12
|
+
messagingPushNotificationConnectorType?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The type of the sms messaging connector to use, defaults to not configured.
|
|
15
|
+
*/
|
|
16
|
+
messagingSmsConnectorType?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The type of the entity connector to use.
|
|
19
|
+
* @default template-entry
|
|
20
|
+
*/
|
|
21
|
+
templateEntryStorageConnectorType?: string;
|
|
22
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -16,25 +16,11 @@ Create a new instance of MessagingService.
|
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### options?
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
• **options.messagingEmailConnectorType?**: `string`
|
|
24
|
-
|
|
25
|
-
The type of the email messaging connector to use, defaults to not configured.
|
|
26
|
-
|
|
27
|
-
• **options.messagingPushNotificationConnectorType?**: `string`
|
|
28
|
-
|
|
29
|
-
The type of the push notifications messaging connector to use, defaults to not configured.
|
|
30
|
-
|
|
31
|
-
• **options.messagingSmsConnectorType?**: `string`
|
|
32
|
-
|
|
33
|
-
The type of the sms messaging connector to use, defaults to not configured.
|
|
21
|
+
[`IMessagingServiceConstructorOptions`](../interfaces/IMessagingServiceConstructorOptions.md)
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
The type of the entity connector to use, defaults to "messaging-templates".
|
|
23
|
+
The options for the connector.
|
|
38
24
|
|
|
39
25
|
#### Returns
|
|
40
26
|
|
|
@@ -70,23 +56,31 @@ Send a custom email.
|
|
|
70
56
|
|
|
71
57
|
#### Parameters
|
|
72
58
|
|
|
73
|
-
|
|
59
|
+
##### sender
|
|
60
|
+
|
|
61
|
+
`string`
|
|
74
62
|
|
|
75
63
|
The sender email address.
|
|
76
64
|
|
|
77
|
-
|
|
65
|
+
##### recipients
|
|
66
|
+
|
|
67
|
+
`string`[]
|
|
78
68
|
|
|
79
69
|
An array of recipients email addresses.
|
|
80
70
|
|
|
81
|
-
|
|
71
|
+
##### templateId
|
|
72
|
+
|
|
73
|
+
`string`
|
|
82
74
|
|
|
83
75
|
The id of the email template.
|
|
84
76
|
|
|
85
|
-
|
|
77
|
+
##### data
|
|
86
78
|
|
|
87
79
|
The data to populate the email template.
|
|
88
80
|
|
|
89
|
-
|
|
81
|
+
##### locale
|
|
82
|
+
|
|
83
|
+
`string`
|
|
90
84
|
|
|
91
85
|
The locale of the email template.
|
|
92
86
|
|
|
@@ -110,11 +104,15 @@ Registers a device to an specific app in order to send notifications to it.
|
|
|
110
104
|
|
|
111
105
|
#### Parameters
|
|
112
106
|
|
|
113
|
-
|
|
107
|
+
##### applicationId
|
|
108
|
+
|
|
109
|
+
`string`
|
|
114
110
|
|
|
115
111
|
The application address.
|
|
116
112
|
|
|
117
|
-
|
|
113
|
+
##### deviceToken
|
|
114
|
+
|
|
115
|
+
`string`
|
|
118
116
|
|
|
119
117
|
The device token.
|
|
120
118
|
|
|
@@ -138,19 +136,25 @@ Send a push notification to a device.
|
|
|
138
136
|
|
|
139
137
|
#### Parameters
|
|
140
138
|
|
|
141
|
-
|
|
139
|
+
##### deviceAddress
|
|
140
|
+
|
|
141
|
+
`string`
|
|
142
142
|
|
|
143
143
|
The address of the device.
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
##### templateId
|
|
146
|
+
|
|
147
|
+
`string`
|
|
146
148
|
|
|
147
149
|
The id of the push notification template.
|
|
148
150
|
|
|
149
|
-
|
|
151
|
+
##### data
|
|
150
152
|
|
|
151
153
|
The data to populate the push notification template.
|
|
152
154
|
|
|
153
|
-
|
|
155
|
+
##### locale
|
|
156
|
+
|
|
157
|
+
`string`
|
|
154
158
|
|
|
155
159
|
The locale of the push notification template.
|
|
156
160
|
|
|
@@ -174,19 +178,25 @@ Send a SMS message to a phone number.
|
|
|
174
178
|
|
|
175
179
|
#### Parameters
|
|
176
180
|
|
|
177
|
-
|
|
181
|
+
##### phoneNumber
|
|
182
|
+
|
|
183
|
+
`string`
|
|
178
184
|
|
|
179
185
|
The recipient phone number.
|
|
180
186
|
|
|
181
|
-
|
|
187
|
+
##### templateId
|
|
188
|
+
|
|
189
|
+
`string`
|
|
182
190
|
|
|
183
191
|
The id of the SMS template.
|
|
184
192
|
|
|
185
|
-
|
|
193
|
+
##### data
|
|
186
194
|
|
|
187
195
|
The data to populate the SMS template.
|
|
188
196
|
|
|
189
|
-
|
|
197
|
+
##### locale
|
|
198
|
+
|
|
199
|
+
`string`
|
|
190
200
|
|
|
191
201
|
The locale of the SMS template.
|
|
192
202
|
|
|
@@ -210,19 +220,27 @@ Create or update a template.
|
|
|
210
220
|
|
|
211
221
|
#### Parameters
|
|
212
222
|
|
|
213
|
-
|
|
223
|
+
##### templateId
|
|
224
|
+
|
|
225
|
+
`string`
|
|
214
226
|
|
|
215
227
|
The id of the template.
|
|
216
228
|
|
|
217
|
-
|
|
229
|
+
##### locale
|
|
230
|
+
|
|
231
|
+
`string`
|
|
218
232
|
|
|
219
233
|
The locale of the template.
|
|
220
234
|
|
|
221
|
-
|
|
235
|
+
##### title
|
|
236
|
+
|
|
237
|
+
`string`
|
|
222
238
|
|
|
223
239
|
The title of the template.
|
|
224
240
|
|
|
225
|
-
|
|
241
|
+
##### content
|
|
242
|
+
|
|
243
|
+
`string`
|
|
226
244
|
|
|
227
245
|
The content of the template.
|
|
228
246
|
|
package/docs/reference/index.md
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
- [TemplateEntry](classes/TemplateEntry.md)
|
|
6
6
|
- [MessagingService](classes/MessagingService.md)
|
|
7
7
|
|
|
8
|
+
## Interfaces
|
|
9
|
+
|
|
10
|
+
- [IMessagingServiceConstructorOptions](interfaces/IMessagingServiceConstructorOptions.md)
|
|
11
|
+
|
|
8
12
|
## Functions
|
|
9
13
|
|
|
10
14
|
- [initSchema](functions/initSchema.md)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Interface: IMessagingServiceConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the messaging service.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### messagingEmailConnectorType?
|
|
8
|
+
|
|
9
|
+
> `optional` **messagingEmailConnectorType**: `string`
|
|
10
|
+
|
|
11
|
+
The type of the email messaging connector to use, defaults to not configured.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### messagingPushNotificationConnectorType?
|
|
16
|
+
|
|
17
|
+
> `optional` **messagingPushNotificationConnectorType**: `string`
|
|
18
|
+
|
|
19
|
+
The type of the push notifications messaging connector to use, defaults to not configured.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### messagingSmsConnectorType?
|
|
24
|
+
|
|
25
|
+
> `optional` **messagingSmsConnectorType**: `string`
|
|
26
|
+
|
|
27
|
+
The type of the sms messaging connector to use, defaults to not configured.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### templateEntryStorageConnectorType?
|
|
32
|
+
|
|
33
|
+
> `optional` **templateEntryStorageConnectorType**: `string`
|
|
34
|
+
|
|
35
|
+
The type of the entity connector to use.
|
|
36
|
+
|
|
37
|
+
#### Default
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
template-entry
|
|
41
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/messaging-service",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.9",
|
|
4
4
|
"description": "Messaging service implementation",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/core": "next",
|
|
18
18
|
"@twin.org/entity": "next",
|
|
19
|
-
"@twin.org/entity-storage-models": "^0.0.1-next.
|
|
19
|
+
"@twin.org/entity-storage-models": "^0.0.1-next.9",
|
|
20
20
|
"@twin.org/logging-models": "next",
|
|
21
|
-
"@twin.org/messaging-models": "0.0.1-next.
|
|
21
|
+
"@twin.org/messaging-models": "0.0.1-next.9",
|
|
22
22
|
"@twin.org/nameof": "next"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/cjs/index.cjs",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"types": "./dist/types/index.d.ts",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
29
30
|
"require": "./dist/cjs/index.cjs",
|
|
30
|
-
"import": "./dist/esm/index.mjs"
|
|
31
|
-
"types": "./dist/types/index.d.ts"
|
|
31
|
+
"import": "./dist/esm/index.mjs"
|
|
32
32
|
},
|
|
33
33
|
"./locales": "./locales"
|
|
34
34
|
},
|