@futdevpro/nts-dynamo 1.14.8 → 1.14.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/_collections/global-settings.const.d.ts.map +1 -1
- package/build/_collections/global-settings.const.js +1 -0
- package/build/_collections/global-settings.const.js.map +1 -1
- package/build/_models/interfaces/global-settings.interface.d.ts +18 -2
- package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/build/_modules/assistant/_collections/ass-global-settings.const.d.ts +3 -0
- package/build/_modules/assistant/_collections/ass-global-settings.const.d.ts.map +1 -0
- package/build/_modules/assistant/_collections/ass-global-settings.const.js +15 -0
- package/build/_modules/assistant/_collections/ass-global-settings.const.js.map +1 -0
- package/build/_modules/assistant/_collections/ass.util.d.ts +16 -0
- package/build/_modules/assistant/_collections/ass.util.d.ts.map +1 -0
- package/build/_modules/assistant/_collections/ass.util.js +43 -0
- package/build/_modules/assistant/_collections/ass.util.js.map +1 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.d.ts +14 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.js +3 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.js.map +1 -0
- package/build/_modules/assistant/_services/ass-io.control-service.d.ts +23 -0
- package/build/_modules/assistant/_services/ass-io.control-service.d.ts.map +1 -0
- package/build/_modules/assistant/_services/ass-io.control-service.js +59 -0
- package/build/_modules/assistant/_services/ass-io.control-service.js.map +1 -0
- package/build/_modules/assistant/_services/ass-main.control-service.d.ts +15 -0
- package/build/_modules/assistant/_services/ass-main.control-service.d.ts.map +1 -0
- package/build/_modules/assistant/_services/ass-main.control-service.js +12 -0
- package/build/_modules/assistant/_services/ass-main.control-service.js.map +1 -0
- package/build/_modules/assistant/_services/ass.service-base.d.ts +31 -0
- package/build/_modules/assistant/_services/ass.service-base.d.ts.map +1 -0
- package/build/_modules/assistant/_services/ass.service-base.js +56 -0
- package/build/_modules/assistant/_services/ass.service-base.js.map +1 -0
- package/build/_modules/assistant/index.d.ts +7 -0
- package/build/_modules/assistant/index.d.ts.map +1 -0
- package/build/_modules/assistant/index.js +19 -0
- package/build/_modules/assistant/index.js.map +1 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.d.ts +3 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.d.ts.map +1 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.js +14 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.js.map +1 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.d.ts +3 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.d.ts.map +1 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.js +32 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.js.map +1 -0
- package/build/_modules/bot/_collections/bot-operations.util.d.ts +21 -0
- package/build/_modules/bot/_collections/bot-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_collections/bot-operations.util.js +74 -0
- package/build/_modules/bot/_collections/bot-operations.util.js.map +1 -0
- package/build/_modules/bot/_enums/bot-provider.enum.d.ts +7 -0
- package/build/_modules/bot/_enums/bot-provider.enum.d.ts.map +1 -0
- package/build/_modules/bot/_enums/bot-provider.enum.js +11 -0
- package/build/_modules/bot/_enums/bot-provider.enum.js.map +1 -0
- package/build/_modules/bot/_models/bot-channel.interface.d.ts +8 -0
- package/build/_modules/bot/_models/bot-channel.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-channel.interface.js +3 -0
- package/build/_modules/bot/_models/bot-channel.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-command.interface.d.ts +8 -0
- package/build/_modules/bot/_models/bot-command.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-command.interface.js +3 -0
- package/build/_modules/bot/_models/bot-command.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.d.ts +79 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.js +3 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.d.ts +7 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.js +3 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.d.ts +6 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.js +3 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-message.interface.d.ts +15 -0
- package/build/_modules/bot/_models/bot-message.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-message.interface.js +3 -0
- package/build/_modules/bot/_models/bot-message.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-provider.interface.d.ts +60 -0
- package/build/_modules/bot/_models/bot-provider.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-provider.interface.js +3 -0
- package/build/_modules/bot/_models/bot-provider.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-user.interface.d.ts +8 -0
- package/build/_modules/bot/_models/bot-user.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-user.interface.js +3 -0
- package/build/_modules/bot/_models/bot-user.interface.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts +11 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.js +13 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts +5 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js +19 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.d.ts +8 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js +3 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.d.ts +53 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.js +369 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/index.d.ts +5 -0
- package/build/_modules/bot/_modules/discord-bot/index.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/index.js +16 -0
- package/build/_modules/bot/_modules/discord-bot/index.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts +11 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.js +13 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts +7 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.js +3 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.d.ts +40 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.js +116 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/index.d.ts +4 -0
- package/build/_modules/bot/_modules/slack-bot/index.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/index.js +15 -0
- package/build/_modules/bot/_modules/slack-bot/index.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts +11 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.js +13 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts +7 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.js +3 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.d.ts +40 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.js +116 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/index.d.ts +4 -0
- package/build/_modules/bot/_modules/teams-bot/index.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/index.js +15 -0
- package/build/_modules/bot/_modules/teams-bot/index.js.map +1 -0
- package/build/_modules/bot/_services/bot-commands.control-service.d.ts +15 -0
- package/build/_modules/bot/_services/bot-commands.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-commands.control-service.js +72 -0
- package/build/_modules/bot/_services/bot-commands.control-service.js.map +1 -0
- package/build/_modules/bot/_services/bot-io.control-service.d.ts +24 -0
- package/build/_modules/bot/_services/bot-io.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-io.control-service.js +207 -0
- package/build/_modules/bot/_services/bot-io.control-service.js.map +1 -0
- package/build/_modules/bot/_services/bot-main.control-service.d.ts +42 -0
- package/build/_modules/bot/_services/bot-main.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-main.control-service.js +223 -0
- package/build/_modules/bot/_services/bot-main.control-service.js.map +1 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.d.ts +5 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.js +28 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.js.map +1 -0
- package/build/_modules/bot/_services/bot-routines.control-service.d.ts +17 -0
- package/build/_modules/bot/_services/bot-routines.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-routines.control-service.js +40 -0
- package/build/_modules/bot/_services/bot-routines.control-service.js.map +1 -0
- package/build/_modules/bot/index.d.ts +21 -0
- package/build/_modules/bot/index.d.ts.map +1 -0
- package/build/_modules/bot/index.js +35 -0
- package/build/_modules/bot/index.js.map +1 -0
- package/build/_modules/defaults/_models/default-user.data-model.d.ts +20 -0
- package/build/_modules/defaults/_models/default-user.data-model.d.ts.map +1 -0
- package/build/_modules/defaults/_models/default-user.data-model.js +73 -0
- package/build/_modules/defaults/_models/default-user.data-model.js.map +1 -0
- package/build/_modules/defaults/_services/default-auth.service.d.ts +51 -0
- package/build/_modules/defaults/_services/default-auth.service.d.ts.map +1 -0
- package/build/_modules/defaults/_services/default-auth.service.js +159 -0
- package/build/_modules/defaults/_services/default-auth.service.js.map +1 -0
- package/build/_modules/defaults/_services/default-socket-events.service.d.ts +24 -0
- package/build/_modules/defaults/_services/default-socket-events.service.d.ts.map +1 -0
- package/build/_modules/defaults/_services/default-socket-events.service.js +61 -0
- package/build/_modules/defaults/_services/default-socket-events.service.js.map +1 -0
- package/build/_modules/defaults/_services/default-user.data-service.d.ts +25 -0
- package/build/_modules/defaults/_services/default-user.data-service.d.ts.map +1 -0
- package/build/_modules/defaults/_services/default-user.data-service.js +88 -0
- package/build/_modules/defaults/_services/default-user.data-service.js.map +1 -0
- package/build/_modules/defaults/index.d.ts +5 -0
- package/build/_modules/defaults/index.d.ts.map +1 -0
- package/build/_modules/defaults/index.js +16 -0
- package/build/_modules/defaults/index.js.map +1 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.d.ts +6 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.d.ts.map +1 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.js +27 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.js.map +1 -0
- package/build/_modules/messaging/_collections/msg.util.d.ts +25 -0
- package/build/_modules/messaging/_collections/msg.util.d.ts.map +1 -0
- package/build/_modules/messaging/_collections/msg.util.js +63 -0
- package/build/_modules/messaging/_collections/msg.util.js.map +1 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.d.ts +23 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.d.ts.map +1 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.js +32 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.js.map +1 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts +38 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.js +3 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.js.map +1 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.d.ts +29 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.js +110 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-events.service.d.ts +62 -0
- package/build/_modules/messaging/_services/msg-events.service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-events.service.js +204 -0
- package/build/_modules/messaging/_services/msg-events.service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.d.ts +26 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.js +126 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-main.control-service.d.ts +62 -0
- package/build/_modules/messaging/_services/msg-main.control-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-main.control-service.js +408 -0
- package/build/_modules/messaging/_services/msg-main.control-service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-message.data-service.d.ts +29 -0
- package/build/_modules/messaging/_services/msg-message.data-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-message.data-service.js +104 -0
- package/build/_modules/messaging/_services/msg-message.data-service.js.map +1 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.d.ts +8 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.d.ts.map +1 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.js +21 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.js.map +1 -0
- package/build/_modules/messaging/index.d.ts +13 -0
- package/build/_modules/messaging/index.d.ts.map +1 -0
- package/build/_modules/messaging/index.js +30 -0
- package/build/_modules/messaging/index.js.map +1 -0
- package/build/_modules/messaging/messaging.controller.d.ts +13 -0
- package/build/_modules/messaging/messaging.controller.d.ts.map +1 -0
- package/build/_modules/messaging/messaging.controller.js +257 -0
- package/build/_modules/messaging/messaging.controller.js.map +1 -0
- package/package.json +71 -3
- package/src/_collections/global-settings.const.ts +2 -0
- package/src/_models/interfaces/global-settings.interface.ts +20 -2
- package/src/_modules/assistant/_collections/ass-global-settings.const.ts +13 -0
- package/src/_modules/assistant/_collections/ass.util.ts +50 -0
- package/src/_modules/assistant/_models/ass-global-settings.interface.ts +15 -0
- package/src/_modules/assistant/_services/ass-io.control-service.ts +100 -0
- package/src/_modules/assistant/_services/ass-main.control-service.ts +38 -0
- package/src/_modules/assistant/_services/ass.service-base.ts +92 -0
- package/src/_modules/assistant/index.ts +19 -0
- package/src/_modules/bot/_collections/bot-default-commands.const.ts +12 -0
- package/src/_modules/bot/_collections/bot-global-settings.const.ts +39 -0
- package/src/_modules/bot/_collections/bot-operations.util.ts +149 -0
- package/src/_modules/bot/_enums/bot-provider.enum.ts +6 -0
- package/src/_modules/bot/_models/bot-channel.interface.ts +7 -0
- package/src/_modules/bot/_models/bot-command.interface.ts +8 -0
- package/src/_modules/bot/_models/bot-global-settings.interface.ts +87 -0
- package/src/_modules/bot/_models/bot-last-mention-date.interface.ts +6 -0
- package/src/_modules/bot/_models/bot-last-message-date.interface.ts +5 -0
- package/src/_modules/bot/_models/bot-message.interface.ts +14 -0
- package/src/_modules/bot/_models/bot-provider.interface.ts +80 -0
- package/src/_modules/bot/_models/bot-user.interface.ts +7 -0
- package/src/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.ts +18 -0
- package/src/_modules/bot/_modules/discord-bot/_collections/dib.util.ts +20 -0
- package/src/_modules/bot/_modules/discord-bot/_models/dib-platform.types.ts +9 -0
- package/src/_modules/bot/_modules/discord-bot/_services/dib-provider.service.ts +462 -0
- package/src/_modules/bot/_modules/discord-bot/index.ts +15 -0
- package/src/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.ts +18 -0
- package/src/_modules/bot/_modules/slack-bot/_models/slb-platform.types.ts +9 -0
- package/src/_modules/bot/_modules/slack-bot/_services/slb-provider.service.ts +152 -0
- package/src/_modules/bot/_modules/slack-bot/index.ts +14 -0
- package/src/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.ts +18 -0
- package/src/_modules/bot/_modules/teams-bot/_models/teb-platform.types.ts +9 -0
- package/src/_modules/bot/_modules/teams-bot/_services/teb-provider.service.ts +152 -0
- package/src/_modules/bot/_modules/teams-bot/index.ts +14 -0
- package/src/_modules/bot/_services/bot-commands.control-service.ts +126 -0
- package/src/_modules/bot/_services/bot-io.control-service.ts +325 -0
- package/src/_modules/bot/_services/bot-main.control-service.ts +344 -0
- package/src/_modules/bot/_services/bot-provider-factory.service.ts +30 -0
- package/src/_modules/bot/_services/bot-routines.control-service.ts +83 -0
- package/src/_modules/bot/index.ts +36 -0
- package/src/_modules/defaults/_models/default-user.data-model.ts +72 -0
- package/src/_modules/defaults/_services/default-auth.service.ts +177 -0
- package/src/_modules/defaults/_services/default-socket-events.service.ts +61 -0
- package/src/_modules/defaults/_services/default-user.data-service.ts +98 -0
- package/src/_modules/defaults/index.ts +14 -0
- package/src/_modules/messaging/_collections/msg-global-settings.const.ts +27 -0
- package/src/_modules/messaging/_collections/msg.util.ts +83 -0
- package/src/_modules/messaging/_enums/msg-event-key.enum.ts +31 -0
- package/src/_modules/messaging/_models/msg-global-settings.interface.ts +49 -0
- package/src/_modules/messaging/_services/msg-conversation.data-service.ts +146 -0
- package/src/_modules/messaging/_services/msg-events.service.ts +267 -0
- package/src/_modules/messaging/_services/msg-integration.control-service.ts +179 -0
- package/src/_modules/messaging/_services/msg-main.control-service.ts +548 -0
- package/src/_modules/messaging/_services/msg-message.data-service.ts +129 -0
- package/src/_modules/messaging/get-messaging-routing-module.util.ts +26 -0
- package/src/_modules/messaging/index.ts +33 -0
- package/src/_modules/messaging/messaging.controller.ts +370 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Messaging Module Global Settings
|
|
3
|
+
*/
|
|
4
|
+
export interface DyNTS_Msg_Global_Settings {
|
|
5
|
+
/** Enable real-time socket events for messages */
|
|
6
|
+
enableRealtimeEvents?: boolean;
|
|
7
|
+
|
|
8
|
+
/** Maximum messages per conversation to load */
|
|
9
|
+
maxMessagesPerLoad?: number;
|
|
10
|
+
|
|
11
|
+
/** Enable conversation threading */
|
|
12
|
+
enableThreading?: boolean;
|
|
13
|
+
|
|
14
|
+
/** Enable message reactions */
|
|
15
|
+
enableReactions?: boolean;
|
|
16
|
+
|
|
17
|
+
/** Enable file attachments */
|
|
18
|
+
enableAttachments?: boolean;
|
|
19
|
+
|
|
20
|
+
/** Maximum attachment size in bytes */
|
|
21
|
+
maxAttachmentSize?: number;
|
|
22
|
+
|
|
23
|
+
/** Enable mentions */
|
|
24
|
+
enableMentions?: boolean;
|
|
25
|
+
|
|
26
|
+
/** Enable read receipts */
|
|
27
|
+
enableReadReceipts?: boolean;
|
|
28
|
+
|
|
29
|
+
/** Enable typing indicators */
|
|
30
|
+
enableTypingIndicators?: boolean;
|
|
31
|
+
|
|
32
|
+
/** Integration settings */
|
|
33
|
+
integration?: {
|
|
34
|
+
/** Auto-sync bot messages to messaging system */
|
|
35
|
+
syncBotMessages?: boolean;
|
|
36
|
+
|
|
37
|
+
/** Auto-sync assistant messages to messaging system */
|
|
38
|
+
syncAssistantMessages?: boolean;
|
|
39
|
+
|
|
40
|
+
/** Enable agent process visualization */
|
|
41
|
+
enableAgentProcessViz?: boolean;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** Retry settings for failed messages */
|
|
45
|
+
retry?: {
|
|
46
|
+
maxRetries?: number;
|
|
47
|
+
retryDelay?: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { DyFM_Error, DyFM_DBFilter } from '@futdevpro/fsm-dynamo';
|
|
2
|
+
import {
|
|
3
|
+
DyFM_Msg_Conversation,
|
|
4
|
+
DyFM_msgConversation_dataParams,
|
|
5
|
+
DyFM_Msg_Participant,
|
|
6
|
+
} from '@futdevpro/fsm-dynamo/messaging';
|
|
7
|
+
|
|
8
|
+
import { DyNTS_DataService } from '../../../_services/base/data.service';
|
|
9
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Conversation Data Service
|
|
13
|
+
* Handles CRUD operations for conversations
|
|
14
|
+
*/
|
|
15
|
+
export class DyNTS_Msg_Conversation_DataService extends DyNTS_DataService<DyFM_Msg_Conversation> {
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
set: {
|
|
19
|
+
conversation?: DyFM_Msg_Conversation;
|
|
20
|
+
issuer: string;
|
|
21
|
+
}
|
|
22
|
+
) {
|
|
23
|
+
super(
|
|
24
|
+
new DyFM_Msg_Conversation(set?.conversation),
|
|
25
|
+
DyFM_msgConversation_dataParams,
|
|
26
|
+
set.issuer
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get conversations for a user
|
|
32
|
+
*/
|
|
33
|
+
async getUserConversations(userId: string): Promise<DyFM_Msg_Conversation[]> {
|
|
34
|
+
try {
|
|
35
|
+
await this.dataDBService
|
|
36
|
+
.find({
|
|
37
|
+
'participants.userId': userId,
|
|
38
|
+
__deleted: { $exists: false },
|
|
39
|
+
} as DyFM_DBFilter<DyFM_Msg_Conversation>)
|
|
40
|
+
.then((res: DyFM_Msg_Conversation[]) => {
|
|
41
|
+
this.dataList = res.sort((a, b) => (b.lastMessageAt?.getTime() || 0) - (a.lastMessageAt?.getTime() || 0));
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
return this.dataList;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
throw new DyFM_Error({
|
|
47
|
+
...this.getDefaultErrorSettings('getUserConversations', error),
|
|
48
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-MSG-GUC`,
|
|
49
|
+
userMessage: 'Failed to retrieve user conversations.',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Add participant to conversation
|
|
56
|
+
*/
|
|
57
|
+
async addParticipant(
|
|
58
|
+
conversationId: string,
|
|
59
|
+
participant: DyFM_Msg_Participant
|
|
60
|
+
): Promise<void> {
|
|
61
|
+
try {
|
|
62
|
+
const conversation = await this.getDataById(conversationId);
|
|
63
|
+
|
|
64
|
+
if (!conversation) {
|
|
65
|
+
throw new Error('Conversation not found');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!conversation.participants) {
|
|
69
|
+
conversation.participants = [];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Check if participant already exists
|
|
73
|
+
const exists = conversation.participants.some(
|
|
74
|
+
p => p.userId === participant.userId
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
if (!exists) {
|
|
78
|
+
conversation.participants.push(participant);
|
|
79
|
+
await this.saveData(conversation);
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
throw new DyFM_Error({
|
|
83
|
+
...this.getDefaultErrorSettings('addParticipant', error),
|
|
84
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-MSG-AP`,
|
|
85
|
+
userMessage: 'Failed to add participant to conversation.',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Remove participant from conversation
|
|
92
|
+
*/
|
|
93
|
+
async removeParticipant(
|
|
94
|
+
conversationId: string,
|
|
95
|
+
userId: string
|
|
96
|
+
): Promise<void> {
|
|
97
|
+
try {
|
|
98
|
+
const conversation = await this.getDataById(conversationId);
|
|
99
|
+
|
|
100
|
+
if (!conversation) {
|
|
101
|
+
throw new Error('Conversation not found');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
conversation.participants = conversation.participants?.filter(
|
|
105
|
+
p => p.userId !== userId
|
|
106
|
+
) || [];
|
|
107
|
+
|
|
108
|
+
await this.saveData(conversation);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
throw new DyFM_Error({
|
|
111
|
+
...this.getDefaultErrorSettings('removeParticipant', error),
|
|
112
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-MSG-RP`,
|
|
113
|
+
userMessage: 'Failed to remove participant from conversation.',
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Update last message info
|
|
120
|
+
*/
|
|
121
|
+
async updateLastMessage(
|
|
122
|
+
conversationId: string,
|
|
123
|
+
messageId: string,
|
|
124
|
+
messagePreview: string
|
|
125
|
+
): Promise<void> {
|
|
126
|
+
try {
|
|
127
|
+
const conversation = await this.getDataById(conversationId);
|
|
128
|
+
|
|
129
|
+
if (!conversation) {
|
|
130
|
+
throw new Error('Conversation not found');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
conversation.lastMessageId = messageId;
|
|
134
|
+
conversation.lastMessageAt = new Date();
|
|
135
|
+
conversation.lastMessagePreview = messagePreview;
|
|
136
|
+
|
|
137
|
+
await this.saveData(conversation);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
throw new DyFM_Error({
|
|
140
|
+
...this.getDefaultErrorSettings('updateLastMessage', error),
|
|
141
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-MSG-ULM`,
|
|
142
|
+
userMessage: 'Failed to update conversation last message.',
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { DyNTS_SingletonService } from '../../../_services/base/singleton.service';
|
|
2
|
+
import { DyNTS_GlobalService } from '../../../_services/core/global.service';
|
|
3
|
+
import { DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
4
|
+
import { DyNTS_Msg_EventKey } from '../_enums/msg-event-key.enum';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Messaging Events Service
|
|
8
|
+
* Handles real-time socket events for messaging
|
|
9
|
+
*/
|
|
10
|
+
export class DyNTS_Msg_Events_Service extends DyNTS_SingletonService {
|
|
11
|
+
|
|
12
|
+
static getInstance(): DyNTS_Msg_Events_Service {
|
|
13
|
+
return DyNTS_Msg_Events_Service.getSingletonInstance();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get socket server instance
|
|
18
|
+
* Override this in extended classes to provide custom socket server
|
|
19
|
+
*/
|
|
20
|
+
protected getSocketServer(): any | null {
|
|
21
|
+
// Default: no socket server (messaging works without real-time events)
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Emit message sent event
|
|
27
|
+
*/
|
|
28
|
+
emitMessageSent(message: any, conversationId: string): void {
|
|
29
|
+
try {
|
|
30
|
+
const socketServer = this.getSocketServer();
|
|
31
|
+
|
|
32
|
+
if (socketServer && socketServer.emitToRoom) {
|
|
33
|
+
// Emit to conversation room
|
|
34
|
+
socketServer.emitToRoom(
|
|
35
|
+
`conversation:${conversationId}`,
|
|
36
|
+
DyNTS_Msg_EventKey.messageSent,
|
|
37
|
+
message
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
} catch (error) {
|
|
41
|
+
DyFM_Log.error('Failed to emit message sent event', error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Emit message updated event
|
|
47
|
+
*/
|
|
48
|
+
emitMessageUpdated(message: any, conversationId: string): void {
|
|
49
|
+
try {
|
|
50
|
+
const socketServer = this.getSocketServer();
|
|
51
|
+
|
|
52
|
+
if (socketServer && socketServer.emitToRoom) {
|
|
53
|
+
socketServer.emitToRoom(
|
|
54
|
+
`conversation:${conversationId}`,
|
|
55
|
+
DyNTS_Msg_EventKey.messageUpdated,
|
|
56
|
+
message
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
DyFM_Log.error('Failed to emit message updated event', error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Emit typing indicator
|
|
66
|
+
*/
|
|
67
|
+
emitTypingIndicator(
|
|
68
|
+
userId: string,
|
|
69
|
+
conversationId: string,
|
|
70
|
+
isTyping: boolean
|
|
71
|
+
): void {
|
|
72
|
+
try {
|
|
73
|
+
const socketServer = this.getSocketServer();
|
|
74
|
+
|
|
75
|
+
if (socketServer && socketServer.emitToRoom) {
|
|
76
|
+
const eventKey = isTyping
|
|
77
|
+
? DyNTS_Msg_EventKey.typingStart
|
|
78
|
+
: DyNTS_Msg_EventKey.typingStop;
|
|
79
|
+
|
|
80
|
+
socketServer.emitToRoom(
|
|
81
|
+
`conversation:${conversationId}`,
|
|
82
|
+
eventKey,
|
|
83
|
+
{ userId, conversationId }
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
} catch (error) {
|
|
87
|
+
DyFM_Log.error('Failed to emit typing indicator', error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Emit conversation created event
|
|
93
|
+
*/
|
|
94
|
+
emitConversationCreated(conversation: any, participantIds: string[]): void {
|
|
95
|
+
try {
|
|
96
|
+
const socketServer = this.getSocketServer();
|
|
97
|
+
|
|
98
|
+
if (socketServer && socketServer.emitToUser) {
|
|
99
|
+
// Emit to each participant
|
|
100
|
+
participantIds.forEach(userId => {
|
|
101
|
+
socketServer.emitToUser(
|
|
102
|
+
userId,
|
|
103
|
+
DyNTS_Msg_EventKey.conversationCreated,
|
|
104
|
+
conversation
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
} catch (error) {
|
|
109
|
+
DyFM_Log.error('Failed to emit conversation created event', error);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Emit message deleted event
|
|
115
|
+
*/
|
|
116
|
+
emitMessageDeleted(messageId: string, conversationId: string): void {
|
|
117
|
+
try {
|
|
118
|
+
const socketServer = this.getSocketServer();
|
|
119
|
+
|
|
120
|
+
if (socketServer && socketServer.emitToRoom) {
|
|
121
|
+
socketServer.emitToRoom(
|
|
122
|
+
`conversation:${conversationId}`,
|
|
123
|
+
DyNTS_Msg_EventKey.messageDeleted,
|
|
124
|
+
{ messageId, conversationId }
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
} catch (error) {
|
|
128
|
+
DyFM_Log.error('Failed to emit message deleted event', error);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Emit conversation updated event
|
|
134
|
+
*/
|
|
135
|
+
emitConversationUpdated(conversation: any): void {
|
|
136
|
+
try {
|
|
137
|
+
const socketServer = this.getSocketServer();
|
|
138
|
+
|
|
139
|
+
if (socketServer && socketServer.emitToRoom) {
|
|
140
|
+
const participantIds = conversation.participants?.map((p: any) => p.userId) || [];
|
|
141
|
+
participantIds.forEach(userId => {
|
|
142
|
+
socketServer.emitToUser(
|
|
143
|
+
userId,
|
|
144
|
+
DyNTS_Msg_EventKey.conversationUpdated,
|
|
145
|
+
conversation
|
|
146
|
+
);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
} catch (error) {
|
|
150
|
+
DyFM_Log.error('Failed to emit conversation updated event', error);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Emit conversation deleted event
|
|
156
|
+
*/
|
|
157
|
+
emitConversationDeleted(conversationId: string): void {
|
|
158
|
+
try {
|
|
159
|
+
const socketServer = this.getSocketServer();
|
|
160
|
+
|
|
161
|
+
if (socketServer && socketServer.emitToRoom) {
|
|
162
|
+
socketServer.emitToRoom(
|
|
163
|
+
`conversation:${conversationId}`,
|
|
164
|
+
DyNTS_Msg_EventKey.conversationDeleted,
|
|
165
|
+
{ conversationId }
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
} catch (error) {
|
|
169
|
+
DyFM_Log.error('Failed to emit conversation deleted event', error);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Emit participant added event
|
|
175
|
+
*/
|
|
176
|
+
emitParticipantAdded(conversationId: string, userId: string): void {
|
|
177
|
+
try {
|
|
178
|
+
const socketServer = this.getSocketServer();
|
|
179
|
+
|
|
180
|
+
if (socketServer && socketServer.emitToUser) {
|
|
181
|
+
socketServer.emitToUser(
|
|
182
|
+
userId,
|
|
183
|
+
DyNTS_Msg_EventKey.participantAdded,
|
|
184
|
+
{ conversationId, userId }
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
} catch (error) {
|
|
188
|
+
DyFM_Log.error('Failed to emit participant added event', error);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Emit participant removed event
|
|
194
|
+
*/
|
|
195
|
+
emitParticipantRemoved(conversationId: string, userId: string): void {
|
|
196
|
+
try {
|
|
197
|
+
const socketServer = this.getSocketServer();
|
|
198
|
+
|
|
199
|
+
if (socketServer && socketServer.emitToUser) {
|
|
200
|
+
socketServer.emitToUser(
|
|
201
|
+
userId,
|
|
202
|
+
DyNTS_Msg_EventKey.participantRemoved,
|
|
203
|
+
{ conversationId, userId }
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
} catch (error) {
|
|
207
|
+
DyFM_Log.error('Failed to emit participant removed event', error);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Emit message read event
|
|
213
|
+
*/
|
|
214
|
+
emitMessageRead(messageId: string, userId: string, conversationId: string): void {
|
|
215
|
+
try {
|
|
216
|
+
const socketServer = this.getSocketServer();
|
|
217
|
+
|
|
218
|
+
if (socketServer && socketServer.emitToRoom) {
|
|
219
|
+
socketServer.emitToRoom(
|
|
220
|
+
`conversation:${conversationId}`,
|
|
221
|
+
DyNTS_Msg_EventKey.messageRead,
|
|
222
|
+
{ messageId, userId, conversationId }
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
} catch (error) {
|
|
226
|
+
DyFM_Log.error('Failed to emit message read event', error);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Emit reaction added event
|
|
232
|
+
*/
|
|
233
|
+
emitReactionAdded(messageId: string, reaction: any): void {
|
|
234
|
+
try {
|
|
235
|
+
const socketServer = this.getSocketServer();
|
|
236
|
+
|
|
237
|
+
if (socketServer && socketServer.emitToRoom) {
|
|
238
|
+
socketServer.emitToRoom(
|
|
239
|
+
`conversation:${reaction.conversationId || 'unknown'}`,
|
|
240
|
+
DyNTS_Msg_EventKey.reactionAdded,
|
|
241
|
+
{ messageId, reaction }
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
} catch (error) {
|
|
245
|
+
DyFM_Log.error('Failed to emit reaction added event', error);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Emit reaction removed event
|
|
251
|
+
*/
|
|
252
|
+
emitReactionRemoved(messageId: string, userId: string, emoji: string): void {
|
|
253
|
+
try {
|
|
254
|
+
const socketServer = this.getSocketServer();
|
|
255
|
+
|
|
256
|
+
if (socketServer && socketServer.emitToRoom) {
|
|
257
|
+
socketServer.emitToRoom(
|
|
258
|
+
`conversation:${userId}`, // This should be conversationId, but we don't have it
|
|
259
|
+
DyNTS_Msg_EventKey.reactionRemoved,
|
|
260
|
+
{ messageId, userId, emoji }
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
} catch (error) {
|
|
264
|
+
DyFM_Log.error('Failed to emit reaction removed event', error);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { DyNTS_SingletonService } from '../../../_services/base/singleton.service';
|
|
2
|
+
import { DyFM_Error, DyFM_Log, DyFM_DBFilter } from '@futdevpro/fsm-dynamo';
|
|
3
|
+
import { DyFM_Msg_Message, DyFM_Msg_Conversation } from '@futdevpro/fsm-dynamo/messaging';
|
|
4
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
5
|
+
import { DyNTS_Msg_Message_DataService } from './msg-message.data-service';
|
|
6
|
+
import { DyNTS_Msg_Conversation_DataService } from './msg-conversation.data-service';
|
|
7
|
+
import { DyNTS_Msg_Events_Service } from './msg-events.service';
|
|
8
|
+
import { DyNTS_Msg_Util } from '../_collections/msg.util';
|
|
9
|
+
import { DyNTS_Bot_Message } from '../../bot/_models/bot-message.interface';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Messaging Integration Control Service
|
|
13
|
+
* Handles integration between messaging system and bot/assistant modules
|
|
14
|
+
*/
|
|
15
|
+
export class DyNTS_Msg_Integration_ControlService extends DyNTS_SingletonService {
|
|
16
|
+
|
|
17
|
+
static getInstance(): DyNTS_Msg_Integration_ControlService {
|
|
18
|
+
return DyNTS_Msg_Integration_ControlService.getSingletonInstance();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private eventsService = DyNTS_Msg_Events_Service.getInstance();
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Sync bot message to messaging system
|
|
25
|
+
* Called from bot IO when message is received
|
|
26
|
+
*/
|
|
27
|
+
async syncBotMessage<T>(
|
|
28
|
+
botMessage: DyNTS_Bot_Message<T>,
|
|
29
|
+
conversationId: string,
|
|
30
|
+
issuer: string
|
|
31
|
+
): Promise<DyFM_Msg_Message> {
|
|
32
|
+
try {
|
|
33
|
+
if (!DyNTS_global_settings.messaging_settings?.integration?.syncBotMessages) {
|
|
34
|
+
throw new Error('Bot message sync is disabled');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Convert bot message to messaging format
|
|
38
|
+
const msgMessage = DyNTS_Msg_Util.botMessageToMsgMessage(
|
|
39
|
+
botMessage,
|
|
40
|
+
conversationId,
|
|
41
|
+
issuer
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// Save to database
|
|
45
|
+
const messageService = new DyNTS_Msg_Message_DataService({
|
|
46
|
+
message: msgMessage,
|
|
47
|
+
issuer,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
await messageService.saveData(messageService.data, false, false);
|
|
51
|
+
|
|
52
|
+
// Update conversation last message
|
|
53
|
+
const conversationService = new DyNTS_Msg_Conversation_DataService({
|
|
54
|
+
issuer,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
await conversationService.updateLastMessage(
|
|
58
|
+
conversationId,
|
|
59
|
+
messageService.data._id!,
|
|
60
|
+
msgMessage.content.substring(0, 100)
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// Emit real-time event
|
|
64
|
+
this.eventsService.emitMessageSent(messageService.data, conversationId);
|
|
65
|
+
|
|
66
|
+
return messageService.data;
|
|
67
|
+
} catch (error) {
|
|
68
|
+
DyFM_Log.error('Failed to sync bot message', error);
|
|
69
|
+
throw new DyFM_Error({
|
|
70
|
+
...this.getDefaultErrorSettings('syncBotMessage', error, issuer),
|
|
71
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-MSG-SBM`,
|
|
72
|
+
userMessage: 'Failed to sync bot message to messaging system.',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Sync assistant response to messaging system
|
|
79
|
+
* Called from assistant IO when AI responds
|
|
80
|
+
*/
|
|
81
|
+
async syncAssistantMessage(
|
|
82
|
+
content: string,
|
|
83
|
+
conversationId: string,
|
|
84
|
+
aiProvider: string,
|
|
85
|
+
aiModel: string,
|
|
86
|
+
senderId: string,
|
|
87
|
+
issuer: string
|
|
88
|
+
): Promise<DyFM_Msg_Message> {
|
|
89
|
+
try {
|
|
90
|
+
if (!DyNTS_global_settings.messaging_settings?.integration?.syncAssistantMessages) {
|
|
91
|
+
throw new Error('Assistant message sync is disabled');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Create AI message
|
|
95
|
+
const msgMessage = DyNTS_Msg_Util.createAIMessage(
|
|
96
|
+
conversationId,
|
|
97
|
+
content,
|
|
98
|
+
aiProvider,
|
|
99
|
+
aiModel,
|
|
100
|
+
senderId,
|
|
101
|
+
issuer
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
// Save to database
|
|
105
|
+
const messageService = new DyNTS_Msg_Message_DataService({
|
|
106
|
+
message: msgMessage,
|
|
107
|
+
issuer,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
await messageService.saveData(messageService.data, false, false);
|
|
111
|
+
|
|
112
|
+
// Update conversation last message
|
|
113
|
+
const conversationService = new DyNTS_Msg_Conversation_DataService({
|
|
114
|
+
issuer,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
await conversationService.updateLastMessage(
|
|
118
|
+
conversationId,
|
|
119
|
+
messageService.data._id!,
|
|
120
|
+
content.substring(0, 100)
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
// Emit real-time event
|
|
124
|
+
this.eventsService.emitMessageSent(messageService.data, conversationId);
|
|
125
|
+
|
|
126
|
+
return messageService.data;
|
|
127
|
+
} catch (error) {
|
|
128
|
+
DyFM_Log.error('Failed to sync assistant message', error);
|
|
129
|
+
throw new DyFM_Error({
|
|
130
|
+
...this.getDefaultErrorSettings('syncAssistantMessage', error, issuer),
|
|
131
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-MSG-SAM`,
|
|
132
|
+
userMessage: 'Failed to sync assistant message to messaging system.',
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Find or create conversation for bot channel
|
|
139
|
+
*/
|
|
140
|
+
async findOrCreateBotConversation(
|
|
141
|
+
channelId: string,
|
|
142
|
+
platformSource: string,
|
|
143
|
+
issuer: string
|
|
144
|
+
): Promise<DyFM_Msg_Conversation> {
|
|
145
|
+
try {
|
|
146
|
+
const conversationService = new DyNTS_Msg_Conversation_DataService({
|
|
147
|
+
issuer,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// Try to find existing conversation
|
|
151
|
+
const existingConversation = await conversationService.dataDBService.findOne({
|
|
152
|
+
platformChannelId: channelId,
|
|
153
|
+
platformSource,
|
|
154
|
+
__deleted: { $exists: false },
|
|
155
|
+
} as DyFM_DBFilter<DyFM_Msg_Conversation>);
|
|
156
|
+
|
|
157
|
+
if (existingConversation) {
|
|
158
|
+
conversationService.data = existingConversation;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Create new if not found
|
|
162
|
+
if (!conversationService.data._id) {
|
|
163
|
+
conversationService.data.platformChannelId = channelId;
|
|
164
|
+
conversationService.data.platformSource = platformSource;
|
|
165
|
+
conversationService.data.participants = [];
|
|
166
|
+
|
|
167
|
+
await conversationService.saveData(conversationService.data, false, false);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return conversationService.data;
|
|
171
|
+
} catch (error) {
|
|
172
|
+
throw new DyFM_Error({
|
|
173
|
+
...this.getDefaultErrorSettings('findOrCreateBotConversation', error, issuer),
|
|
174
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-MSG-FCBC`,
|
|
175
|
+
userMessage: 'Failed to find or create bot conversation.',
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|