@3sixty/messaging-models 0.0.0-stage → 0.20.0-next.1
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/LICENSE +201 -0
- package/README.md +24 -2
- package/dist/es/factories/messagingEmailConnectorFactory.js +9 -0
- package/dist/es/factories/messagingEmailConnectorFactory.js.map +1 -0
- package/dist/es/factories/messagingPushNotificationsConnectorFactory.js +9 -0
- package/dist/es/factories/messagingPushNotificationsConnectorFactory.js.map +1 -0
- package/dist/es/factories/messagingSmsConnectorFactory.js +9 -0
- package/dist/es/factories/messagingSmsConnectorFactory.js.map +1 -0
- package/dist/es/index.js +11 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IMessagingAdminComponent.js +2 -0
- package/dist/es/models/IMessagingAdminComponent.js.map +1 -0
- package/dist/es/models/IMessagingComponent.js +2 -0
- package/dist/es/models/IMessagingComponent.js.map +1 -0
- package/dist/es/models/IMessagingEmailConnector.js +2 -0
- package/dist/es/models/IMessagingEmailConnector.js.map +1 -0
- package/dist/es/models/IMessagingPushNotificationsConnector.js +2 -0
- package/dist/es/models/IMessagingPushNotificationsConnector.js.map +1 -0
- package/dist/es/models/IMessagingSmsConnector.js +2 -0
- package/dist/es/models/IMessagingSmsConnector.js.map +1 -0
- package/dist/types/factories/messagingEmailConnectorFactory.d.ts +6 -0
- package/dist/types/factories/messagingPushNotificationsConnectorFactory.d.ts +6 -0
- package/dist/types/factories/messagingSmsConnectorFactory.d.ts +6 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/models/IMessagingAdminComponent.d.ts +32 -0
- package/dist/types/models/IMessagingComponent.d.ts +47 -0
- package/dist/types/models/IMessagingEmailConnector.d.ts +15 -0
- package/dist/types/models/IMessagingPushNotificationsConnector.d.ts +21 -0
- package/dist/types/models/IMessagingSmsConnector.d.ts +13 -0
- package/docs/changelog.md +9 -0
- package/docs/examples.md +73 -0
- package/docs/reference/index.md +15 -0
- package/docs/reference/interfaces/IMessagingAdminComponent.md +103 -0
- package/docs/reference/interfaces/IMessagingComponent.md +161 -0
- package/docs/reference/interfaces/IMessagingEmailConnector.md +47 -0
- package/docs/reference/interfaces/IMessagingPushNotificationsConnector.md +69 -0
- package/docs/reference/interfaces/IMessagingSmsConnector.md +35 -0
- package/docs/reference/variables/MessagingEmailConnectorFactory.md +5 -0
- package/docs/reference/variables/MessagingPushNotificationsConnectorFactory.md +5 -0
- package/docs/reference/variables/MessagingSmsConnectorFactory.md +5 -0
- package/locales/en.json +1 -0
- package/package.json +49 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2024 IOTA Stiftung.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 3Sixty Messaging Models
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package defines the shared models and factory helpers used by messaging connectors and services.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
npm install @3sixty/messaging-models
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
Usage of the APIs is shown in the examples [docs/examples.md](docs/examples.md)
|
|
14
|
+
|
|
15
|
+
## Reference
|
|
16
|
+
|
|
17
|
+
Detailed reference documentation for the API can be found in [docs/reference/index.md](docs/reference/index.md)
|
|
18
|
+
|
|
19
|
+
## Changelog
|
|
20
|
+
|
|
21
|
+
The changes between each version can be found in [docs/changelog.md](docs/changelog.md)
|
|
22
|
+
|
|
23
|
+
## Origin
|
|
24
|
+
|
|
25
|
+
This package is derived from the original [iotaledger/twin-messaging](https://github.com/iotaledger/twin-messaging/tree/next/packages/messaging-models) repository.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { Factory } from "@3sixty/core";
|
|
4
|
+
/**
|
|
5
|
+
* Factory for creating messaging email connectors.
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
|
+
export const MessagingEmailConnectorFactory = Factory.createFactory("messaging-email");
|
|
9
|
+
//# sourceMappingURL=messagingEmailConnectorFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagingEmailConnectorFactory.js","sources":["../../../src/factories/messagingEmailConnectorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,8BAA8B,GAC1C,OAAO,CAAC,aAAa,CAA2B,iBAAiB,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@3sixty/core\";\nimport type { IMessagingEmailConnector } from \"../models/IMessagingEmailConnector.js\";\n\n/**\n * Factory for creating messaging email connectors.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const MessagingEmailConnectorFactory =\n\tFactory.createFactory<IMessagingEmailConnector>(\"messaging-email\");\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { Factory } from "@3sixty/core";
|
|
4
|
+
/**
|
|
5
|
+
* Factory for creating messaging push notification connectors.
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
|
+
export const MessagingPushNotificationsConnectorFactory = Factory.createFactory("messaging-push-notifications");
|
|
9
|
+
//# sourceMappingURL=messagingPushNotificationsConnectorFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagingPushNotificationsConnectorFactory.js","sources":["../../../src/factories/messagingPushNotificationsConnectorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,0CAA0C,GACtD,OAAO,CAAC,aAAa,CAAuC,8BAA8B,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@3sixty/core\";\nimport type { IMessagingPushNotificationsConnector } from \"../models/IMessagingPushNotificationsConnector.js\";\n\n/**\n * Factory for creating messaging push notification connectors.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const MessagingPushNotificationsConnectorFactory =\n\tFactory.createFactory<IMessagingPushNotificationsConnector>(\"messaging-push-notifications\");\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { Factory } from "@3sixty/core";
|
|
4
|
+
/**
|
|
5
|
+
* Factory for creating messaging sms connectors.
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
|
+
export const MessagingSmsConnectorFactory = Factory.createFactory("messaging-sms");
|
|
9
|
+
//# sourceMappingURL=messagingSmsConnectorFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagingSmsConnectorFactory.js","sources":["../../../src/factories/messagingSmsConnectorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,4BAA4B,GACxC,OAAO,CAAC,aAAa,CAAyB,eAAe,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@3sixty/core\";\nimport type { IMessagingSmsConnector } from \"../models/IMessagingSmsConnector.js\";\n\n/**\n * Factory for creating messaging sms connectors.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const MessagingSmsConnectorFactory =\n\tFactory.createFactory<IMessagingSmsConnector>(\"messaging-sms\");\n"]}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
export * from "./factories/messagingEmailConnectorFactory.js";
|
|
4
|
+
export * from "./factories/messagingPushNotificationsConnectorFactory.js";
|
|
5
|
+
export * from "./factories/messagingSmsConnectorFactory.js";
|
|
6
|
+
export * from "./models/IMessagingAdminComponent.js";
|
|
7
|
+
export * from "./models/IMessagingComponent.js";
|
|
8
|
+
export * from "./models/IMessagingEmailConnector.js";
|
|
9
|
+
export * from "./models/IMessagingPushNotificationsConnector.js";
|
|
10
|
+
export * from "./models/IMessagingSmsConnector.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2DAA2D,CAAC;AAC1E,cAAc,6CAA6C,CAAC;AAC5D,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,oCAAoC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./factories/messagingEmailConnectorFactory.js\";\nexport * from \"./factories/messagingPushNotificationsConnectorFactory.js\";\nexport * from \"./factories/messagingSmsConnectorFactory.js\";\nexport * from \"./models/IMessagingAdminComponent.js\";\nexport * from \"./models/IMessagingComponent.js\";\nexport * from \"./models/IMessagingEmailConnector.js\";\nexport * from \"./models/IMessagingPushNotificationsConnector.js\";\nexport * from \"./models/IMessagingSmsConnector.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMessagingAdminComponent.js","sources":["../../../src/models/IMessagingAdminComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@3sixty/core\";\n\n/**\n * Interface describing the messaging admin component.\n */\nexport interface IMessagingAdminComponent extends IComponent {\n\t/**\n\t * Create or update a template.\n\t * @param templateId The id of the template.\n\t * @param locale The locale of the template.\n\t * @param title The title of the template.\n\t * @param content The content of the template.\n\t * @returns A promise that resolves when the template has been stored.\n\t */\n\tsetTemplate(templateId: string, locale: string, title: string, content: string): Promise<void>;\n\n\t/**\n\t * Get the email template by id and locale.\n\t * @param templateId The id of the email template.\n\t * @param locale The locale of the email template.\n\t * @returns The email template.\n\t */\n\tgetTemplate(templateId: string, locale: string): Promise<{ title: string; content: string }>;\n\n\t/**\n\t * Remove a template.\n\t * @param templateId The id of the template.\n\t * @param locale The locale of the template.\n\t * @returns A promise that resolves when the template has been removed.\n\t */\n\tremoveTemplate(templateId: string, locale: string): Promise<void>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMessagingComponent.js","sources":["../../../src/models/IMessagingComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@3sixty/core\";\n\n/**\n * Interface describing the messaging component.\n */\nexport interface IMessagingComponent extends IComponent {\n\t/**\n\t * Send a custom email.\n\t * @param sender The sender email address.\n\t * @param recipients An array of recipients email addresses.\n\t * @param templateId The id of the email template.\n\t * @param data The data to populate the email template.\n\t * @param locale The locale of the email template.\n\t * @returns True if the email was sent successfully.\n\t */\n\tsendCustomEmail(\n\t\tsender: string,\n\t\trecipients: string[],\n\t\ttemplateId: string,\n\t\tdata: { [key: string]: string },\n\t\tlocale: string\n\t): Promise<boolean>;\n\n\t/**\n\t * Registers a device to a specific application in order to send notifications to it.\n\t * @param applicationAddress The application address.\n\t * @param deviceToken The device token.\n\t * @returns The address assigned to the registered device.\n\t */\n\tregisterDevice(applicationAddress: string, deviceToken: string): Promise<string>;\n\n\t/**\n\t * Send a push notification to a device.\n\t * @param deviceAddress The address of the device.\n\t * @param templateId The id of the push notification template.\n\t * @param data The data to populate the push notification template.\n\t * @param locale The locale of the push notification template.\n\t * @returns True if the notification was sent successfully.\n\t */\n\tsendSinglePushNotification(\n\t\tdeviceAddress: string,\n\t\ttemplateId: string,\n\t\tdata: { [key: string]: string },\n\t\tlocale: string\n\t): Promise<boolean>;\n\n\t/**\n\t * Send a SMS message to a phone number.\n\t * @param phoneNumber The recipient phone number.\n\t * @param templateId The id of the SMS template.\n\t * @param data The data to populate the SMS template.\n\t * @param locale The locale of the SMS template.\n\t * @returns True if the SMS was sent successfully.\n\t */\n\tsendSMS(\n\t\tphoneNumber: string,\n\t\ttemplateId: string,\n\t\tdata: { [key: string]: string },\n\t\tlocale: string\n\t): Promise<boolean>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMessagingEmailConnector.js","sources":["../../../src/models/IMessagingEmailConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@3sixty/core\";\n\n/**\n * Interface describing the email messaging connector functionalities.\n */\nexport interface IMessagingEmailConnector extends IComponent {\n\t/**\n\t * Send a custom email.\n\t * @param sender The sender email address.\n\t * @param recipients An array of recipients email addresses.\n\t * @param subject The subject of the email.\n\t * @param content The html content of the email.\n\t * @returns True if the email was sent successfully.\n\t */\n\tsendCustomEmail(\n\t\tsender: string,\n\t\trecipients: string[],\n\t\tsubject: string,\n\t\tcontent: string\n\t): Promise<boolean>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMessagingPushNotificationsConnector.js","sources":["../../../src/models/IMessagingPushNotificationsConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@3sixty/core\";\n\n/**\n * Interface describing the push notifications messaging connector functionalities.\n */\nexport interface IMessagingPushNotificationsConnector extends IComponent {\n\t/**\n\t * Registers a device to a specific application in order to send notifications to it.\n\t * @param applicationAddress The application address.\n\t * @param deviceToken The device token.\n\t * @returns The address assigned to the registered device.\n\t */\n\tregisterDevice(applicationAddress: string, deviceToken: string): Promise<string>;\n\n\t/**\n\t * Send a push notification to a device.\n\t * @param deviceAddress The address of the device.\n\t * @param title The title of the notification.\n\t * @param message The message to send.\n\t * @returns True if the notification was sent successfully.\n\t */\n\tsendSinglePushNotification(\n\t\tdeviceAddress: string,\n\t\ttitle: string,\n\t\tmessage: string\n\t): Promise<boolean>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMessagingSmsConnector.js","sources":["../../../src/models/IMessagingSmsConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@3sixty/core\";\n\n/**\n * Interface describing the SMS messaging connector functionalities.\n */\nexport interface IMessagingSmsConnector extends IComponent {\n\t/**\n\t * Send a SMS message to a phone number.\n\t * @param phoneNumber The recipient phone number.\n\t * @param message The message to send.\n\t * @returns True if the SMS was sent successfully.\n\t */\n\tsendSMS(phoneNumber: string, message: string): Promise<boolean>;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Factory } from "@3sixty/core";
|
|
2
|
+
import type { IMessagingEmailConnector } from "../models/IMessagingEmailConnector.js";
|
|
3
|
+
/**
|
|
4
|
+
* Factory for creating messaging email connectors.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MessagingEmailConnectorFactory: Factory<IMessagingEmailConnector>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Factory } from "@3sixty/core";
|
|
2
|
+
import type { IMessagingPushNotificationsConnector } from "../models/IMessagingPushNotificationsConnector.js";
|
|
3
|
+
/**
|
|
4
|
+
* Factory for creating messaging push notification connectors.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MessagingPushNotificationsConnectorFactory: Factory<IMessagingPushNotificationsConnector>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Factory } from "@3sixty/core";
|
|
2
|
+
import type { IMessagingSmsConnector } from "../models/IMessagingSmsConnector.js";
|
|
3
|
+
/**
|
|
4
|
+
* Factory for creating messaging sms connectors.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MessagingSmsConnectorFactory: Factory<IMessagingSmsConnector>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./factories/messagingEmailConnectorFactory.js";
|
|
2
|
+
export * from "./factories/messagingPushNotificationsConnectorFactory.js";
|
|
3
|
+
export * from "./factories/messagingSmsConnectorFactory.js";
|
|
4
|
+
export * from "./models/IMessagingAdminComponent.js";
|
|
5
|
+
export * from "./models/IMessagingComponent.js";
|
|
6
|
+
export * from "./models/IMessagingEmailConnector.js";
|
|
7
|
+
export * from "./models/IMessagingPushNotificationsConnector.js";
|
|
8
|
+
export * from "./models/IMessagingSmsConnector.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IComponent } from "@3sixty/core";
|
|
2
|
+
/**
|
|
3
|
+
* Interface describing the messaging admin component.
|
|
4
|
+
*/
|
|
5
|
+
export interface IMessagingAdminComponent extends IComponent {
|
|
6
|
+
/**
|
|
7
|
+
* Create or update a template.
|
|
8
|
+
* @param templateId The id of the template.
|
|
9
|
+
* @param locale The locale of the template.
|
|
10
|
+
* @param title The title of the template.
|
|
11
|
+
* @param content The content of the template.
|
|
12
|
+
* @returns A promise that resolves when the template has been stored.
|
|
13
|
+
*/
|
|
14
|
+
setTemplate(templateId: string, locale: string, title: string, content: string): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Get the email template by id and locale.
|
|
17
|
+
* @param templateId The id of the email template.
|
|
18
|
+
* @param locale The locale of the email template.
|
|
19
|
+
* @returns The email template.
|
|
20
|
+
*/
|
|
21
|
+
getTemplate(templateId: string, locale: string): Promise<{
|
|
22
|
+
title: string;
|
|
23
|
+
content: string;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Remove a template.
|
|
27
|
+
* @param templateId The id of the template.
|
|
28
|
+
* @param locale The locale of the template.
|
|
29
|
+
* @returns A promise that resolves when the template has been removed.
|
|
30
|
+
*/
|
|
31
|
+
removeTemplate(templateId: string, locale: string): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IComponent } from "@3sixty/core";
|
|
2
|
+
/**
|
|
3
|
+
* Interface describing the messaging component.
|
|
4
|
+
*/
|
|
5
|
+
export interface IMessagingComponent extends IComponent {
|
|
6
|
+
/**
|
|
7
|
+
* Send a custom email.
|
|
8
|
+
* @param sender The sender email address.
|
|
9
|
+
* @param recipients An array of recipients email addresses.
|
|
10
|
+
* @param templateId The id of the email template.
|
|
11
|
+
* @param data The data to populate the email template.
|
|
12
|
+
* @param locale The locale of the email template.
|
|
13
|
+
* @returns True if the email was sent successfully.
|
|
14
|
+
*/
|
|
15
|
+
sendCustomEmail(sender: string, recipients: string[], templateId: string, data: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
}, locale: string): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Registers a device to a specific application in order to send notifications to it.
|
|
20
|
+
* @param applicationAddress The application address.
|
|
21
|
+
* @param deviceToken The device token.
|
|
22
|
+
* @returns The address assigned to the registered device.
|
|
23
|
+
*/
|
|
24
|
+
registerDevice(applicationAddress: string, deviceToken: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Send a push notification to a device.
|
|
27
|
+
* @param deviceAddress The address of the device.
|
|
28
|
+
* @param templateId The id of the push notification template.
|
|
29
|
+
* @param data The data to populate the push notification template.
|
|
30
|
+
* @param locale The locale of the push notification template.
|
|
31
|
+
* @returns True if the notification was sent successfully.
|
|
32
|
+
*/
|
|
33
|
+
sendSinglePushNotification(deviceAddress: string, templateId: string, data: {
|
|
34
|
+
[key: string]: string;
|
|
35
|
+
}, locale: string): Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Send a SMS message to a phone number.
|
|
38
|
+
* @param phoneNumber The recipient phone number.
|
|
39
|
+
* @param templateId The id of the SMS template.
|
|
40
|
+
* @param data The data to populate the SMS template.
|
|
41
|
+
* @param locale The locale of the SMS template.
|
|
42
|
+
* @returns True if the SMS was sent successfully.
|
|
43
|
+
*/
|
|
44
|
+
sendSMS(phoneNumber: string, templateId: string, data: {
|
|
45
|
+
[key: string]: string;
|
|
46
|
+
}, locale: string): Promise<boolean>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IComponent } from "@3sixty/core";
|
|
2
|
+
/**
|
|
3
|
+
* Interface describing the email messaging connector functionalities.
|
|
4
|
+
*/
|
|
5
|
+
export interface IMessagingEmailConnector extends IComponent {
|
|
6
|
+
/**
|
|
7
|
+
* Send a custom email.
|
|
8
|
+
* @param sender The sender email address.
|
|
9
|
+
* @param recipients An array of recipients email addresses.
|
|
10
|
+
* @param subject The subject of the email.
|
|
11
|
+
* @param content The html content of the email.
|
|
12
|
+
* @returns True if the email was sent successfully.
|
|
13
|
+
*/
|
|
14
|
+
sendCustomEmail(sender: string, recipients: string[], subject: string, content: string): Promise<boolean>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IComponent } from "@3sixty/core";
|
|
2
|
+
/**
|
|
3
|
+
* Interface describing the push notifications messaging connector functionalities.
|
|
4
|
+
*/
|
|
5
|
+
export interface IMessagingPushNotificationsConnector extends IComponent {
|
|
6
|
+
/**
|
|
7
|
+
* Registers a device to a specific application in order to send notifications to it.
|
|
8
|
+
* @param applicationAddress The application address.
|
|
9
|
+
* @param deviceToken The device token.
|
|
10
|
+
* @returns The address assigned to the registered device.
|
|
11
|
+
*/
|
|
12
|
+
registerDevice(applicationAddress: string, deviceToken: string): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Send a push notification to a device.
|
|
15
|
+
* @param deviceAddress The address of the device.
|
|
16
|
+
* @param title The title of the notification.
|
|
17
|
+
* @param message The message to send.
|
|
18
|
+
* @returns True if the notification was sent successfully.
|
|
19
|
+
*/
|
|
20
|
+
sendSinglePushNotification(deviceAddress: string, title: string, message: string): Promise<boolean>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IComponent } from "@3sixty/core";
|
|
2
|
+
/**
|
|
3
|
+
* Interface describing the SMS messaging connector functionalities.
|
|
4
|
+
*/
|
|
5
|
+
export interface IMessagingSmsConnector extends IComponent {
|
|
6
|
+
/**
|
|
7
|
+
* Send a SMS message to a phone number.
|
|
8
|
+
* @param phoneNumber The recipient phone number.
|
|
9
|
+
* @param message The message to send.
|
|
10
|
+
* @returns True if the SMS was sent successfully.
|
|
11
|
+
*/
|
|
12
|
+
sendSMS(phoneNumber: string, message: string): Promise<boolean>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.20.0-next.1](https://github.com/3sixtyglobal/messaging/compare/messaging-models-v0.20.0-next.0...messaging-models-v0.20.0-next.1) (2026-10-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* publish packages under the [@3sixty](https://github.com/3sixty) namespace ([8fd187c](https://github.com/3sixtyglobal/messaging/commit/8fd187cab6f54f164628d1d2a0129d4b7a1ba87d))
|
|
9
|
+
* updated ts compile ([293701e](https://github.com/3sixtyglobal/messaging/commit/293701e2acc20bb6bbcf2e2ff1a0d03f0b9a7a76))
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Messaging Models Examples
|
|
2
|
+
|
|
3
|
+
Use these examples to register connector implementations and resolve them through the shared factories.
|
|
4
|
+
|
|
5
|
+
## MessagingPushNotificationsConnectorFactory
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import {
|
|
9
|
+
MessagingPushNotificationsConnectorFactory,
|
|
10
|
+
type IMessagingPushNotificationsConnector
|
|
11
|
+
} from '@3sixty/messaging-models';
|
|
12
|
+
|
|
13
|
+
MessagingPushNotificationsConnectorFactory.register(
|
|
14
|
+
'in-memory-push',
|
|
15
|
+
() =>
|
|
16
|
+
({
|
|
17
|
+
registerDevice: async (applicationId: string, deviceToken: string) =>
|
|
18
|
+
`${applicationId}:${deviceToken}`,
|
|
19
|
+
sendSinglePushNotification: async () => true
|
|
20
|
+
}) as IMessagingPushNotificationsConnector
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const pushConnector = MessagingPushNotificationsConnectorFactory.get('in-memory-push');
|
|
24
|
+
const deviceAddress = await pushConnector.registerDevice('orders-app', 'token-001');
|
|
25
|
+
console.log(deviceAddress); // orders-app:token-001
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## MessagingEmailConnectorFactory
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import {
|
|
32
|
+
MessagingEmailConnectorFactory,
|
|
33
|
+
type IMessagingEmailConnector
|
|
34
|
+
} from '@3sixty/messaging-models';
|
|
35
|
+
|
|
36
|
+
MessagingEmailConnectorFactory.register(
|
|
37
|
+
'in-memory-email',
|
|
38
|
+
() =>
|
|
39
|
+
({
|
|
40
|
+
sendCustomEmail: async () => true
|
|
41
|
+
}) as IMessagingEmailConnector
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const emailConnector = MessagingEmailConnectorFactory.get('in-memory-email');
|
|
45
|
+
const emailQueued = await emailConnector.sendCustomEmail(
|
|
46
|
+
'service@example.org',
|
|
47
|
+
['recipient@example.org'],
|
|
48
|
+
'Welcome',
|
|
49
|
+
'<p>Thanks for signing up.</p>'
|
|
50
|
+
);
|
|
51
|
+
console.log(emailQueued); // true
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## MessagingSmsConnectorFactory
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import {
|
|
58
|
+
MessagingSmsConnectorFactory,
|
|
59
|
+
type IMessagingSmsConnector
|
|
60
|
+
} from '@3sixty/messaging-models';
|
|
61
|
+
|
|
62
|
+
MessagingSmsConnectorFactory.register(
|
|
63
|
+
'in-memory-sms',
|
|
64
|
+
() =>
|
|
65
|
+
({
|
|
66
|
+
sendSMS: async () => true
|
|
67
|
+
}) as IMessagingSmsConnector
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const smsConnector = MessagingSmsConnectorFactory.get('in-memory-sms');
|
|
71
|
+
const smsQueued = await smsConnector.sendSMS('+441234567890', 'Your one-time code is 482931');
|
|
72
|
+
console.log(smsQueued); // true
|
|
73
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @3sixty/messaging-models
|
|
2
|
+
|
|
3
|
+
## Interfaces
|
|
4
|
+
|
|
5
|
+
- [IMessagingAdminComponent](interfaces/IMessagingAdminComponent.md)
|
|
6
|
+
- [IMessagingComponent](interfaces/IMessagingComponent.md)
|
|
7
|
+
- [IMessagingEmailConnector](interfaces/IMessagingEmailConnector.md)
|
|
8
|
+
- [IMessagingPushNotificationsConnector](interfaces/IMessagingPushNotificationsConnector.md)
|
|
9
|
+
- [IMessagingSmsConnector](interfaces/IMessagingSmsConnector.md)
|
|
10
|
+
|
|
11
|
+
## Variables
|
|
12
|
+
|
|
13
|
+
- [MessagingEmailConnectorFactory](variables/MessagingEmailConnectorFactory.md)
|
|
14
|
+
- [MessagingPushNotificationsConnectorFactory](variables/MessagingPushNotificationsConnectorFactory.md)
|
|
15
|
+
- [MessagingSmsConnectorFactory](variables/MessagingSmsConnectorFactory.md)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Interface: IMessagingAdminComponent
|
|
2
|
+
|
|
3
|
+
Interface describing the messaging admin component.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### setTemplate() {#settemplate}
|
|
12
|
+
|
|
13
|
+
> **setTemplate**(`templateId`, `locale`, `title`, `content`): `Promise`\<`void`\>
|
|
14
|
+
|
|
15
|
+
Create or update a template.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### templateId
|
|
20
|
+
|
|
21
|
+
`string`
|
|
22
|
+
|
|
23
|
+
The id of the template.
|
|
24
|
+
|
|
25
|
+
##### locale
|
|
26
|
+
|
|
27
|
+
`string`
|
|
28
|
+
|
|
29
|
+
The locale of the template.
|
|
30
|
+
|
|
31
|
+
##### title
|
|
32
|
+
|
|
33
|
+
`string`
|
|
34
|
+
|
|
35
|
+
The title of the template.
|
|
36
|
+
|
|
37
|
+
##### content
|
|
38
|
+
|
|
39
|
+
`string`
|
|
40
|
+
|
|
41
|
+
The content of the template.
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
`Promise`\<`void`\>
|
|
46
|
+
|
|
47
|
+
A promise that resolves when the template has been stored.
|
|
48
|
+
|
|
49
|
+
***
|
|
50
|
+
|
|
51
|
+
### getTemplate() {#gettemplate}
|
|
52
|
+
|
|
53
|
+
> **getTemplate**(`templateId`, `locale`): `Promise`\<\{ `title`: `string`; `content`: `string`; \}\>
|
|
54
|
+
|
|
55
|
+
Get the email template by id and locale.
|
|
56
|
+
|
|
57
|
+
#### Parameters
|
|
58
|
+
|
|
59
|
+
##### templateId
|
|
60
|
+
|
|
61
|
+
`string`
|
|
62
|
+
|
|
63
|
+
The id of the email template.
|
|
64
|
+
|
|
65
|
+
##### locale
|
|
66
|
+
|
|
67
|
+
`string`
|
|
68
|
+
|
|
69
|
+
The locale of the email template.
|
|
70
|
+
|
|
71
|
+
#### Returns
|
|
72
|
+
|
|
73
|
+
`Promise`\<\{ `title`: `string`; `content`: `string`; \}\>
|
|
74
|
+
|
|
75
|
+
The email template.
|
|
76
|
+
|
|
77
|
+
***
|
|
78
|
+
|
|
79
|
+
### removeTemplate() {#removetemplate}
|
|
80
|
+
|
|
81
|
+
> **removeTemplate**(`templateId`, `locale`): `Promise`\<`void`\>
|
|
82
|
+
|
|
83
|
+
Remove a template.
|
|
84
|
+
|
|
85
|
+
#### Parameters
|
|
86
|
+
|
|
87
|
+
##### templateId
|
|
88
|
+
|
|
89
|
+
`string`
|
|
90
|
+
|
|
91
|
+
The id of the template.
|
|
92
|
+
|
|
93
|
+
##### locale
|
|
94
|
+
|
|
95
|
+
`string`
|
|
96
|
+
|
|
97
|
+
The locale of the template.
|
|
98
|
+
|
|
99
|
+
#### Returns
|
|
100
|
+
|
|
101
|
+
`Promise`\<`void`\>
|
|
102
|
+
|
|
103
|
+
A promise that resolves when the template has been removed.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Interface: IMessagingComponent
|
|
2
|
+
|
|
3
|
+
Interface describing the messaging component.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### sendCustomEmail() {#sendcustomemail}
|
|
12
|
+
|
|
13
|
+
> **sendCustomEmail**(`sender`, `recipients`, `templateId`, `data`, `locale`): `Promise`\<`boolean`\>
|
|
14
|
+
|
|
15
|
+
Send a custom email.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### sender
|
|
20
|
+
|
|
21
|
+
`string`
|
|
22
|
+
|
|
23
|
+
The sender email address.
|
|
24
|
+
|
|
25
|
+
##### recipients
|
|
26
|
+
|
|
27
|
+
`string`[]
|
|
28
|
+
|
|
29
|
+
An array of recipients email addresses.
|
|
30
|
+
|
|
31
|
+
##### templateId
|
|
32
|
+
|
|
33
|
+
`string`
|
|
34
|
+
|
|
35
|
+
The id of the email template.
|
|
36
|
+
|
|
37
|
+
##### data
|
|
38
|
+
|
|
39
|
+
\{\[`key`: `string`\]: `string`; \}
|
|
40
|
+
|
|
41
|
+
The data to populate the email template.
|
|
42
|
+
|
|
43
|
+
##### locale
|
|
44
|
+
|
|
45
|
+
`string`
|
|
46
|
+
|
|
47
|
+
The locale of the email template.
|
|
48
|
+
|
|
49
|
+
#### Returns
|
|
50
|
+
|
|
51
|
+
`Promise`\<`boolean`\>
|
|
52
|
+
|
|
53
|
+
True if the email was sent successfully.
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### registerDevice() {#registerdevice}
|
|
58
|
+
|
|
59
|
+
> **registerDevice**(`applicationAddress`, `deviceToken`): `Promise`\<`string`\>
|
|
60
|
+
|
|
61
|
+
Registers a device to a specific application in order to send notifications to it.
|
|
62
|
+
|
|
63
|
+
#### Parameters
|
|
64
|
+
|
|
65
|
+
##### applicationAddress
|
|
66
|
+
|
|
67
|
+
`string`
|
|
68
|
+
|
|
69
|
+
The application address.
|
|
70
|
+
|
|
71
|
+
##### deviceToken
|
|
72
|
+
|
|
73
|
+
`string`
|
|
74
|
+
|
|
75
|
+
The device token.
|
|
76
|
+
|
|
77
|
+
#### Returns
|
|
78
|
+
|
|
79
|
+
`Promise`\<`string`\>
|
|
80
|
+
|
|
81
|
+
The address assigned to the registered device.
|
|
82
|
+
|
|
83
|
+
***
|
|
84
|
+
|
|
85
|
+
### sendSinglePushNotification() {#sendsinglepushnotification}
|
|
86
|
+
|
|
87
|
+
> **sendSinglePushNotification**(`deviceAddress`, `templateId`, `data`, `locale`): `Promise`\<`boolean`\>
|
|
88
|
+
|
|
89
|
+
Send a push notification to a device.
|
|
90
|
+
|
|
91
|
+
#### Parameters
|
|
92
|
+
|
|
93
|
+
##### deviceAddress
|
|
94
|
+
|
|
95
|
+
`string`
|
|
96
|
+
|
|
97
|
+
The address of the device.
|
|
98
|
+
|
|
99
|
+
##### templateId
|
|
100
|
+
|
|
101
|
+
`string`
|
|
102
|
+
|
|
103
|
+
The id of the push notification template.
|
|
104
|
+
|
|
105
|
+
##### data
|
|
106
|
+
|
|
107
|
+
\{\[`key`: `string`\]: `string`; \}
|
|
108
|
+
|
|
109
|
+
The data to populate the push notification template.
|
|
110
|
+
|
|
111
|
+
##### locale
|
|
112
|
+
|
|
113
|
+
`string`
|
|
114
|
+
|
|
115
|
+
The locale of the push notification template.
|
|
116
|
+
|
|
117
|
+
#### Returns
|
|
118
|
+
|
|
119
|
+
`Promise`\<`boolean`\>
|
|
120
|
+
|
|
121
|
+
True if the notification was sent successfully.
|
|
122
|
+
|
|
123
|
+
***
|
|
124
|
+
|
|
125
|
+
### sendSMS() {#sendsms}
|
|
126
|
+
|
|
127
|
+
> **sendSMS**(`phoneNumber`, `templateId`, `data`, `locale`): `Promise`\<`boolean`\>
|
|
128
|
+
|
|
129
|
+
Send a SMS message to a phone number.
|
|
130
|
+
|
|
131
|
+
#### Parameters
|
|
132
|
+
|
|
133
|
+
##### phoneNumber
|
|
134
|
+
|
|
135
|
+
`string`
|
|
136
|
+
|
|
137
|
+
The recipient phone number.
|
|
138
|
+
|
|
139
|
+
##### templateId
|
|
140
|
+
|
|
141
|
+
`string`
|
|
142
|
+
|
|
143
|
+
The id of the SMS template.
|
|
144
|
+
|
|
145
|
+
##### data
|
|
146
|
+
|
|
147
|
+
\{\[`key`: `string`\]: `string`; \}
|
|
148
|
+
|
|
149
|
+
The data to populate the SMS template.
|
|
150
|
+
|
|
151
|
+
##### locale
|
|
152
|
+
|
|
153
|
+
`string`
|
|
154
|
+
|
|
155
|
+
The locale of the SMS template.
|
|
156
|
+
|
|
157
|
+
#### Returns
|
|
158
|
+
|
|
159
|
+
`Promise`\<`boolean`\>
|
|
160
|
+
|
|
161
|
+
True if the SMS was sent successfully.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Interface: IMessagingEmailConnector
|
|
2
|
+
|
|
3
|
+
Interface describing the email messaging connector functionalities.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### sendCustomEmail() {#sendcustomemail}
|
|
12
|
+
|
|
13
|
+
> **sendCustomEmail**(`sender`, `recipients`, `subject`, `content`): `Promise`\<`boolean`\>
|
|
14
|
+
|
|
15
|
+
Send a custom email.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### sender
|
|
20
|
+
|
|
21
|
+
`string`
|
|
22
|
+
|
|
23
|
+
The sender email address.
|
|
24
|
+
|
|
25
|
+
##### recipients
|
|
26
|
+
|
|
27
|
+
`string`[]
|
|
28
|
+
|
|
29
|
+
An array of recipients email addresses.
|
|
30
|
+
|
|
31
|
+
##### subject
|
|
32
|
+
|
|
33
|
+
`string`
|
|
34
|
+
|
|
35
|
+
The subject of the email.
|
|
36
|
+
|
|
37
|
+
##### content
|
|
38
|
+
|
|
39
|
+
`string`
|
|
40
|
+
|
|
41
|
+
The html content of the email.
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
`Promise`\<`boolean`\>
|
|
46
|
+
|
|
47
|
+
True if the email was sent successfully.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Interface: IMessagingPushNotificationsConnector
|
|
2
|
+
|
|
3
|
+
Interface describing the push notifications messaging connector functionalities.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### registerDevice() {#registerdevice}
|
|
12
|
+
|
|
13
|
+
> **registerDevice**(`applicationAddress`, `deviceToken`): `Promise`\<`string`\>
|
|
14
|
+
|
|
15
|
+
Registers a device to a specific application in order to send notifications to it.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### applicationAddress
|
|
20
|
+
|
|
21
|
+
`string`
|
|
22
|
+
|
|
23
|
+
The application address.
|
|
24
|
+
|
|
25
|
+
##### deviceToken
|
|
26
|
+
|
|
27
|
+
`string`
|
|
28
|
+
|
|
29
|
+
The device token.
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`Promise`\<`string`\>
|
|
34
|
+
|
|
35
|
+
The address assigned to the registered device.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### sendSinglePushNotification() {#sendsinglepushnotification}
|
|
40
|
+
|
|
41
|
+
> **sendSinglePushNotification**(`deviceAddress`, `title`, `message`): `Promise`\<`boolean`\>
|
|
42
|
+
|
|
43
|
+
Send a push notification to a device.
|
|
44
|
+
|
|
45
|
+
#### Parameters
|
|
46
|
+
|
|
47
|
+
##### deviceAddress
|
|
48
|
+
|
|
49
|
+
`string`
|
|
50
|
+
|
|
51
|
+
The address of the device.
|
|
52
|
+
|
|
53
|
+
##### title
|
|
54
|
+
|
|
55
|
+
`string`
|
|
56
|
+
|
|
57
|
+
The title of the notification.
|
|
58
|
+
|
|
59
|
+
##### message
|
|
60
|
+
|
|
61
|
+
`string`
|
|
62
|
+
|
|
63
|
+
The message to send.
|
|
64
|
+
|
|
65
|
+
#### Returns
|
|
66
|
+
|
|
67
|
+
`Promise`\<`boolean`\>
|
|
68
|
+
|
|
69
|
+
True if the notification was sent successfully.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Interface: IMessagingSmsConnector
|
|
2
|
+
|
|
3
|
+
Interface describing the SMS messaging connector functionalities.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### sendSMS() {#sendsms}
|
|
12
|
+
|
|
13
|
+
> **sendSMS**(`phoneNumber`, `message`): `Promise`\<`boolean`\>
|
|
14
|
+
|
|
15
|
+
Send a SMS message to a phone number.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### phoneNumber
|
|
20
|
+
|
|
21
|
+
`string`
|
|
22
|
+
|
|
23
|
+
The recipient phone number.
|
|
24
|
+
|
|
25
|
+
##### message
|
|
26
|
+
|
|
27
|
+
`string`
|
|
28
|
+
|
|
29
|
+
The message to send.
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`Promise`\<`boolean`\>
|
|
34
|
+
|
|
35
|
+
True if the SMS was sent successfully.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Variable: MessagingPushNotificationsConnectorFactory
|
|
2
|
+
|
|
3
|
+
> `const` **MessagingPushNotificationsConnectorFactory**: `Factory`\<[`IMessagingPushNotificationsConnector`](../interfaces/IMessagingPushNotificationsConnector.md)\>
|
|
4
|
+
|
|
5
|
+
Factory for creating messaging push notification connectors.
|
package/locales/en.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@3sixty/messaging-models",
|
|
3
|
+
"version": "0.20.0-next.1",
|
|
4
|
+
"description": "Defines the shared models and factory helpers used by messaging connectors and services.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/3sixtyglobal/messaging.git",
|
|
8
|
+
"directory": "packages/messaging-models"
|
|
9
|
+
},
|
|
10
|
+
"author": "adrian.sanchez.sequeira@iota.org",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=24.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@3sixty/core": "next",
|
|
18
|
+
"@3sixty/nameof": "next"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/es/index.js",
|
|
21
|
+
"types": "./dist/types/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/types/index.d.ts",
|
|
25
|
+
"import": "./dist/es/index.js",
|
|
26
|
+
"default": "./dist/es/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist/es",
|
|
31
|
+
"dist/types",
|
|
32
|
+
"locales",
|
|
33
|
+
"docs"
|
|
34
|
+
],
|
|
35
|
+
"keywords": [
|
|
36
|
+
"twin",
|
|
37
|
+
"trade",
|
|
38
|
+
"iota",
|
|
39
|
+
"framework",
|
|
40
|
+
"blockchain",
|
|
41
|
+
"messaging",
|
|
42
|
+
"models",
|
|
43
|
+
"types",
|
|
44
|
+
"schemas"
|
|
45
|
+
],
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "git+https://github.com/3sixtyglobal/messaging/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://3sixty.global"
|
|
50
|
+
}
|