@twin.org/messaging-connector-entity-storage 0.0.1-next.2

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.
Files changed (27) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +31 -0
  3. package/dist/cjs/index.cjs +256 -0
  4. package/dist/esm/index.mjs +252 -0
  5. package/dist/types/entities/emailEntry.d.ts +38 -0
  6. package/dist/types/entities/pushNotificationDeviceEntry.d.ts +30 -0
  7. package/dist/types/entities/pushNotificationMessageEntry.d.ts +34 -0
  8. package/dist/types/entities/smsEntry.d.ts +30 -0
  9. package/dist/types/entityStorageMessagingEmailConnector.d.ts +32 -0
  10. package/dist/types/entityStorageMessagingPushNotificationConnector.d.ts +38 -0
  11. package/dist/types/entityStorageMessagingSmsConnector.d.ts +30 -0
  12. package/dist/types/index.d.ts +6 -0
  13. package/dist/types/models/IEntityStorageMessagingEmailConnectorConfig.d.ts +5 -0
  14. package/dist/types/models/IEntityStorageMessagingPushNotificationsConnectorConfig.d.ts +5 -0
  15. package/dist/types/models/IEntityStorageMessagingSmsConnectorConfig.d.ts +5 -0
  16. package/dist/types/schema.d.ts +4 -0
  17. package/docs/changelog.md +5 -0
  18. package/docs/examples.md +1 -0
  19. package/docs/reference/classes/EntityStorageMessagingEmailConnector.md +85 -0
  20. package/docs/reference/classes/EntityStorageMessagingPushNotificationConnector.md +109 -0
  21. package/docs/reference/classes/EntityStorageMessagingSmsConnector.md +77 -0
  22. package/docs/reference/index.md +13 -0
  23. package/docs/reference/type-aliases/IEntityStorageMessagingEmailConnectorConfig.md +5 -0
  24. package/docs/reference/type-aliases/IEntityStorageMessagingPushNotificationsConnectorConfig.md +5 -0
  25. package/docs/reference/type-aliases/IEntityStorageMessagingSmsConnectorConfig.md +5 -0
  26. package/locales/en.json +19 -0
  27. package/package.json +41 -0
