@twin.org/messaging-connector-entity-storage 0.0.3-next.2 → 0.0.3-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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TWIN Messaging Connector Entity Storage
2
2
 
3
- Messaging connector implementation using the Entity Storage.
3
+ This package provides connectors that persist and manage messaging operations using entity storage.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,16 +8,6 @@ Messaging connector implementation using the Entity Storage.
8
8
  npm install @twin.org/messaging-connector-entity-storage
9
9
  ```
10
10
 
11
- ## Testing
12
-
13
- The tests developed are functional tests.
14
-
15
- You can run the tests as follows:
16
-
17
- ```sh
18
- npm run test
19
- ```
20
-
21
11
  ## Examples
22
12
 
23
13
  Usage of the APIs is shown in the examples [docs/examples.md](docs/examples.md)
@@ -1 +1 @@
1
- {"version":3,"file":"entityStorageMessagingPushNotificationConnector.js","sourceRoot":"","sources":["../../src/entityStorageMessagingPushNotificationConnector.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjG,OAAO,EACN,6BAA6B,EAE7B,MAAM,iCAAiC,CAAC;AAQzC;;GAEG;AACH,MAAM,OAAO,+CAA+C;IAG3D;;OAEG;IACI,MAAM,CAAU,SAAS,GAAW,gBAAgB,CAAC;IAE5D;;OAEG;IACI,MAAM,CAAU,UAAU,qDAC0B;IAE3D;;;OAGG;IACgB,QAAQ,CAAqB;IAEhD;;;OAGG;IACc,4BAA4B,CAAuD;IAEpG;;;OAGG;IACc,6BAA6B,CAAwD;IAEtG;;;OAGG;IACH,YAAY,OAA4E;QACvF,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAC,OAAO,EAAE,oBAAoB,IAAI,SAAS,CAAC,CAAC;QACzF,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QACH,CAAC;IACF,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,0BAA0B,CACtC,aAAqB,EACrB,KAAa,EACb,OAAe;QAEf,MAAM,CAAC,WAAW,CACjB,+CAA+C,CAAC,UAAU,mBAE1D,aAAa,CACb,CAAC;QACF,MAAM,CAAC,WAAW,CACjB,+CAA+C,CAAC,UAAU,WAE1D,KAAK,CACL,CAAC;QACF,MAAM,CAAC,WAAW,CACjB,+CAA+C,CAAC,UAAU,aAE1D,OAAO,CACP,CAAC;QACF,IAAI,CAAC;YACJ,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;gBACxB,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,+CAA+C,CAAC,UAAU;gBAClE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,OAAO,EAAE,yBAAyB;aAClC,CAAC,CAAC;YAEH,MAAM,EAAE,GAAG,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;YAE3D,MAAM,MAAM,GAAiC;gBAC5C,EAAE;gBACF,aAAa;gBACb,KAAK;gBACL,OAAO;gBACP,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,MAAM,EAAE,SAAS;aACjB,CAAC;YAEF,MAAM,IAAI,CAAC,6BAA6B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC;QACb,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,MAAM,IAAI,YAAY,CACrB,+CAA+C,CAAC,UAAU,EAC1D,4BAA4B,EAC5B,EAAE,KAAK,EAAE,aAAa,EAAE,EACxB,GAAG,CACH,CAAC;QACH,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Converter, GeneralError, Guards, RandomHelper } from \"@twin.org/core\";\nimport {\n\tEntityStorageConnectorFactory,\n\ttype IEntityStorageConnector\n} from \"@twin.org/entity-storage-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport type { IMessagingPushNotificationsConnector } from \"@twin.org/messaging-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { PushNotificationDeviceEntry } from \"./entities/pushNotificationDeviceEntry.js\";\nimport type { PushNotificationMessageEntry } from \"./entities/pushNotificationMessageEntry.js\";\nimport type { IEntityStorageMessagingPushNotificationConnectorConstructorOptions } from \"./models/IEntityStorageMessagingPushNotificationConnectorConstructorOptions.js\";\n\n/**\n * Class for connecting to the push notifications messaging operations of the Entity Storage.\n */\nexport class EntityStorageMessagingPushNotificationConnector\n\timplements IMessagingPushNotificationsConnector\n{\n\t/**\n\t * The namespace for the connector.\n\t */\n\tpublic static readonly NAMESPACE: string = \"entity-storage\";\n\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string =\n\t\tnameof<EntityStorageMessagingPushNotificationConnector>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprotected readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The entity storage for the push notifications device entries.\n\t * @internal\n\t */\n\tprivate readonly _messagingDeviceEntryStorage: IEntityStorageConnector<PushNotificationDeviceEntry>;\n\n\t/**\n\t * The entity storage for the push notifications message entries.\n\t * @internal\n\t */\n\tprivate readonly _messagingMessageEntryStorage: IEntityStorageConnector<PushNotificationMessageEntry>;\n\n\t/**\n\t * Create a new instance of EntityStorageMessagingPushNotificationConnector.\n\t * @param options The options for the connector.\n\t */\n\tconstructor(options?: IEntityStorageMessagingPushNotificationConnectorConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists(options?.loggingComponentType ?? \"logging\");\n\t\tthis._messagingDeviceEntryStorage = EntityStorageConnectorFactory.get(\n\t\t\toptions?.messagingDeviceEntryStorageConnectorType ??\n\t\t\t\tnameofKebabCase<PushNotificationDeviceEntry>()\n\t\t);\n\t\tthis._messagingMessageEntryStorage = EntityStorageConnectorFactory.get(\n\t\t\toptions?.messagingMessageEntryStorageConnectorType ??\n\t\t\t\tnameofKebabCase<PushNotificationMessageEntry>()\n\t\t);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageMessagingPushNotificationConnector.CLASS_NAME;\n\t}\n\n\t/**\n\t * Registers a device to an specific app in order to send notifications to it.\n\t * @param applicationId The application address.\n\t * @param deviceToken The device token.\n\t * @returns If the device was registered successfully.\n\t */\n\tpublic async registerDevice(applicationId: string, deviceToken: string): Promise<string> {\n\t\tGuards.stringValue(\n\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\tnameof(applicationId),\n\t\t\tapplicationId\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\tnameof(deviceToken),\n\t\t\tdeviceToken\n\t\t);\n\t\ttry {\n\t\t\tawait this._logging?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: EntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"deviceRegistering\"\n\t\t\t});\n\n\t\t\tconst id = Converter.bytesToHex(RandomHelper.generate(32));\n\n\t\t\tconst entity: PushNotificationDeviceEntry = {\n\t\t\t\tid,\n\t\t\t\tapplicationId,\n\t\t\t\tdeviceToken,\n\t\t\t\tts: Date.now(),\n\t\t\t\tstatus: \"pending\"\n\t\t\t};\n\n\t\t\tawait this._messagingDeviceEntryStorage.set(entity);\n\t\t\treturn id;\n\t\t} catch (err) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\t\t\"deviceTokenRegisterFailed\",\n\t\t\t\t{ property: \"applicationId\", value: applicationId },\n\t\t\t\terr\n\t\t\t);\n\t\t}\n\t}\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 If the notification was sent successfully.\n\t */\n\tpublic async sendSinglePushNotification(\n\t\tdeviceAddress: string,\n\t\ttitle: string,\n\t\tmessage: string\n\t): Promise<boolean> {\n\t\tGuards.stringValue(\n\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\tnameof(deviceAddress),\n\t\t\tdeviceAddress\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\tnameof(title),\n\t\t\ttitle\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\tnameof(message),\n\t\t\tmessage\n\t\t);\n\t\ttry {\n\t\t\tawait this._logging?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: EntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"pushNotificationSending\"\n\t\t\t});\n\n\t\t\tconst id = Converter.bytesToHex(RandomHelper.generate(32));\n\n\t\t\tconst entity: PushNotificationMessageEntry = {\n\t\t\t\tid,\n\t\t\t\tdeviceAddress,\n\t\t\t\ttitle,\n\t\t\t\tmessage,\n\t\t\t\tts: Date.now(),\n\t\t\t\tstatus: \"pending\"\n\t\t\t};\n\n\t\t\tawait this._messagingMessageEntryStorage.set(entity);\n\t\t\treturn true;\n\t\t} catch (err) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\t\t\"sendPushNotificationFailed\",\n\t\t\t\t{ value: deviceAddress },\n\t\t\t\terr\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"entityStorageMessagingPushNotificationConnector.js","sourceRoot":"","sources":["../../src/entityStorageMessagingPushNotificationConnector.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,O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BACb,KAAK;gBACL,OAAO;gBACP,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,MAAM,EAAE,SAAS;aACjB,CAAC;YAEF,MAAM,IAAI,CAAC,6BAA6B,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC;QACb,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,MAAM,IAAI,YAAY,CACrB,+CAA+C,CAAC,UAAU,EAC1D,4BAA4B,EAC5B,EAAE,KAAK,EAAE,aAAa,EAAE,EACxB,GAAG,CACH,CAAC;QACH,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ComponentFactory, Converter, GeneralError, Guards, RandomHelper } from \"@twin.org/core\";\nimport {\n\tEntityStorageConnectorFactory,\n\ttype IEntityStorageConnector\n} from \"@twin.org/entity-storage-models\";\nimport type { ILoggingComponent } from \"@twin.org/logging-models\";\nimport type { IMessagingPushNotificationsConnector } from \"@twin.org/messaging-models\";\nimport { nameof, nameofKebabCase } from \"@twin.org/nameof\";\nimport type { PushNotificationDeviceEntry } from \"./entities/pushNotificationDeviceEntry.js\";\nimport type { PushNotificationMessageEntry } from \"./entities/pushNotificationMessageEntry.js\";\nimport type { IEntityStorageMessagingPushNotificationConnectorConstructorOptions } from \"./models/IEntityStorageMessagingPushNotificationConnectorConstructorOptions.js\";\n\n/**\n * Class for connecting to the push notifications messaging operations of the Entity Storage.\n */\nexport class EntityStorageMessagingPushNotificationConnector implements IMessagingPushNotificationsConnector {\n\t/**\n\t * The namespace for the connector.\n\t */\n\tpublic static readonly NAMESPACE: string = \"entity-storage\";\n\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string =\n\t\tnameof<EntityStorageMessagingPushNotificationConnector>();\n\n\t/**\n\t * The logging component.\n\t * @internal\n\t */\n\tprotected readonly _logging?: ILoggingComponent;\n\n\t/**\n\t * The entity storage for the push notifications device entries.\n\t * @internal\n\t */\n\tprivate readonly _messagingDeviceEntryStorage: IEntityStorageConnector<PushNotificationDeviceEntry>;\n\n\t/**\n\t * The entity storage for the push notifications message entries.\n\t * @internal\n\t */\n\tprivate readonly _messagingMessageEntryStorage: IEntityStorageConnector<PushNotificationMessageEntry>;\n\n\t/**\n\t * Create a new instance of EntityStorageMessagingPushNotificationConnector.\n\t * @param options The options for the connector.\n\t */\n\tconstructor(options?: IEntityStorageMessagingPushNotificationConnectorConstructorOptions) {\n\t\tthis._logging = ComponentFactory.getIfExists(options?.loggingComponentType ?? \"logging\");\n\t\tthis._messagingDeviceEntryStorage = EntityStorageConnectorFactory.get(\n\t\t\toptions?.messagingDeviceEntryStorageConnectorType ??\n\t\t\t\tnameofKebabCase<PushNotificationDeviceEntry>()\n\t\t);\n\t\tthis._messagingMessageEntryStorage = EntityStorageConnectorFactory.get(\n\t\t\toptions?.messagingMessageEntryStorageConnectorType ??\n\t\t\t\tnameofKebabCase<PushNotificationMessageEntry>()\n\t\t);\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn EntityStorageMessagingPushNotificationConnector.CLASS_NAME;\n\t}\n\n\t/**\n\t * Registers a device to an specific app in order to send notifications to it.\n\t * @param applicationId The application address.\n\t * @param deviceToken The device token.\n\t * @returns If the device was registered successfully.\n\t */\n\tpublic async registerDevice(applicationId: string, deviceToken: string): Promise<string> {\n\t\tGuards.stringValue(\n\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\tnameof(applicationId),\n\t\t\tapplicationId\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\tnameof(deviceToken),\n\t\t\tdeviceToken\n\t\t);\n\t\ttry {\n\t\t\tawait this._logging?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: EntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"deviceRegistering\"\n\t\t\t});\n\n\t\t\tconst id = Converter.bytesToHex(RandomHelper.generate(32));\n\n\t\t\tconst entity: PushNotificationDeviceEntry = {\n\t\t\t\tid,\n\t\t\t\tapplicationId,\n\t\t\t\tdeviceToken,\n\t\t\t\tts: Date.now(),\n\t\t\t\tstatus: \"pending\"\n\t\t\t};\n\n\t\t\tawait this._messagingDeviceEntryStorage.set(entity);\n\t\t\treturn id;\n\t\t} catch (err) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\t\t\"deviceTokenRegisterFailed\",\n\t\t\t\t{ property: \"applicationId\", value: applicationId },\n\t\t\t\terr\n\t\t\t);\n\t\t}\n\t}\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 If the notification was sent successfully.\n\t */\n\tpublic async sendSinglePushNotification(\n\t\tdeviceAddress: string,\n\t\ttitle: string,\n\t\tmessage: string\n\t): Promise<boolean> {\n\t\tGuards.stringValue(\n\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\tnameof(deviceAddress),\n\t\t\tdeviceAddress\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\tnameof(title),\n\t\t\ttitle\n\t\t);\n\t\tGuards.stringValue(\n\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\tnameof(message),\n\t\t\tmessage\n\t\t);\n\t\ttry {\n\t\t\tawait this._logging?.log({\n\t\t\t\tlevel: \"info\",\n\t\t\t\tsource: EntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\t\tts: Date.now(),\n\t\t\t\tmessage: \"pushNotificationSending\"\n\t\t\t});\n\n\t\t\tconst id = Converter.bytesToHex(RandomHelper.generate(32));\n\n\t\t\tconst entity: PushNotificationMessageEntry = {\n\t\t\t\tid,\n\t\t\t\tdeviceAddress,\n\t\t\t\ttitle,\n\t\t\t\tmessage,\n\t\t\t\tts: Date.now(),\n\t\t\t\tstatus: \"pending\"\n\t\t\t};\n\n\t\t\tawait this._messagingMessageEntryStorage.set(entity);\n\t\t\treturn true;\n\t\t} catch (err) {\n\t\t\tthrow new GeneralError(\n\t\t\t\tEntityStorageMessagingPushNotificationConnector.CLASS_NAME,\n\t\t\t\t\"sendPushNotificationFailed\",\n\t\t\t\t{ value: deviceAddress },\n\t\t\t\terr\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
package/docs/changelog.md CHANGED
@@ -1,6 +1,34 @@
1
- # @twin.org/messaging-connector-entity-storage - Changelog
1
+ # Changelog
2
2
 
3
- ## [0.0.3-next.2](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.3-next.1...messaging-connector-entity-storage-v0.0.3-next.2) (2026-01-20)
3
+ ## [0.0.3-next.4](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.3-next.3...messaging-connector-entity-storage-v0.0.3-next.4) (2026-05-11)
4
+
5
+
6
+ ### Features
7
+
8
+ * typescript 6 update ([0aabd3e](https://github.com/iotaledger/twin-messaging/commit/0aabd3e05fbdf1cbc5df34cf24c461a75abc9d7e))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/messaging-models bumped from 0.0.3-next.3 to 0.0.3-next.4
16
+
17
+ ## [0.0.3-next.3](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.3-next.2...messaging-connector-entity-storage-v0.0.3-next.3) (2026-02-26)
18
+
19
+
20
+ ### Miscellaneous Chores
21
+
22
+ * **messaging-connector-entity-storage:** Synchronize repo versions
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/messaging-models bumped from 0.0.3-next.2 to 0.0.3-next.3
30
+
31
+ ## [0.0.3-next.2](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.3-next.1...messaging-connector-entity-storage-v0.0.3-next.2) (2026-01-20)
4
32
 
5
33
 
6
34
  ### Miscellaneous Chores
@@ -14,25 +42,25 @@
14
42
  * dependencies
15
43
  * @twin.org/messaging-models bumped from 0.0.3-next.1 to 0.0.3-next.2
16
44
 
17
- ## [0.0.3-next.1](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.3-next.0...messaging-connector-entity-storage-v0.0.3-next.1) (2025-11-11)
45
+ ## [0.0.3-next.1](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.3-next.0...messaging-connector-entity-storage-v0.0.3-next.1) (2025-11-11)
18
46
 
19
47
 
20
48
  ### Features
21
49
 
22
- * add context id features ([#24](https://github.com/twinfoundation/messaging/issues/24)) ([42b94e8](https://github.com/twinfoundation/messaging/commit/42b94e8be32c86db6afc5ccf5e9ff2c93d15d05d))
23
- * add messaging admin component ([cbaaca3](https://github.com/twinfoundation/messaging/commit/cbaaca34db6a9f5c51438c201535b4b43a1aea1f))
24
- * add validate-locales ([5eeff9b](https://github.com/twinfoundation/messaging/commit/5eeff9b9bf6cecf93b249b56c4bb74b4c5bf86c9))
25
- * Entity Storage email connector init ([#2](https://github.com/twinfoundation/messaging/issues/2)) ([65b344d](https://github.com/twinfoundation/messaging/commit/65b344de0d2d3d557d921e3d32e263dcb04ee9b3))
26
- * eslint migration to flat config ([faa02ec](https://github.com/twinfoundation/messaging/commit/faa02ec0ef450db88b08e938415e40cf13625d15))
27
- * update dependencies ([53dcde6](https://github.com/twinfoundation/messaging/commit/53dcde60d6efaee5957296f6d097cb97c0fb2f9d))
28
- * update framework core ([fc476b4](https://github.com/twinfoundation/messaging/commit/fc476b48e6075de0ae871e3cec1fa179aa04b5eb))
29
- * use shared store mechanism ([#8](https://github.com/twinfoundation/messaging/issues/8)) ([9ad65c2](https://github.com/twinfoundation/messaging/commit/9ad65c239ba77bb75604a1f6e51b975357f3228d))
50
+ * add context id features ([#24](https://github.com/iotaledger/twin-messaging/issues/24)) ([42b94e8](https://github.com/iotaledger/twin-messaging/commit/42b94e8be32c86db6afc5ccf5e9ff2c93d15d05d))
51
+ * add messaging admin component ([cbaaca3](https://github.com/iotaledger/twin-messaging/commit/cbaaca34db6a9f5c51438c201535b4b43a1aea1f))
52
+ * add validate-locales ([5eeff9b](https://github.com/iotaledger/twin-messaging/commit/5eeff9b9bf6cecf93b249b56c4bb74b4c5bf86c9))
53
+ * Entity Storage email connector init ([#2](https://github.com/iotaledger/twin-messaging/issues/2)) ([65b344d](https://github.com/iotaledger/twin-messaging/commit/65b344de0d2d3d557d921e3d32e263dcb04ee9b3))
54
+ * eslint migration to flat config ([faa02ec](https://github.com/iotaledger/twin-messaging/commit/faa02ec0ef450db88b08e938415e40cf13625d15))
55
+ * update dependencies ([53dcde6](https://github.com/iotaledger/twin-messaging/commit/53dcde60d6efaee5957296f6d097cb97c0fb2f9d))
56
+ * update framework core ([fc476b4](https://github.com/iotaledger/twin-messaging/commit/fc476b48e6075de0ae871e3cec1fa179aa04b5eb))
57
+ * use shared store mechanism ([#8](https://github.com/iotaledger/twin-messaging/issues/8)) ([9ad65c2](https://github.com/iotaledger/twin-messaging/commit/9ad65c239ba77bb75604a1f6e51b975357f3228d))
30
58
 
31
59
 
32
60
  ### Bug Fixes
33
61
 
34
- * Adding format to the MessagingEntries ts number ([8b99d4f](https://github.com/twinfoundation/messaging/commit/8b99d4f01c4f2b08da8d2affc1b9554fcb0d3690))
35
- * Make SMS entry error property optional ([#5](https://github.com/twinfoundation/messaging/issues/5)) ([e0faf83](https://github.com/twinfoundation/messaging/commit/e0faf83e028a2c5dc45a5e8ba1a546013e4a3c8c))
62
+ * Adding format to the MessagingEntries ts number ([8b99d4f](https://github.com/iotaledger/twin-messaging/commit/8b99d4f01c4f2b08da8d2affc1b9554fcb0d3690))
63
+ * Make SMS entry error property optional ([#5](https://github.com/iotaledger/twin-messaging/issues/5)) ([e0faf83](https://github.com/iotaledger/twin-messaging/commit/e0faf83e028a2c5dc45a5e8ba1a546013e4a3c8c))
36
64
 
37
65
 
38
66
  ### Dependencies
@@ -41,12 +69,12 @@
41
69
  * dependencies
42
70
  * @twin.org/messaging-models bumped from 0.0.3-next.0 to 0.0.3-next.1
43
71
 
44
- ## [0.0.2-next.6](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.2-next.5...messaging-connector-entity-storage-v0.0.2-next.6) (2025-10-09)
72
+ ## [0.0.2-next.6](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.2-next.5...messaging-connector-entity-storage-v0.0.2-next.6) (2025-10-09)
45
73
 
46
74
 
47
75
  ### Features
48
76
 
49
- * add validate-locales ([5eeff9b](https://github.com/twinfoundation/messaging/commit/5eeff9b9bf6cecf93b249b56c4bb74b4c5bf86c9))
77
+ * add validate-locales ([5eeff9b](https://github.com/iotaledger/twin-messaging/commit/5eeff9b9bf6cecf93b249b56c4bb74b4c5bf86c9))
50
78
 
51
79
 
52
80
  ### Dependencies
@@ -55,7 +83,7 @@
55
83
  * dependencies
56
84
  * @twin.org/messaging-models bumped from 0.0.2-next.5 to 0.0.2-next.6
57
85
 
58
- ## [0.0.2-next.5](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.2-next.4...messaging-connector-entity-storage-v0.0.2-next.5) (2025-10-02)
86
+ ## [0.0.2-next.5](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.2-next.4...messaging-connector-entity-storage-v0.0.2-next.5) (2025-10-02)
59
87
 
60
88
 
61
89
  ### Miscellaneous Chores
@@ -69,7 +97,7 @@
69
97
  * dependencies
70
98
  * @twin.org/messaging-models bumped from 0.0.2-next.4 to 0.0.2-next.5
71
99
 
72
- ## [0.0.2-next.4](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.2-next.3...messaging-connector-entity-storage-v0.0.2-next.4) (2025-09-29)
100
+ ## [0.0.2-next.4](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.2-next.3...messaging-connector-entity-storage-v0.0.2-next.4) (2025-09-29)
73
101
 
74
102
 
75
103
  ### Miscellaneous Chores
@@ -83,12 +111,12 @@
83
111
  * dependencies
84
112
  * @twin.org/messaging-models bumped from 0.0.2-next.3 to 0.0.2-next.4
85
113
 
86
- ## [0.0.2-next.3](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.2-next.2...messaging-connector-entity-storage-v0.0.2-next.3) (2025-09-29)
114
+ ## [0.0.2-next.3](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.2-next.2...messaging-connector-entity-storage-v0.0.2-next.3) (2025-09-29)
87
115
 
88
116
 
89
117
  ### Features
90
118
 
91
- * add messaging admin component ([cbaaca3](https://github.com/twinfoundation/messaging/commit/cbaaca34db6a9f5c51438c201535b4b43a1aea1f))
119
+ * add messaging admin component ([cbaaca3](https://github.com/iotaledger/twin-messaging/commit/cbaaca34db6a9f5c51438c201535b4b43a1aea1f))
92
120
 
93
121
 
94
122
  ### Dependencies
@@ -97,12 +125,12 @@
97
125
  * dependencies
98
126
  * @twin.org/messaging-models bumped from 0.0.2-next.2 to 0.0.2-next.3
99
127
 
100
- ## [0.0.2-next.2](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.2-next.1...messaging-connector-entity-storage-v0.0.2-next.2) (2025-08-29)
128
+ ## [0.0.2-next.2](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.2-next.1...messaging-connector-entity-storage-v0.0.2-next.2) (2025-08-29)
101
129
 
102
130
 
103
131
  ### Features
104
132
 
105
- * eslint migration to flat config ([faa02ec](https://github.com/twinfoundation/messaging/commit/faa02ec0ef450db88b08e938415e40cf13625d15))
133
+ * eslint migration to flat config ([faa02ec](https://github.com/iotaledger/twin-messaging/commit/faa02ec0ef450db88b08e938415e40cf13625d15))
106
134
 
107
135
 
108
136
  ### Dependencies
@@ -111,21 +139,21 @@
111
139
  * dependencies
112
140
  * @twin.org/messaging-models bumped from 0.0.2-next.1 to 0.0.2-next.2
113
141
 
114
- ## [0.0.2-next.1](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.2-next.0...messaging-connector-entity-storage-v0.0.2-next.1) (2025-08-20)
142
+ ## [0.0.2-next.1](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.2-next.0...messaging-connector-entity-storage-v0.0.2-next.1) (2025-08-20)
115
143
 
116
144
 
117
145
  ### Features
118
146
 
119
- * Entity Storage email connector init ([#2](https://github.com/twinfoundation/messaging/issues/2)) ([65b344d](https://github.com/twinfoundation/messaging/commit/65b344de0d2d3d557d921e3d32e263dcb04ee9b3))
120
- * update dependencies ([53dcde6](https://github.com/twinfoundation/messaging/commit/53dcde60d6efaee5957296f6d097cb97c0fb2f9d))
121
- * update framework core ([fc476b4](https://github.com/twinfoundation/messaging/commit/fc476b48e6075de0ae871e3cec1fa179aa04b5eb))
122
- * use shared store mechanism ([#8](https://github.com/twinfoundation/messaging/issues/8)) ([9ad65c2](https://github.com/twinfoundation/messaging/commit/9ad65c239ba77bb75604a1f6e51b975357f3228d))
147
+ * Entity Storage email connector init ([#2](https://github.com/iotaledger/twin-messaging/issues/2)) ([65b344d](https://github.com/iotaledger/twin-messaging/commit/65b344de0d2d3d557d921e3d32e263dcb04ee9b3))
148
+ * update dependencies ([53dcde6](https://github.com/iotaledger/twin-messaging/commit/53dcde60d6efaee5957296f6d097cb97c0fb2f9d))
149
+ * update framework core ([fc476b4](https://github.com/iotaledger/twin-messaging/commit/fc476b48e6075de0ae871e3cec1fa179aa04b5eb))
150
+ * use shared store mechanism ([#8](https://github.com/iotaledger/twin-messaging/issues/8)) ([9ad65c2](https://github.com/iotaledger/twin-messaging/commit/9ad65c239ba77bb75604a1f6e51b975357f3228d))
123
151
 
124
152
 
125
153
  ### Bug Fixes
126
154
 
127
- * Adding format to the MessagingEntries ts number ([8b99d4f](https://github.com/twinfoundation/messaging/commit/8b99d4f01c4f2b08da8d2affc1b9554fcb0d3690))
128
- * Make SMS entry error property optional ([#5](https://github.com/twinfoundation/messaging/issues/5)) ([e0faf83](https://github.com/twinfoundation/messaging/commit/e0faf83e028a2c5dc45a5e8ba1a546013e4a3c8c))
155
+ * Adding format to the MessagingEntries ts number ([8b99d4f](https://github.com/iotaledger/twin-messaging/commit/8b99d4f01c4f2b08da8d2affc1b9554fcb0d3690))
156
+ * Make SMS entry error property optional ([#5](https://github.com/iotaledger/twin-messaging/issues/5)) ([e0faf83](https://github.com/iotaledger/twin-messaging/commit/e0faf83e028a2c5dc45a5e8ba1a546013e4a3c8c))
129
157
 
130
158
 
131
159
  ### Dependencies
@@ -139,7 +167,7 @@
139
167
 
140
168
  ### Features
141
169
 
142
- * release to production ([cc714a7](https://github.com/twinfoundation/messaging/commit/cc714a7e1db251ab8e1a158f7753387a56d60271))
170
+ * release to production ([cc714a7](https://github.com/iotaledger/twin-messaging/commit/cc714a7e1db251ab8e1a158f7753387a56d60271))
143
171
 
144
172
 
145
173
  ### Dependencies
@@ -148,7 +176,7 @@
148
176
  * dependencies
149
177
  * @twin.org/messaging-models bumped from ^0.0.0 to ^0.0.1
150
178
 
151
- ## [0.0.1-next.16](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.1-next.15...messaging-connector-entity-storage-v0.0.1-next.16) (2025-06-30)
179
+ ## [0.0.1-next.16](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.1-next.15...messaging-connector-entity-storage-v0.0.1-next.16) (2025-06-30)
152
180
 
153
181
 
154
182
  ### Miscellaneous Chores
@@ -162,12 +190,12 @@
162
190
  * dependencies
163
191
  * @twin.org/messaging-models bumped from 0.0.1-next.15 to 0.0.1-next.16
164
192
 
165
- ## [0.0.1-next.15](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.1-next.14...messaging-connector-entity-storage-v0.0.1-next.15) (2025-06-12)
193
+ ## [0.0.1-next.15](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.1-next.14...messaging-connector-entity-storage-v0.0.1-next.15) (2025-06-12)
166
194
 
167
195
 
168
196
  ### Features
169
197
 
170
- * update dependencies ([53dcde6](https://github.com/twinfoundation/messaging/commit/53dcde60d6efaee5957296f6d097cb97c0fb2f9d))
198
+ * update dependencies ([53dcde6](https://github.com/iotaledger/twin-messaging/commit/53dcde60d6efaee5957296f6d097cb97c0fb2f9d))
171
199
 
172
200
 
173
201
  ### Dependencies
@@ -176,12 +204,12 @@
176
204
  * dependencies
177
205
  * @twin.org/messaging-models bumped from 0.0.1-next.14 to 0.0.1-next.15
178
206
 
179
- ## [0.0.1-next.14](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.1-next.13...messaging-connector-entity-storage-v0.0.1-next.14) (2025-04-17)
207
+ ## [0.0.1-next.14](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.1-next.13...messaging-connector-entity-storage-v0.0.1-next.14) (2025-04-17)
180
208
 
181
209
 
182
210
  ### Features
183
211
 
184
- * use shared store mechanism ([#8](https://github.com/twinfoundation/messaging/issues/8)) ([9ad65c2](https://github.com/twinfoundation/messaging/commit/9ad65c239ba77bb75604a1f6e51b975357f3228d))
212
+ * use shared store mechanism ([#8](https://github.com/iotaledger/twin-messaging/issues/8)) ([9ad65c2](https://github.com/iotaledger/twin-messaging/commit/9ad65c239ba77bb75604a1f6e51b975357f3228d))
185
213
 
186
214
 
187
215
  ### Dependencies
@@ -190,18 +218,18 @@
190
218
  * dependencies
191
219
  * @twin.org/messaging-models bumped from 0.0.1-next.13 to 0.0.1-next.14
192
220
 
193
- ## [0.0.1-next.13](https://github.com/twinfoundation/messaging/compare/messaging-connector-entity-storage-v0.0.1-next.12...messaging-connector-entity-storage-v0.0.1-next.13) (2025-03-28)
221
+ ## [0.0.1-next.13](https://github.com/iotaledger/twin-messaging/compare/messaging-connector-entity-storage-v0.0.1-next.12...messaging-connector-entity-storage-v0.0.1-next.13) (2025-03-28)
194
222
 
195
223
 
196
224
  ### Features
197
225
 
198
- * Entity Storage email connector init ([#2](https://github.com/twinfoundation/messaging/issues/2)) ([65b344d](https://github.com/twinfoundation/messaging/commit/65b344de0d2d3d557d921e3d32e263dcb04ee9b3))
226
+ * Entity Storage email connector init ([#2](https://github.com/iotaledger/twin-messaging/issues/2)) ([65b344d](https://github.com/iotaledger/twin-messaging/commit/65b344de0d2d3d557d921e3d32e263dcb04ee9b3))
199
227
 
200
228
 
201
229
  ### Bug Fixes
202
230
 
203
- * Adding format to the MessagingEntries ts number ([8b99d4f](https://github.com/twinfoundation/messaging/commit/8b99d4f01c4f2b08da8d2affc1b9554fcb0d3690))
204
- * Make SMS entry error property optional ([#5](https://github.com/twinfoundation/messaging/issues/5)) ([e0faf83](https://github.com/twinfoundation/messaging/commit/e0faf83e028a2c5dc45a5e8ba1a546013e4a3c8c))
231
+ * Adding format to the MessagingEntries ts number ([8b99d4f](https://github.com/iotaledger/twin-messaging/commit/8b99d4f01c4f2b08da8d2affc1b9554fcb0d3690))
232
+ * Make SMS entry error property optional ([#5](https://github.com/iotaledger/twin-messaging/issues/5)) ([e0faf83](https://github.com/iotaledger/twin-messaging/commit/e0faf83e028a2c5dc45a5e8ba1a546013e4a3c8c))
205
233
 
206
234
 
207
235
  ### Dependencies
package/docs/examples.md CHANGED
@@ -1 +1,119 @@
1
- # @twin.org/messaging-connector-entity-storage - Examples
1
+ # Messaging Connector Entity Storage Examples
2
+
3
+ These examples show how to queue message work in entity storage and inspect stored entries during processing.
4
+
5
+ ## EntityStorageMessagingPushNotificationConnector
6
+
7
+ ```typescript
8
+ import { EntityStorageMessagingPushNotificationConnector } from '@twin.org/messaging-connector-entity-storage';
9
+
10
+ const pushConnector = new EntityStorageMessagingPushNotificationConnector();
11
+
12
+ console.log(pushConnector.className()); // EntityStorageMessagingPushNotificationConnector
13
+ const deviceRecordId = await pushConnector.registerDevice('orders-app', 'device-token-001');
14
+ console.log(deviceRecordId); // 3f0a8e8e7d58b2f1a1d2f3c4b5e6a7c8d9e0f112131415161718191a1b1c1d1e
15
+
16
+ const queued = await pushConnector.sendSinglePushNotification(
17
+ 'device-record-001',
18
+ 'Order dispatched',
19
+ 'Your parcel has left the warehouse'
20
+ );
21
+ console.log(queued); // true
22
+ ```
23
+
24
+ ## EntityStorageMessagingEmailConnector
25
+
26
+ ```typescript
27
+ import { EntityStorageMessagingEmailConnector } from '@twin.org/messaging-connector-entity-storage';
28
+
29
+ const emailConnector = new EntityStorageMessagingEmailConnector();
30
+
31
+ console.log(emailConnector.className()); // EntityStorageMessagingEmailConnector
32
+
33
+ const queued = await emailConnector.sendCustomEmail(
34
+ 'service@example.org',
35
+ ['recipient@example.org'],
36
+ 'Welcome',
37
+ '<p>Thanks for signing up.</p>'
38
+ );
39
+ console.log(queued); // true
40
+ ```
41
+
42
+ ## EntityStorageMessagingSmsConnector
43
+
44
+ ```typescript
45
+ import { EntityStorageMessagingSmsConnector } from '@twin.org/messaging-connector-entity-storage';
46
+
47
+ const smsConnector = new EntityStorageMessagingSmsConnector();
48
+
49
+ console.log(smsConnector.className()); // EntityStorageMessagingSmsConnector
50
+
51
+ const queued = await smsConnector.sendSMS(
52
+ '+441234567890',
53
+ 'Your appointment is confirmed for 10:30'
54
+ );
55
+ console.log(queued); // true
56
+ ```
57
+
58
+ ## PushNotificationMessageEntry
59
+
60
+ ```typescript
61
+ import { PushNotificationMessageEntry } from '@twin.org/messaging-connector-entity-storage';
62
+
63
+ const messageEntry = new PushNotificationMessageEntry();
64
+ messageEntry.id = 'push-message-001';
65
+ messageEntry.deviceAddress = 'device-record-001';
66
+ messageEntry.title = 'Order dispatched';
67
+ messageEntry.message = 'Your parcel has left the warehouse';
68
+ messageEntry.ts = Date.now();
69
+ messageEntry.status = 'pending';
70
+
71
+ console.log(messageEntry.status); // pending
72
+ ```
73
+
74
+ ## PushNotificationDeviceEntry
75
+
76
+ ```typescript
77
+ import { PushNotificationDeviceEntry } from '@twin.org/messaging-connector-entity-storage';
78
+
79
+ const deviceEntry = new PushNotificationDeviceEntry();
80
+ deviceEntry.id = 'push-device-001';
81
+ deviceEntry.applicationId = 'orders-app';
82
+ deviceEntry.deviceToken = 'device-token-001';
83
+ deviceEntry.ts = Date.now();
84
+ deviceEntry.status = 'pending';
85
+
86
+ console.log(deviceEntry.applicationId); // orders-app
87
+ ```
88
+
89
+ ## EmailEntry
90
+
91
+ ```typescript
92
+ import { EmailEntry } from '@twin.org/messaging-connector-entity-storage';
93
+
94
+ const emailEntry = new EmailEntry();
95
+ emailEntry.id = 'email-001';
96
+ emailEntry.sender = 'service@example.org';
97
+ emailEntry.recipients = ['recipient@example.org'];
98
+ emailEntry.ts = Date.now();
99
+ emailEntry.subject = 'Welcome';
100
+ emailEntry.message = '<p>Thanks for signing up.</p>';
101
+ emailEntry.status = 'pending';
102
+
103
+ console.log(emailEntry.recipients.length); // 1
104
+ ```
105
+
106
+ ## SmsEntry
107
+
108
+ ```typescript
109
+ import { SmsEntry } from '@twin.org/messaging-connector-entity-storage';
110
+
111
+ const smsEntry = new SmsEntry();
112
+ smsEntry.id = 'sms-001';
113
+ smsEntry.phoneNumber = '+441234567890';
114
+ smsEntry.ts = Date.now();
115
+ smsEntry.message = 'Your appointment is confirmed for 10:30';
116
+ smsEntry.status = 'sent';
117
+
118
+ console.log(smsEntry.status); // sent
119
+ ```
@@ -14,7 +14,7 @@ Call defining an email entry.
14
14
 
15
15
  ## Properties
16
16
 
17
- ### id
17
+ ### id {#id}
18
18
 
19
19
  > **id**: `string`
20
20
 
@@ -22,7 +22,7 @@ The id.
22
22
 
23
23
  ***
24
24
 
25
- ### sender
25
+ ### sender {#sender}
26
26
 
27
27
  > **sender**: `string`
28
28
 
@@ -30,7 +30,7 @@ The sender email address.
30
30
 
31
31
  ***
32
32
 
33
- ### recipients
33
+ ### recipients {#recipients}
34
34
 
35
35
  > **recipients**: `string`[]
36
36
 
@@ -38,7 +38,7 @@ The recipient email addresses.
38
38
 
39
39
  ***
40
40
 
41
- ### ts
41
+ ### ts {#ts}
42
42
 
43
43
  > **ts**: `number`
44
44
 
@@ -46,7 +46,7 @@ The timestamp of the email entry.
46
46
 
47
47
  ***
48
48
 
49
- ### message
49
+ ### message {#message}
50
50
 
51
51
  > **message**: `string`
52
52
 
@@ -54,7 +54,7 @@ The message.
54
54
 
55
55
  ***
56
56
 
57
- ### subject
57
+ ### subject {#subject}
58
58
 
59
59
  > **subject**: `string`
60
60
 
@@ -62,7 +62,7 @@ The subject.
62
62
 
63
63
  ***
64
64
 
65
- ### status
65
+ ### status {#status}
66
66
 
67
67
  > **status**: `string`
68
68
 
@@ -70,8 +70,8 @@ The status.
70
70
 
71
71
  ***
72
72
 
73
- ### error?
73
+ ### error? {#error}
74
74
 
75
- > `optional` **error**: `IError`
75
+ > `optional` **error?**: `IError`
76
76
 
77
77
  The error.
@@ -28,7 +28,7 @@ The options for the connector.
28
28
 
29
29
  ## Properties
30
30
 
31
- ### NAMESPACE
31
+ ### NAMESPACE {#namespace}
32
32
 
33
33
  > `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