@@ -0,0 +1,109 @@
1
+ # Class: EntityStorageMessagingPushNotificationConnector
2
+
3
+ Class for connecting to the push notifications messaging operations of the Entity Storage.
4
+
5
+ ## Implements
6
+
7
+ - `IMessagingPushNotificationsConnector`
8
+
9
+ ## Constructors
10
+
11
+ ### new EntityStorageMessagingPushNotificationConnector()
12
+
13
+ > **new EntityStorageMessagingPushNotificationConnector**(`options`?): [`EntityStorageMessagingPushNotificationConnector`](EntityStorageMessagingPushNotificationConnector.md)
14
+
15
+ Create a new instance of EntityStorageMessagingPushNotificationConnector.
16
+
17
+ #### Parameters
18
+
19
+ • **options?**
20
+
21
+ The options for the connector.
22
+
23
+ • **options.loggingConnectorType?**: `string`
24
+
25
+ The type of logging connector to use, defaults to no logging.
26
+
27
+ • **options.messagingEntryStorageConnectorType?**: `string`
28
+
29
+ The type of entity storage connector to use for the push notifications entries.
30
+
31
+ • **options.config?**: `IMessagingPushNotificationsConnector`
32
+
33
+ The configuration for the push notifications connector.
34
+
35
+ #### Returns
36
+
37
+ [`EntityStorageMessagingPushNotificationConnector`](EntityStorageMessagingPushNotificationConnector.md)
38
+
39
+ ## Properties
40
+
41
+ ### CLASS\_NAME
42
+
43
+ > `readonly` **CLASS\_NAME**: `string`
44
+
45
+ Runtime name for the class.
46
+
47
+ #### Implementation of
48
+
49
+ `IMessagingPushNotificationsConnector.CLASS_NAME`
50
+
51
+ ## Methods
52
+
53
+ ### registerDevice()
54
+
55
+ > **registerDevice**(`applicationId`, `deviceToken`): `Promise`\<`string`\>
56
+
57
+ Registers a device to an specific app in order to send notifications to it.
58
+
59
+ #### Parameters
60
+
61
+ • **applicationId**: `string`
62
+
63
+ The application address.
64
+
65
+ • **deviceToken**: `string`
66
+
67
+ The device token.
68
+
69
+ #### Returns
70
+
71
+ `Promise`\<`string`\>
72
+
73
+ If the device was registered successfully.
74
+
75
+ #### Implementation of
76
+
77
+ `IMessagingPushNotificationsConnector.registerDevice`
78
+
79
+ ***
80
+
81
+ ### sendSinglePushNotification()
82
+
83
+ > **sendSinglePushNotification**(`deviceAddress`, `title`, `message`): `Promise`\<`boolean`\>
84
+
85
+ Send a push notification to a device.
86
+
87
+ #### Parameters
88
+
89
+ • **deviceAddress**: `string`
90
+
91
+ The address of the device.
92
+
93
+ • **title**: `string`
94
+
95
+ The title of the notification.
96
+
97
+ • **message**: `string`
98
+
99
+ The message to send.
100
+
101
+ #### Returns
102
+
103
+ `Promise`\<`boolean`\>
104
+
105
+ If the notification was sent successfully.
106
+
107
+ #### Implementation of
108
+
109
+ `IMessagingPushNotificationsConnector.sendSinglePushNotification`
@@ -0,0 +1,77 @@
1
+ # Class: EntityStorageMessagingSmsConnector
2
+
3
+ Class for connecting to the SMS messaging operations of the Entity Storage.
4
+
5
+ ## Implements
6
+
7
+ - `IMessagingSmsConnector`
8
+
9
+ ## Constructors
10
+
11
+ ### new EntityStorageMessagingSmsConnector()
12
+
13
+ > **new EntityStorageMessagingSmsConnector**(`options`?): [`EntityStorageMessagingSmsConnector`](EntityStorageMessagingSmsConnector.md)
14
+
15
+ Create a new instance of EntityStorageMessagingSmsConnector.
16
+
17
+ #### Parameters
18
+
19
+ • **options?**
20
+
21
+ The options for the connector.
22
+
23
+ • **options.loggingConnectorType?**: `string`
24
+
25
+ The type of logging connector to use, defaults to no logging.
26
+
27
+ • **options.messagingEntryStorageConnectorType?**: `string`
28
+
29
+ The type of entity storage connector to use for the sms entries.
30
+
31
+ • **options.config?**: `IMessagingSmsConnector`
32
+
33
+ The configuration for the sms connector.
34
+
35
+ #### Returns
36
+
37
+ [`EntityStorageMessagingSmsConnector`](EntityStorageMessagingSmsConnector.md)
38
+
39
+ ## Properties
40
+
41
+ ### CLASS\_NAME
42
+
43
+ > `readonly` **CLASS\_NAME**: `string`
44
+
45
+ Runtime name for the class.
46
+
47
+ #### Implementation of
48
+
49
+ `IMessagingSmsConnector.CLASS_NAME`
50
+
51
+ ## Methods
52
+
53
+ ### sendSMS()
54
+
55
+ > **sendSMS**(`phoneNumber`, `message`): `Promise`\<`boolean`\>
56
+
57
+ Send a SMS message to a phone number.
58
+
59
+ #### Parameters
60
+
61
+ • **phoneNumber**: `string`
62
+
63
+ The recipient phone number.
64
+
65
+ • **message**: `string`
66
+
67
+ The message to send.
68
+
69
+ #### Returns
70
+
71
+ `Promise`\<`boolean`\>
72
+
73
+ If the SMS was sent successfully.
74
+
75
+ #### Implementation of
76
+
77
+ `IMessagingSmsConnector.sendSMS`
@@ -0,0 +1,13 @@
1
+ # @twin.org/messaging-connector-entity-storage
2
+
3
+ ## Classes
4
+
5
+ - [EntityStorageMessagingEmailConnector](classes/EntityStorageMessagingEmailConnector.md)
6
+ - [EntityStorageMessagingPushNotificationConnector](classes/EntityStorageMessagingPushNotificationConnector.md)
7
+ - [EntityStorageMessagingSmsConnector](classes/EntityStorageMessagingSmsConnector.md)
8
+
9
+ ## Type Aliases
10
+
11
+ - [IEntityStorageMessagingEmailConnectorConfig](type-aliases/IEntityStorageMessagingEmailConnectorConfig.md)
12
+ - [IEntityStorageMessagingPushNotificationsConnectorConfig](type-aliases/IEntityStorageMessagingPushNotificationsConnectorConfig.md)
13
+ - [IEntityStorageMessagingSmsConnectorConfig](type-aliases/IEntityStorageMessagingSmsConnectorConfig.md)
@@ -0,0 +1,5 @@
1
+ # Type Alias: IEntityStorageMessagingEmailConnectorConfig
2
+
3
+ > **IEntityStorageMessagingEmailConnectorConfig**: `IMessagingEmailConnector`
4
+
5
+ Configuration for the Entity Storage Messaging Email Connector.
@@ -0,0 +1,5 @@
1
+ # Type Alias: IEntityStorageMessagingPushNotificationsConnectorConfig
2
+
3
+ > **IEntityStorageMessagingPushNotificationsConnectorConfig**: `IMessagingPushNotificationsConnector`
4
+
5
+ Configuration for the Entity Storage Messaging Push Notifications Connector.
@@ -0,0 +1,5 @@
1
+ # Type Alias: IEntityStorageMessagingSmsConnectorConfig
2
+
3
+ > **IEntityStorageMessagingSmsConnectorConfig**: `IMessagingSmsConnector`
4
+
5
+ Configuration for the Entity Storage Messaging Sms Connector.
@@ -0,0 +1,19 @@
1
+ {
2
+ "info": {
3
+ "entityStorageMessagingConnector": {
4
+ "emailSending": "Sending email",
5
+ "smsSending": "Sending SMS",
6
+ "deviceRegistering": "Registering device",
7
+ "pushNotificationSending": "Sending push notification"
8
+ }
9
+ },
10
+ "error": {
11
+ "entityStorageMessagingConnector": {
12
+ "sendCustomEmailFailed": "Failed to send custom email",
13
+ "readEmailEntryFailed": "Failed to read email entry",
14
+ "sendSMSFailed": "Failed to send SMS",
15
+ "deviceTokenRegisterFailed": "Failed to register device token",
16
+ "sendPushNotificationFailed": "Failed to send push notification"
17
+ }
18
+ }
19
+ }
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@twin.org/messaging-connector-entity-storage",
3
+ "version": "0.0.1-next.2",
4
+ "description": "Messaging connector implementation using the Entity Storage",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/twinfoundation/messaging.git",
8
+ "directory": "packages/messaging-connector-entity-storage"
9
+ },
10
+ "author": "adrian.sanchez.sequeira@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=20.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@twin.org/core": "next",
18
+ "@twin.org/entity": "next",
19
+ "@twin.org/logging-models": "next",
20
+ "@twin.org/messaging-models": "0.0.1-next.2",
21
+ "@twin.org/nameof": "next"
22
+ },
23
+ "main": "./dist/cjs/index.cjs",
24
+ "module": "./dist/esm/index.mjs",
25
+ "types": "./dist/types/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "require": "./dist/cjs/index.cjs",
29
+ "import": "./dist/esm/index.mjs",
30
+ "types": "./dist/types/index.d.ts"
31
+ },
32
+ "./locales": "./locales"
33
+ },
34
+ "files": [
35
+ "dist/cjs",
36
+ "dist/esm",
37
+ "dist/types",
38
+ "locales",
39
+ "docs"
40
+ ]
41
+ }