34
34
 
@@ -36,7 +36,7 @@ The namespace for the connector.
36
36
 
37
37
  ***
38
38
 
39
- ### CLASS\_NAME
39
+ ### CLASS\_NAME {#class_name}
40
40
 
41
41
  > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
@@ -44,7 +44,7 @@ Runtime name for the class.
44
44
 
45
45
  ## Methods
46
46
 
47
- ### className()
47
+ ### className() {#classname}
48
48
 
49
49
  > **className**(): `string`
50
50
 
@@ -62,7 +62,7 @@ The class name of the component.
62
62
 
63
63
  ***
64
64
 
65
- ### sendCustomEmail()
65
+ ### sendCustomEmail() {#sendcustomemail}
66
66
 
67
67
  > **sendCustomEmail**(`sender`, `recipients`, `subject`, `content`): `Promise`\<`boolean`\>
68
68
 
@@ -28,7 +28,7 @@ The options for the connector.
28
28
 
29
29
  ## Properties
30
30
 
31
- ### NAMESPACE
31
+ ### NAMESPACE {#namespace}
32
32
 
33
33
  > `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
34
34
 
@@ -36,7 +36,7 @@ The namespace for the connector.
36
36
 
37
37
  ***
38
38
 
39
- ### CLASS\_NAME
39
+ ### CLASS\_NAME {#class_name}
40
40
 
41
41
  > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
@@ -44,7 +44,7 @@ Runtime name for the class.
44
44
 
45
45
  ## Methods
46
46
 
47
- ### className()
47
+ ### className() {#classname}
48
48
 
49
49
  > **className**(): `string`
50
50
 
@@ -62,7 +62,7 @@ The class name of the component.
62
62
 
63
63
  ***
64
64
 
65
- ### registerDevice()
65
+ ### registerDevice() {#registerdevice}
66
66
 
67
67
  > **registerDevice**(`applicationId`, `deviceToken`): `Promise`\<`string`\>
68
68
 
@@ -94,7 +94,7 @@ If the device was registered successfully.
94
94
 
95
95
  ***
96
96
 
97
- ### sendSinglePushNotification()
97
+ ### sendSinglePushNotification() {#sendsinglepushnotification}
98
98
 
99
99
  > **sendSinglePushNotification**(`deviceAddress`, `title`, `message`): `Promise`\<`boolean`\>
100
100
 
@@ -28,7 +28,7 @@ The options for the connector.
28
28
 
29
29
  ## Properties
30
30
 
31
- ### NAMESPACE
31
+ ### NAMESPACE {#namespace}
32
32
 
33
33
  > `readonly` `static` **NAMESPACE**: `string` = `"entity-storage"`
34
34
 
@@ -36,7 +36,7 @@ The namespace for the connector.
36
36
 
37
37
  ***
38
38
 
39
- ### CLASS\_NAME
39
+ ### CLASS\_NAME {#class_name}
40
40
 
41
41
  > `readonly` `static` **CLASS\_NAME**: `string`
42
42
 
@@ -44,7 +44,7 @@ Runtime name for the class.
44
44
 
45
45
  ## Methods
46
46
 
47
- ### className()
47
+ ### className() {#classname}
48
48
 
49
49
  > **className**(): `string`
50
50
 
@@ -62,7 +62,7 @@ The class name of the component.
62
62
 
63
63
  ***
64
64
 
65
- ### sendSMS()
65
+ ### sendSMS() {#sendsms}
66
66
 
67
67
  > **sendSMS**(`phoneNumber`, `message`): `Promise`\<`boolean`\>
68
68
 
@@ -14,7 +14,7 @@ Call defining an push notification device entry.
14
14
 
15
15
  ## Properties
16
16
 
17
- ### id
17
+ ### id {#id}
18
18
 
19
19
  > **id**: `string`
20
20
 
@@ -22,7 +22,7 @@ The id.
22
22
 
23
23
  ***
24
24
 
25
- ### applicationId
25
+ ### applicationId {#applicationid}
26
26
 
27
27
  > **applicationId**: `string`
28
28
 
@@ -30,7 +30,7 @@ The applicationId.
30
30
 
31
31
  ***
32
32
 
33
- ### deviceToken
33
+ ### deviceToken {#devicetoken}
34
34
 
35
35
  > **deviceToken**: `string`
36
36
 
@@ -38,7 +38,7 @@ The device token.
38
38
 
39
39
  ***
40
40
 
41
- ### ts
41
+ ### ts {#ts}
42
42
 
43
43
  > **ts**: `number`
44
44
 
@@ -46,7 +46,7 @@ The timestamp of the push notification device entry.
46
46
 
47
47
  ***
48
48
 
49
- ### status
49
+ ### status {#status}
50
50
 
51
51
  > **status**: `string`
52
52
 
@@ -54,8 +54,8 @@ The status.
54
54
 
55
55
  ***
56
56
 
57
- ### error?
57
+ ### error? {#error}
58
58
 
59
- > `optional` **error**: `IError`
59
+ > `optional` **error?**: `IError`
60
60
 
61
61
  The error.
@@ -14,7 +14,7 @@ Call defining an push notification message entry.
14
14
 
15
15
  ## Properties
16
16
 
17
- ### id
17
+ ### id {#id}
18
18
 
19
19
  > **id**: `string`
20
20
 
@@ -22,7 +22,7 @@ The id.
22
22
 
23
23
  ***
24
24
 
25
- ### deviceAddress
25
+ ### deviceAddress {#deviceaddress}
26
26
 
27
27
  > **deviceAddress**: `string`
28
28
 
@@ -30,7 +30,7 @@ The device address.
30
30
 
31
31
  ***
32
32
 
33
- ### title
33
+ ### title {#title}
34
34
 
35
35
  > **title**: `string`
36
36
 
@@ -38,7 +38,7 @@ The title.
38
38
 
39
39
  ***
40
40
 
41
- ### message
41
+ ### message {#message}
42
42
 
43
43
  > **message**: `string`
44
44
 
@@ -46,7 +46,7 @@ The message.
46
46
 
47
47
  ***
48
48
 
49
- ### ts
49
+ ### ts {#ts}
50
50
 
51
51
  > **ts**: `number`
52
52
 
@@ -54,7 +54,7 @@ The timestamp of the push notification entry.
54
54
 
55
55
  ***
56
56
 
57
- ### status
57
+ ### status {#status}
58
58
 
59
59
  > **status**: `string`
60
60
 
@@ -62,8 +62,8 @@ The status.
62
62
 
63
63
  ***
64
64
 
65
- ### error?
65
+ ### error? {#error}
66
66
 
67
- > `optional` **error**: `IError`
67
+ > `optional` **error?**: `IError`
68
68
 
69
69
  The error.
@@ -14,7 +14,7 @@ Call defining an sms entry.
14
14
 
15
15
  ## Properties
16
16
 
17
- ### id
17
+ ### id {#id}
18
18
 
19
19
  > **id**: `string`
20
20
 
@@ -22,7 +22,7 @@ The id.
22
22
 
23
23
  ***
24
24
 
25
- ### phoneNumber
25
+ ### phoneNumber {#phonenumber}
26
26
 
27
27
  > **phoneNumber**: `string`
28
28
 
@@ -30,7 +30,7 @@ The phone number to deliver the message.
30
30
 
31
31
  ***
32
32
 
33
- ### ts
33
+ ### ts {#ts}
34
34
 
35
35
  > **ts**: `number`
36
36
 
@@ -38,7 +38,7 @@ The timestamp of the sms entry.
38
38
 
39
39
  ***
40
40
 
41
- ### message
41
+ ### message {#message}
42
42
 
43
43
  > **message**: `string`
44
44
 
@@ -46,7 +46,7 @@ The message.
46
46
 
47
47
  ***
48
48
 
49
- ### status
49
+ ### status {#status}
50
50
 
51
51
  > **status**: `string`
52
52
 
@@ -54,8 +54,8 @@ The status.
54
54
 
55
55
  ***
56
56
 
57
- ### error?
57
+ ### error? {#error}
58
58
 
59
- > `optional` **error**: `IError`
59
+ > `optional` **error?**: `IError`
60
60
 
61
61
  The error.
@@ -4,17 +4,17 @@ Options for the entity storage messaging email connector.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### loggingComponentType?
7
+ ### loggingComponentType? {#loggingcomponenttype}
8
8
 
9
- > `optional` **loggingComponentType**: `string`
9
+ > `optional` **loggingComponentType?**: `string`
10
10
 
11
11
  The type of logging component to use, defaults to no logging.
12
12
 
13
13
  ***
14
14
 
15
- ### messagingEmailEntryStorageConnectorType?
15
+ ### messagingEmailEntryStorageConnectorType? {#messagingemailentrystorageconnectortype}
16
16
 
17
- > `optional` **messagingEmailEntryStorageConnectorType**: `string`
17
+ > `optional` **messagingEmailEntryStorageConnectorType?**: `string`
18
18
 
19
19
  The type of entity storage connector to use for the email entries.
20
20
 
@@ -4,17 +4,17 @@ Options for the entity storage messaging push notification connector.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### loggingComponentType?
7
+ ### loggingComponentType? {#loggingcomponenttype}
8
8
 
9
- > `optional` **loggingComponentType**: `string`
9
+ > `optional` **loggingComponentType?**: `string`
10
10
 
11
11
  The type of logging component to use, defaults to no logging.
12
12
 
13
13
  ***
14
14
 
15
- ### messagingDeviceEntryStorageConnectorType?
15
+ ### messagingDeviceEntryStorageConnectorType? {#messagingdeviceentrystorageconnectortype}
16
16
 
17
- > `optional` **messagingDeviceEntryStorageConnectorType**: `string`
17
+ > `optional` **messagingDeviceEntryStorageConnectorType?**: `string`
18
18
 
19
19
  The type of entity storage connector to use for the push notifications entries.
20
20
 
@@ -26,9 +26,9 @@ push-notification-device-entry
26
26
 
27
27
  ***
28
28
 
29
- ### messagingMessageEntryStorageConnectorType?
29
+ ### messagingMessageEntryStorageConnectorType? {#messagingmessageentrystorageconnectortype}
30
30
 
31
- > `optional` **messagingMessageEntryStorageConnectorType**: `string`
31
+ > `optional` **messagingMessageEntryStorageConnectorType?**: `string`
32
32
 
33
33
  The type of entity storage connector to use for the push notifications entries.
34
34
 
@@ -4,17 +4,17 @@ Options for the entity storage messaging SMS connector.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### loggingComponentType?
7
+ ### loggingComponentType? {#loggingcomponenttype}
8
8
 
9
- > `optional` **loggingComponentType**: `string`
9
+ > `optional` **loggingComponentType?**: `string`
10
10
 
11
11
  The type of logging component to use, defaults to no logging.
12
12
 
13
13
  ***
14
14
 
15
- ### messagingSmsEntryStorageConnectorType?
15
+ ### messagingSmsEntryStorageConnectorType? {#messagingsmsentrystorageconnectortype}
16
16
 
17
- > `optional` **messagingSmsEntryStorageConnectorType**: `string`
17
+ > `optional` **messagingSmsEntryStorageConnectorType?**: `string`
18
18
 
19
19
  The type of entity storage connector to use for the sms entries.
20
20
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/messaging-connector-entity-storage",
3
- "version": "0.0.3-next.2",
4
- "description": "Messaging connector implementation using the Entity Storage",
3
+ "version": "0.0.3-next.4",
4
+ "description": "Provides connectors that persist and manage messaging operations using entity storage.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/messaging.git",
7
+ "url": "git+https://github.com/iotaledger/messaging.git",
8
8
  "directory": "packages/messaging-connector-entity-storage"
9
9
  },
10
10
  "author": "adrian.sanchez.sequeira@iota.org",
@@ -17,7 +17,7 @@
17
17
  "@twin.org/core": "next",
18
18
  "@twin.org/entity": "next",
19
19
  "@twin.org/logging-models": "next",
20
- "@twin.org/messaging-models": "0.0.3-next.2",
20
+ "@twin.org/messaging-models": "0.0.3-next.4",
21
21
  "@twin.org/nameof": "next"
22
22
  },
23
23
  "main": "./dist/es/index.js",
@@ -51,7 +51,7 @@
51
51
  "integration"
52
52
  ],
53
53
  "bugs": {
54
- "url": "git+https://github.com/twinfoundation/messaging/issues"
54
+ "url": "git+https://github.com/iotaledger/messaging/issues"
55
55
  },
56
56
  "homepage": "https://twindev.org"
57
57
  }