@messenger-box/platform-server 10.0.3-alpha.6 → 10.0.3-alpha.62
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/lib/containers/containers.js +3 -1
- package/lib/containers/containers.js.map +1 -1
- package/lib/containers/context-services-from-container.d.ts +2 -2
- package/lib/containers/context-services-from-container.js +2 -1
- package/lib/containers/context-services-from-container.js.map +1 -1
- package/lib/graphql/resolvers/channel-member.d.ts +3 -3
- package/lib/graphql/resolvers/channel-member.js +30 -5
- package/lib/graphql/resolvers/channel-member.js.map +1 -1
- package/lib/graphql/resolvers/channel.d.ts +3 -3
- package/lib/graphql/resolvers/channel.js +275 -53
- package/lib/graphql/resolvers/channel.js.map +1 -1
- package/lib/graphql/resolvers/extended-token-account.d.ts +3 -32
- package/lib/graphql/resolvers/extended-token-account.js +90 -23
- package/lib/graphql/resolvers/extended-token-account.js.map +1 -1
- package/lib/graphql/resolvers/index.d.ts +1 -31
- package/lib/graphql/resolvers/post-thread.d.ts +2 -3
- package/lib/graphql/resolvers/post-thread.js +294 -132
- package/lib/graphql/resolvers/post-thread.js.map +1 -1
- package/lib/graphql/resolvers/post.d.ts +2 -3
- package/lib/graphql/resolvers/post.js +697 -234
- package/lib/graphql/resolvers/post.js.map +1 -1
- package/lib/graphql/resolvers/reaction.d.ts +3 -3
- package/lib/graphql/resolvers/reaction.js +96 -14
- package/lib/graphql/resolvers/reaction.js.map +1 -1
- package/lib/graphql/schema/channel-member.graphql +110 -21
- package/lib/graphql/schema/channel-member.graphql.js +1 -1
- package/lib/graphql/schema/channel.graphql +331 -38
- package/lib/graphql/schema/channel.graphql.js +1 -1
- package/lib/graphql/schema/post-thread.graphql +166 -21
- package/lib/graphql/schema/post-thread.graphql.js +1 -1
- package/lib/graphql/schema/post.graphql +280 -40
- package/lib/graphql/schema/post.graphql.js +1 -1
- package/lib/graphql/schema/reaction.graphql +71 -13
- package/lib/graphql/schema/reaction.graphql.js +1 -1
- package/lib/graphql/schema/services.graphql +2 -0
- package/lib/graphql/schema/users.graphql +76 -13
- package/lib/graphql/schema/users.graphql.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/interfaces/services.d.ts +1 -2
- package/lib/migrations/dbMigrations/AddPostsConfigurationsMigration.d.ts +17 -0
- package/lib/migrations/dbMigrations/AddPostsConfigurationsMigration.js +44 -0
- package/lib/migrations/dbMigrations/AddPostsConfigurationsMigration.js.map +1 -0
- package/lib/migrations/dbMigrations/index.d.ts +1 -0
- package/lib/migrations/index.d.ts +1 -0
- package/lib/migrations/mail-template-migration.js +1 -1
- package/lib/migrations/message-notification-template-migration.d.ts +1 -1
- package/lib/migrations/message-notification-template-migration.js +1 -1
- package/lib/plugins/channel-moleculer-service.d.ts +21 -1
- package/lib/plugins/channel-moleculer-service.js +417 -115
- package/lib/plugins/channel-moleculer-service.js.map +1 -1
- package/lib/plugins/extended-token-account-moleculer-service.d.ts +25 -1
- package/lib/plugins/extended-token-account-moleculer-service.js +348 -22
- package/lib/plugins/extended-token-account-moleculer-service.js.map +1 -1
- package/lib/plugins/messenger-notification-moleculer-service.d.ts +27 -3
- package/lib/plugins/messenger-notification-moleculer-service.js +404 -58
- package/lib/plugins/messenger-notification-moleculer-service.js.map +1 -1
- package/lib/plugins/post-moleculer-service.d.ts +85 -21
- package/lib/plugins/post-moleculer-service.js +986 -256
- package/lib/plugins/post-moleculer-service.js.map +1 -1
- package/lib/plugins/post-thread-moleculer-service.d.ts +33 -1
- package/lib/plugins/post-thread-moleculer-service.js +326 -8
- package/lib/plugins/post-thread-moleculer-service.js.map +1 -1
- package/lib/plugins/reaction-moleculer-service.js +1 -1
- package/lib/plugins/reaction-moleculer-service.js.map +1 -1
- package/lib/preferences/settings/post-settings.d.ts +2 -0
- package/lib/preferences/settings/post-settings.js +47 -9
- package/lib/preferences/settings/post-settings.js.map +1 -1
- package/lib/services/channel-service.d.ts +178 -33
- package/lib/services/channel-service.js +735 -276
- package/lib/services/channel-service.js.map +1 -1
- package/lib/services/extended-token-account-service.d.ts +130 -14
- package/lib/services/extended-token-account-service.js +462 -52
- package/lib/services/extended-token-account-service.js.map +1 -1
- package/lib/services/messenger-notification-service.d.ts +106 -13
- package/lib/services/messenger-notification-service.js +824 -442
- package/lib/services/messenger-notification-service.js.map +1 -1
- package/lib/services/post-service.d.ts +172 -16
- package/lib/services/post-service.js +580 -113
- package/lib/services/post-service.js.map +1 -1
- package/lib/services/post-thread-service.d.ts +114 -5
- package/lib/services/post-thread-service.js +400 -13
- package/lib/services/post-thread-service.js.map +1 -1
- package/lib/services/proxy-services/channel-microservice.d.ts +5 -3
- package/lib/services/proxy-services/channel-microservice.js +19 -10
- package/lib/services/proxy-services/channel-microservice.js.map +1 -1
- package/lib/services/proxy-services/messenger-notification-microservice.d.ts +128 -8
- package/lib/services/proxy-services/messenger-notification-microservice.js +324 -29
- package/lib/services/proxy-services/messenger-notification-microservice.js.map +1 -1
- package/lib/services/proxy-services/post-microservice.d.ts +186 -12
- package/lib/services/proxy-services/post-microservice.js +543 -54
- package/lib/services/proxy-services/post-microservice.js.map +1 -1
- package/lib/services/proxy-services/post-thread-microservice.d.ts +134 -3
- package/lib/services/proxy-services/post-thread-microservice.js +388 -6
- package/lib/services/proxy-services/post-thread-microservice.js.map +1 -1
- package/lib/services/proxy-services/reaction-microservice.d.ts +161 -3
- package/lib/services/proxy-services/reaction-microservice.js +474 -2
- package/lib/services/proxy-services/reaction-microservice.js.map +1 -1
- package/lib/services/reaction-service.d.ts +124 -4
- package/lib/services/reaction-service.js +415 -3
- package/lib/services/reaction-service.js.map +1 -1
- package/lib/store/models/account-token-store.d.ts +1 -1
- package/lib/store/models/account-token-store.js.map +1 -1
- package/lib/store/models/channel.d.ts +2 -3
- package/lib/store/models/channel.js +180 -71
- package/lib/store/models/channel.js.map +1 -1
- package/lib/store/models/post-thread.d.ts +3 -3
- package/lib/store/models/post-thread.js +96 -14
- package/lib/store/models/post-thread.js.map +1 -1
- package/lib/store/models/post.d.ts +2 -3
- package/lib/store/models/post.js +143 -23
- package/lib/store/models/post.js.map +1 -1
- package/lib/store/models/reaction.d.ts +2 -3
- package/lib/store/models/reaction.js +67 -8
- package/lib/store/models/reaction.js.map +1 -1
- package/lib/store/repositories/__tests__/__fixtures__/team-repository.d.ts +3 -3
- package/lib/store/repositories/channel-repository.d.ts +6 -6
- package/lib/store/repositories/channel-repository.js +5 -2
- package/lib/store/repositories/channel-repository.js.map +1 -1
- package/lib/store/repositories/post-repository.d.ts +6 -6
- package/lib/store/repositories/post-repository.js +5 -2
- package/lib/store/repositories/post-repository.js.map +1 -1
- package/lib/store/repositories/post-thread-repository.d.ts +6 -6
- package/lib/store/repositories/post-thread-repository.js +5 -2
- package/lib/store/repositories/post-thread-repository.js.map +1 -1
- package/lib/store/repositories/reaction-repository.d.ts +6 -6
- package/lib/store/repositories/reaction-repository.js +5 -2
- package/lib/store/repositories/reaction-repository.js.map +1 -1
- package/lib/templates/constants/SERVER_TYPES.ts.template +0 -3
- package/lib/templates/repositories/ChannelRepository.ts.template +3 -3
- package/lib/templates/repositories/PostRepository.ts.template +3 -3
- package/lib/templates/repositories/PostThreadRepository.ts.template +3 -3
- package/lib/templates/repositories/ReactionRepository.ts.template +3 -4
- package/lib/templates/services/ChannelService.ts.template +278 -39
- package/lib/templates/services/ExtendedTokenAccountService.ts.template +107 -3
- package/lib/templates/services/MessengerNotificationService.ts.template +94 -19
- package/lib/templates/services/PostService.ts.template +184 -20
- package/lib/templates/services/PostThreadService.ts.template +151 -6
- package/lib/templates/services/ReactionService.ts.template +129 -3
- package/package.json +4 -4
- package/lib/interfaces/context.d.ts +0 -14
- package/lib/store/models/common-options.js +0 -20
- package/lib/store/models/common-options.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from'inversify';import {ServiceBroker}from'moleculer';import'@cdm-logger/core';import {CommonType}from'@common-stack/core';import {MoleculerTopics,ChannelServiceCommands}from'common';import {BaseProxyService}from'@common-stack/store-mongo';let ChannelProxyService = class ChannelProxyService extends BaseProxyService {
|
|
1
|
+
import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from'inversify';import {ServiceBroker}from'moleculer';import'@cdm-logger/core';import {CommonType}from'@common-stack/core';import {MoleculerTopics,ChannelServiceCommands}from'common/server';import {BaseProxyService}from'@common-stack/store-mongo';let ChannelProxyService = class ChannelProxyService extends BaseProxyService {
|
|
2
2
|
logger;
|
|
3
3
|
topic = MoleculerTopics.ChannelService;
|
|
4
4
|
constructor(broker, logger) {
|
|
@@ -7,6 +7,9 @@ import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from
|
|
|
7
7
|
}));
|
|
8
8
|
this.logger = logger;
|
|
9
9
|
}
|
|
10
|
+
dispose() {
|
|
11
|
+
// Cleanup resources if needed
|
|
12
|
+
}
|
|
10
13
|
addMemberToChannel(channelId, memberId) {
|
|
11
14
|
return this.callAction(ChannelServiceCommands.AddMemberToChannel, {
|
|
12
15
|
channelId,
|
|
@@ -28,14 +31,12 @@ import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from
|
|
|
28
31
|
id
|
|
29
32
|
});
|
|
30
33
|
}
|
|
34
|
+
// @ts-ignore - Type compatibility issue with base class method
|
|
31
35
|
getByName(name) {
|
|
32
36
|
return this.callAction(ChannelServiceCommands.GetByName, {
|
|
33
37
|
name
|
|
34
38
|
});
|
|
35
39
|
}
|
|
36
|
-
// getByName(teamId: string, name: string): MethodResponse<'getByName'> {
|
|
37
|
-
// return this.callAction(ChannelServiceCommands.GetByName, { teamId, name });
|
|
38
|
-
// }
|
|
39
40
|
getByNameIncludeDeleted(teamId, name) {
|
|
40
41
|
return this.callAction(ChannelServiceCommands.GetByNameIncludeDeleted, {
|
|
41
42
|
teamId,
|
|
@@ -60,13 +61,13 @@ import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from
|
|
|
60
61
|
userId
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
|
-
getChannels(teamId, userId, includeDeleted, lastDeleteAt,
|
|
64
|
+
getChannels(teamId, userId, includeDeleted, lastDeleteAt, orgId) {
|
|
64
65
|
return this.callAction(ChannelServiceCommands.GetChannels, {
|
|
65
66
|
teamId,
|
|
66
67
|
userId,
|
|
67
68
|
includeDeleted,
|
|
68
69
|
lastDeleteAt,
|
|
69
|
-
|
|
70
|
+
orgId
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
getDeleted(teamId, offset, limit, userId) {
|
|
@@ -143,17 +144,17 @@ import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from
|
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
permanentDelete(channelId) {
|
|
146
|
-
this.callAction(ChannelServiceCommands.PermanentDelete, {
|
|
147
|
+
return this.callAction(ChannelServiceCommands.PermanentDelete, {
|
|
147
148
|
channelId
|
|
148
149
|
});
|
|
149
150
|
}
|
|
150
151
|
permanentDeleteByTeam(teamId) {
|
|
151
|
-
this.callAction(ChannelServiceCommands.PermanentDeleteByTeam, {
|
|
152
|
+
return this.callAction(ChannelServiceCommands.PermanentDeleteByTeam, {
|
|
152
153
|
teamId
|
|
153
154
|
});
|
|
154
155
|
}
|
|
155
156
|
permanentDeleteMembersByChannel(channelId) {
|
|
156
|
-
this.callAction(ChannelServiceCommands.PermanentDeleteMembersByChannel, {
|
|
157
|
+
return this.callAction(ChannelServiceCommands.PermanentDeleteMembersByChannel, {
|
|
157
158
|
channelId
|
|
158
159
|
});
|
|
159
160
|
}
|
|
@@ -195,5 +196,13 @@ import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from
|
|
|
195
196
|
user
|
|
196
197
|
});
|
|
197
198
|
}
|
|
199
|
+
bulkDelete(criteria) {
|
|
200
|
+
return this.callAction(ChannelServiceCommands.PermanentDelete, {
|
|
201
|
+
criteria
|
|
202
|
+
});
|
|
203
|
+
}
|
|
198
204
|
};
|
|
199
|
-
ChannelProxyService = __decorate([injectable()
|
|
205
|
+
ChannelProxyService = __decorate([injectable()
|
|
206
|
+
// @ts-ignore - Type compatibility issue between BaseProxyService and IChannelService
|
|
207
|
+
// export class ChannelProxyService extends BaseProxyService<AsDomainType<IChannelModel>> implements IChannelService {
|
|
208
|
+
, __param(0, inject(CommonType.MOLECULER_BROKER)), __param(1, inject('Logger')), __metadata("design:paramtypes", [ServiceBroker, Object])], ChannelProxyService);export{ChannelProxyService};//# sourceMappingURL=channel-microservice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-microservice.js","sources":["../../../src/services/proxy-services/channel-microservice.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"channel-microservice.js","sources":["../../../src/services/proxy-services/channel-microservice.ts"],"sourcesContent":[null],"names":[],"mappings":"mUA2BO,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,gBAA+B,CAAA;AAO7C,EAAA,MAAA;AANvB,EAAA,KAAA,GAAQ,eAAA,CAAA,cAAgB;aAIpB,CAAA,MAAA,EAAqB,MAEuB,EAAA;AAE5C,IAAA,KAAA,CAAA,MAAM,EAAA,MAAQ,CAAA,KAAY,CAAA;eAFD,EAAA;KAG5B,CAAA,CAAA;IAED,IAAO,CAAA,MAAA,GAAA,MAAA;;SAEN,GAAA;;AAGG;oBACH,CAAA,SAAA,EAAA,QAAA,EAAA;AAED,IAAA,OAAA,IAAA,CAAA,UAAsD,CAAA,sBAAA,CAAA,kBAAA,EAAA;AAClD,MAAA,SAAO;MACV;AAED,KAAA,CAAA;AACI;sBACH,CAAA,IAAA,EAAA;AAED,IAAA,OAAA,IAAA,CAAA,UAAwB,CAAA,sBAAA,CAAA,oBAAA,EAAA;AACpB,MAAA;KACH,CAAA;;AAGD,EAAA,mBAAsB,CAAA,IAAA,EAAA;AAClB,IAAA,OAAA,IAAO,CAAI,UAAW,CAAA,sBAAuB,CAAA,mBAAc,EAAI;MAClE;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,16 +1,136 @@
|
|
|
1
1
|
import { ServiceBroker } from 'moleculer';
|
|
2
2
|
import { CdmLogger } from '@cdm-logger/core';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { Disposable, DisposableCollection } from '@adminide-stack/core';
|
|
4
|
+
import { MoleculerTopics, IPost, IExpoNotification, IExpoNotificationBodyData, IMessengerNotificationService, NotificationDurationUnitEnum, IExpoNotificationData, ISupportServiceConfig } from 'common/server';
|
|
5
|
+
/**
|
|
6
|
+
* Messenger Notification Microservice Implementation
|
|
7
|
+
*
|
|
8
|
+
* This microservice handles comprehensive notification management within the messenger platform,
|
|
9
|
+
* providing operations for sending various types of notifications including email, SMS,
|
|
10
|
+
* push notifications, and Expo notifications across different messaging contexts through
|
|
11
|
+
* service broker delegation.
|
|
12
|
+
*
|
|
13
|
+
* Key capabilities:
|
|
14
|
+
* - Multi-channel notification delivery (email, SMS, push, Expo)
|
|
15
|
+
* - Unread message notification scheduling and management
|
|
16
|
+
* - User preference-based notification filtering
|
|
17
|
+
* - Support service notification handling
|
|
18
|
+
* - Alert message notification broadcasting
|
|
19
|
+
* - Thread-based notification management
|
|
20
|
+
* - Real-time push notification integration
|
|
21
|
+
* - Template-based notification customization
|
|
22
|
+
* - Channel and post-based notification routing
|
|
23
|
+
* - User aggregation and preference management
|
|
24
|
+
*
|
|
25
|
+
* The microservice integrates with multiple external services through Moleculer broker
|
|
26
|
+
* and provides comprehensive error handling and logging for notification workflows.
|
|
27
|
+
*/
|
|
28
|
+
export declare class MessengerNotificationMicroservice implements IMessengerNotificationService, Disposable {
|
|
5
29
|
private readonly broker;
|
|
6
30
|
private readonly logger;
|
|
31
|
+
protected readonly toDispose: DisposableCollection;
|
|
7
32
|
topic: MoleculerTopics;
|
|
8
33
|
constructor(broker: ServiceBroker, logger: CdmLogger.ILogger);
|
|
34
|
+
/**
|
|
35
|
+
* Disposes of resources used by the service
|
|
36
|
+
*/
|
|
37
|
+
dispose(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Calls a microservice action with proper error handling
|
|
40
|
+
*
|
|
41
|
+
* @description Protected method to handle microservice communication
|
|
42
|
+
*
|
|
43
|
+
* @param {string} command - The command to execute
|
|
44
|
+
* @param {P} params - Parameters for the command
|
|
45
|
+
* @returns {Promise<T>} - Result from microservice
|
|
46
|
+
*/
|
|
9
47
|
protected callAction<T, P = unknown>(command: string, params?: P): Promise<T>;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Sends notification for unread messages within a specified time frame
|
|
50
|
+
*
|
|
51
|
+
* @description Aggregates unread messages across channels and sends notifications
|
|
52
|
+
* to users based on their preferences within the specified duration
|
|
53
|
+
*
|
|
54
|
+
* @param {NotificationDurationUnitEnum} unit - Time unit for the duration
|
|
55
|
+
* @param {number} value - Number of time units to look back
|
|
56
|
+
* @returns {Promise<boolean | Error>} - Success status or error
|
|
57
|
+
*/
|
|
58
|
+
sendNotificationOfUnreadMessages(unit: NotificationDurationUnitEnum, value: number): Promise<boolean | Error>;
|
|
59
|
+
/**
|
|
60
|
+
* Sends general notifications for a post
|
|
61
|
+
*
|
|
62
|
+
* @description Handles email and SMS notifications for posts with template support
|
|
63
|
+
*
|
|
64
|
+
* @param {IPost} post - The post that triggered the notification
|
|
65
|
+
* @returns {Promise<boolean | Error>} - Success status or error
|
|
66
|
+
*/
|
|
67
|
+
sendNotificationOnPost(post: IPost): Promise<boolean | Error>;
|
|
68
|
+
/**
|
|
69
|
+
* Sends notifications for alert messages within a time frame
|
|
70
|
+
*
|
|
71
|
+
* @description Processes and sends notifications for alert-type messages
|
|
72
|
+
*
|
|
73
|
+
* @param {NotificationDurationUnitEnum} unit - Time unit for the duration
|
|
74
|
+
* @param {number} value - Number of time units to look back
|
|
75
|
+
* @returns {Promise<boolean | Error>} - Success status or error
|
|
76
|
+
*/
|
|
77
|
+
sendNotificationOfAlertMessages(unit: NotificationDurationUnitEnum, value: number): Promise<boolean | Error>;
|
|
78
|
+
/**
|
|
79
|
+
* Sends Expo push notifications
|
|
80
|
+
*
|
|
81
|
+
* @description Sends push notifications through the Expo notification service
|
|
82
|
+
*
|
|
83
|
+
* @param {IExpoNotificationData} data - Notification data
|
|
84
|
+
* @returns {Promise<IExpoNotification | Error>} - Notification result or error
|
|
85
|
+
*/
|
|
86
|
+
sendPushNotificationsExpo(data: IExpoNotificationData): Promise<IExpoNotification | Error>;
|
|
87
|
+
/**
|
|
88
|
+
* Sends Expo notification when a post is created
|
|
89
|
+
*
|
|
90
|
+
* @description Handles push notification logic for new posts with thread and channel support
|
|
91
|
+
*
|
|
92
|
+
* @param {IPost} post - The post that triggered the notification
|
|
93
|
+
* @param {IExpoNotificationBodyData} notificationData - Optional notification data override
|
|
94
|
+
* @returns {Promise<boolean | Error>} - Success status or error
|
|
95
|
+
*/
|
|
96
|
+
sendExpoNotificationOnPost(post: IPost, notificationData: IExpoNotificationBodyData): Promise<boolean | Error>;
|
|
97
|
+
/**
|
|
98
|
+
* Sends notifications for unread service messages
|
|
99
|
+
*
|
|
100
|
+
* @description Handles notifications for support service channels
|
|
101
|
+
*
|
|
102
|
+
* @param {NotificationDurationUnitEnum} unit - Time unit for the duration
|
|
103
|
+
* @param {number} value - Number of time units to look back
|
|
104
|
+
* @returns {Promise<boolean | Error>} - Success status or error
|
|
105
|
+
*/
|
|
106
|
+
sendNotificationOfUnreadServiceMessages(unit: NotificationDurationUnitEnum, value: number): Promise<boolean | Error>;
|
|
107
|
+
/**
|
|
108
|
+
* Sets the support service configuration
|
|
109
|
+
*
|
|
110
|
+
* @description Updates the support service notification configuration for customized notifications
|
|
111
|
+
*
|
|
112
|
+
* @param {ISupportServiceConfig} config - Support service configuration
|
|
113
|
+
* @returns {Promise<void | Error>} - Void promise or error
|
|
114
|
+
*/
|
|
115
|
+
setSupportServiceConfig(config: ISupportServiceConfig): Promise<void | Error>;
|
|
116
|
+
/**
|
|
117
|
+
* Validates notification data
|
|
118
|
+
*
|
|
119
|
+
* @description Helper method to validate notification data before processing
|
|
120
|
+
*
|
|
121
|
+
* @param {any} data - Data to validate
|
|
122
|
+
* @returns {Promise<boolean | Error>} - Validation result or error
|
|
123
|
+
*/
|
|
124
|
+
validateNotificationData(data: any): Promise<boolean | Error>;
|
|
125
|
+
/**
|
|
126
|
+
* Gets notification statistics
|
|
127
|
+
*
|
|
128
|
+
* @description Convenience method to get notification delivery statistics
|
|
129
|
+
*
|
|
130
|
+
* @param {string} userId - The user identifier (optional)
|
|
131
|
+
* @param {Date} startDate - Start date for statistics
|
|
132
|
+
* @param {Date} endDate - End date for statistics
|
|
133
|
+
* @returns {Promise<any | Error>} - Notification statistics or error
|
|
134
|
+
*/
|
|
135
|
+
getNotificationStatistics(userId?: string, startDate?: Date, endDate?: Date): Promise<any | Error>;
|
|
16
136
|
}
|
|
@@ -1,6 +1,30 @@
|
|
|
1
|
-
import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from'inversify';import {CommonType}from'@common-stack/core';import {ServiceBroker}from'moleculer';import'@cdm-logger/core';import {MoleculerTopics,MessengerNotificationServiceCommands}from'common'
|
|
1
|
+
import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from'inversify';import {CommonType}from'@common-stack/core';import {ServiceBroker}from'moleculer';import'@cdm-logger/core';import {DisposableCollection}from'@adminide-stack/core';import {MoleculerTopics,MessengerNotificationServiceCommands}from'common/server';/**
|
|
2
|
+
* Messenger Notification Microservice Implementation
|
|
3
|
+
*
|
|
4
|
+
* This microservice handles comprehensive notification management within the messenger platform,
|
|
5
|
+
* providing operations for sending various types of notifications including email, SMS,
|
|
6
|
+
* push notifications, and Expo notifications across different messaging contexts through
|
|
7
|
+
* service broker delegation.
|
|
8
|
+
*
|
|
9
|
+
* Key capabilities:
|
|
10
|
+
* - Multi-channel notification delivery (email, SMS, push, Expo)
|
|
11
|
+
* - Unread message notification scheduling and management
|
|
12
|
+
* - User preference-based notification filtering
|
|
13
|
+
* - Support service notification handling
|
|
14
|
+
* - Alert message notification broadcasting
|
|
15
|
+
* - Thread-based notification management
|
|
16
|
+
* - Real-time push notification integration
|
|
17
|
+
* - Template-based notification customization
|
|
18
|
+
* - Channel and post-based notification routing
|
|
19
|
+
* - User aggregation and preference management
|
|
20
|
+
*
|
|
21
|
+
* The microservice integrates with multiple external services through Moleculer broker
|
|
22
|
+
* and provides comprehensive error handling and logging for notification workflows.
|
|
23
|
+
*/
|
|
24
|
+
let MessengerNotificationMicroservice = class MessengerNotificationMicroservice {
|
|
2
25
|
broker;
|
|
3
26
|
logger;
|
|
27
|
+
toDispose = new DisposableCollection();
|
|
4
28
|
topic = MoleculerTopics.MessengerNotificationService;
|
|
5
29
|
constructor(broker, logger) {
|
|
6
30
|
this.broker = broker;
|
|
@@ -9,42 +33,313 @@ import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from
|
|
|
9
33
|
className: 'MessengerNotificationMicroservice'
|
|
10
34
|
});
|
|
11
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Disposes of resources used by the service
|
|
38
|
+
*/
|
|
39
|
+
dispose() {
|
|
40
|
+
this.toDispose.dispose();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Calls a microservice action with proper error handling
|
|
44
|
+
*
|
|
45
|
+
* @description Protected method to handle microservice communication
|
|
46
|
+
*
|
|
47
|
+
* @param {string} command - The command to execute
|
|
48
|
+
* @param {P} params - Parameters for the command
|
|
49
|
+
* @returns {Promise<T>} - Result from microservice
|
|
50
|
+
*/
|
|
12
51
|
async callAction(command, params) {
|
|
13
52
|
return this.broker.call(`${this.topic}.${command}`, params);
|
|
14
53
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Sends notification for unread messages within a specified time frame
|
|
56
|
+
*
|
|
57
|
+
* @description Aggregates unread messages across channels and sends notifications
|
|
58
|
+
* to users based on their preferences within the specified duration
|
|
59
|
+
*
|
|
60
|
+
* @param {NotificationDurationUnitEnum} unit - Time unit for the duration
|
|
61
|
+
* @param {number} value - Number of time units to look back
|
|
62
|
+
* @returns {Promise<boolean | Error>} - Success status or error
|
|
63
|
+
*/
|
|
64
|
+
// @ts-ignore - Enhanced error handling pattern with Error union type
|
|
65
|
+
async sendNotificationOfUnreadMessages(unit, value) {
|
|
66
|
+
try {
|
|
67
|
+
this.logger.debug('Sending notification of unread messages via microservice', {
|
|
68
|
+
unit,
|
|
69
|
+
value
|
|
70
|
+
});
|
|
71
|
+
const result = await this.callAction(MessengerNotificationServiceCommands.SendNotificationOfUnreadMessages, {
|
|
72
|
+
unit,
|
|
73
|
+
value
|
|
74
|
+
});
|
|
75
|
+
if (typeof result !== 'boolean') {
|
|
76
|
+
return new Error('Invalid result from microservice');
|
|
77
|
+
}
|
|
78
|
+
this.logger.debug('Notification of unread messages sent successfully via microservice', {
|
|
79
|
+
unit,
|
|
80
|
+
value,
|
|
81
|
+
success: result
|
|
82
|
+
});
|
|
83
|
+
return result;
|
|
84
|
+
} catch (error) {
|
|
85
|
+
this.logger.error('Error sending notification of unread messages via microservice: %o', error);
|
|
86
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while sending unread message notifications');
|
|
87
|
+
}
|
|
20
88
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Sends general notifications for a post
|
|
91
|
+
*
|
|
92
|
+
* @description Handles email and SMS notifications for posts with template support
|
|
93
|
+
*
|
|
94
|
+
* @param {IPost} post - The post that triggered the notification
|
|
95
|
+
* @returns {Promise<boolean | Error>} - Success status or error
|
|
96
|
+
*/
|
|
97
|
+
// @ts-ignore - Enhanced error handling pattern with Error union type
|
|
98
|
+
async sendNotificationOnPost(post) {
|
|
99
|
+
try {
|
|
100
|
+
this.logger.debug('Sending notification on post via microservice', {
|
|
101
|
+
postId: post.id
|
|
102
|
+
});
|
|
103
|
+
const result = await this.callAction(MessengerNotificationServiceCommands.SendNotificationOnPost, {
|
|
104
|
+
post
|
|
105
|
+
});
|
|
106
|
+
if (typeof result !== 'boolean') {
|
|
107
|
+
return new Error('Invalid result from microservice');
|
|
108
|
+
}
|
|
109
|
+
this.logger.debug('Notification on post sent successfully via microservice', {
|
|
110
|
+
postId: post.id,
|
|
111
|
+
success: result
|
|
112
|
+
});
|
|
113
|
+
return result;
|
|
114
|
+
} catch (error) {
|
|
115
|
+
this.logger.error('Error sending notification on post via microservice: %o', error);
|
|
116
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while sending post notification');
|
|
117
|
+
}
|
|
25
118
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Sends notifications for alert messages within a time frame
|
|
121
|
+
*
|
|
122
|
+
* @description Processes and sends notifications for alert-type messages
|
|
123
|
+
*
|
|
124
|
+
* @param {NotificationDurationUnitEnum} unit - Time unit for the duration
|
|
125
|
+
* @param {number} value - Number of time units to look back
|
|
126
|
+
* @returns {Promise<boolean | Error>} - Success status or error
|
|
127
|
+
*/
|
|
128
|
+
// @ts-ignore - Enhanced error handling pattern with Error union type
|
|
129
|
+
async sendNotificationOfAlertMessages(unit, value) {
|
|
130
|
+
try {
|
|
131
|
+
this.logger.debug('Sending notification of alert messages via microservice', {
|
|
132
|
+
unit,
|
|
133
|
+
value
|
|
134
|
+
});
|
|
135
|
+
const result = await this.callAction(MessengerNotificationServiceCommands.SendNotificationOfAlertMessages, {
|
|
136
|
+
unit,
|
|
137
|
+
value
|
|
138
|
+
});
|
|
139
|
+
if (typeof result !== 'boolean') {
|
|
140
|
+
return new Error('Invalid result from microservice');
|
|
141
|
+
}
|
|
142
|
+
this.logger.debug('Notification of alert messages sent successfully via microservice', {
|
|
143
|
+
unit,
|
|
144
|
+
value,
|
|
145
|
+
success: result
|
|
146
|
+
});
|
|
147
|
+
return result;
|
|
148
|
+
} catch (error) {
|
|
149
|
+
this.logger.error('Error sending notification of alert messages via microservice: %o', error);
|
|
150
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while sending alert notifications');
|
|
151
|
+
}
|
|
31
152
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Sends Expo push notifications
|
|
155
|
+
*
|
|
156
|
+
* @description Sends push notifications through the Expo notification service
|
|
157
|
+
*
|
|
158
|
+
* @param {IExpoNotificationData} data - Notification data
|
|
159
|
+
* @returns {Promise<IExpoNotification | Error>} - Notification result or error
|
|
160
|
+
*/
|
|
161
|
+
async sendPushNotificationsExpo(data) {
|
|
162
|
+
try {
|
|
163
|
+
this.logger.debug('Sending Expo push notifications via microservice', {
|
|
164
|
+
recipients: Array.isArray(data.to) ? data.to.length : 1,
|
|
165
|
+
hasTitle: !!data.title,
|
|
166
|
+
hasBody: !!data.body
|
|
167
|
+
});
|
|
168
|
+
const result = await this.callAction(MessengerNotificationServiceCommands.SendPushNotificationsExpo, {
|
|
169
|
+
data
|
|
170
|
+
});
|
|
171
|
+
if (!result) {
|
|
172
|
+
return new Error('Failed to send Expo notification');
|
|
173
|
+
}
|
|
174
|
+
this.logger.debug('Expo push notifications sent successfully via microservice', {
|
|
175
|
+
status: result.status,
|
|
176
|
+
id: result.id
|
|
177
|
+
});
|
|
178
|
+
return result;
|
|
179
|
+
} catch (error) {
|
|
180
|
+
this.logger.error('Error sending Expo push notifications via microservice: %o', error);
|
|
181
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while sending Expo notification');
|
|
182
|
+
}
|
|
36
183
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
184
|
+
/**
|
|
185
|
+
* Sends Expo notification when a post is created
|
|
186
|
+
*
|
|
187
|
+
* @description Handles push notification logic for new posts with thread and channel support
|
|
188
|
+
*
|
|
189
|
+
* @param {IPost} post - The post that triggered the notification
|
|
190
|
+
* @param {IExpoNotificationBodyData} notificationData - Optional notification data override
|
|
191
|
+
* @returns {Promise<boolean | Error>} - Success status or error
|
|
192
|
+
*/
|
|
193
|
+
// @ts-ignore - Enhanced error handling pattern with Error union type
|
|
194
|
+
async sendExpoNotificationOnPost(post, notificationData) {
|
|
195
|
+
try {
|
|
196
|
+
this.logger.debug('Sending Expo notification on post via microservice', {
|
|
197
|
+
postId: post.id,
|
|
198
|
+
channelId: post.channel,
|
|
199
|
+
hasNotificationData: !!notificationData
|
|
200
|
+
});
|
|
201
|
+
const result = await this.callAction(MessengerNotificationServiceCommands.SendExpoNotificationOnPost, {
|
|
202
|
+
post,
|
|
203
|
+
notificationData
|
|
204
|
+
});
|
|
205
|
+
if (typeof result !== 'boolean') {
|
|
206
|
+
return new Error('Invalid result from microservice');
|
|
207
|
+
}
|
|
208
|
+
this.logger.debug('Expo notification on post sent successfully via microservice', {
|
|
209
|
+
postId: post.id,
|
|
210
|
+
success: result
|
|
211
|
+
});
|
|
212
|
+
return result;
|
|
213
|
+
} catch (error) {
|
|
214
|
+
this.logger.error('Error sending Expo notification on post via microservice: %o', error);
|
|
215
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while sending post notification');
|
|
216
|
+
}
|
|
42
217
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Sends notifications for unread service messages
|
|
220
|
+
*
|
|
221
|
+
* @description Handles notifications for support service channels
|
|
222
|
+
*
|
|
223
|
+
* @param {NotificationDurationUnitEnum} unit - Time unit for the duration
|
|
224
|
+
* @param {number} value - Number of time units to look back
|
|
225
|
+
* @returns {Promise<boolean | Error>} - Success status or error
|
|
226
|
+
*/
|
|
227
|
+
// @ts-ignore - Enhanced error handling pattern with Error union type
|
|
228
|
+
async sendNotificationOfUnreadServiceMessages(unit, value) {
|
|
229
|
+
try {
|
|
230
|
+
this.logger.debug('Sending notification of unread service messages via microservice', {
|
|
231
|
+
unit,
|
|
232
|
+
value
|
|
233
|
+
});
|
|
234
|
+
const result = await this.callAction(MessengerNotificationServiceCommands.SendNotificationOfUnreadServiceMessages, {
|
|
235
|
+
unit,
|
|
236
|
+
value
|
|
237
|
+
});
|
|
238
|
+
if (typeof result !== 'boolean') {
|
|
239
|
+
return new Error('Invalid result from microservice');
|
|
240
|
+
}
|
|
241
|
+
this.logger.debug('Notification of unread service messages sent successfully via microservice', {
|
|
242
|
+
unit,
|
|
243
|
+
value,
|
|
244
|
+
success: result
|
|
245
|
+
});
|
|
246
|
+
return result;
|
|
247
|
+
} catch (error) {
|
|
248
|
+
this.logger.error('Error sending notification of unread service messages via microservice: %o', error);
|
|
249
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while sending service notifications');
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Sets the support service configuration
|
|
254
|
+
*
|
|
255
|
+
* @description Updates the support service notification configuration for customized notifications
|
|
256
|
+
*
|
|
257
|
+
* @param {ISupportServiceConfig} config - Support service configuration
|
|
258
|
+
* @returns {Promise<void | Error>} - Void promise or error
|
|
259
|
+
*/
|
|
260
|
+
// @ts-ignore - Enhanced error handling pattern with Error union type
|
|
261
|
+
async setSupportServiceConfig(config) {
|
|
262
|
+
try {
|
|
263
|
+
this.logger.debug('Setting support service config via microservice', {
|
|
264
|
+
hasEmail: !!config?.email,
|
|
265
|
+
hasTemplateId: !!config?.templateId,
|
|
266
|
+
hasVariables: !!config?.variables
|
|
267
|
+
});
|
|
268
|
+
await this.callAction(MessengerNotificationServiceCommands.SetSupportServiceConfig, {
|
|
269
|
+
config
|
|
270
|
+
});
|
|
271
|
+
this.logger.debug('Support service config set successfully via microservice');
|
|
272
|
+
} catch (error) {
|
|
273
|
+
this.logger.error('Error setting support service config via microservice: %o', error);
|
|
274
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while setting support service config');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Validates notification data
|
|
279
|
+
*
|
|
280
|
+
* @description Helper method to validate notification data before processing
|
|
281
|
+
*
|
|
282
|
+
* @param {any} data - Data to validate
|
|
283
|
+
* @returns {Promise<boolean | Error>} - Validation result or error
|
|
284
|
+
*/
|
|
285
|
+
async validateNotificationData(data) {
|
|
286
|
+
try {
|
|
287
|
+
if (!data) {
|
|
288
|
+
return new Error('Notification data is required');
|
|
289
|
+
}
|
|
290
|
+
// Basic validation logic
|
|
291
|
+
if (data.type === 'email' && !data.email) {
|
|
292
|
+
return new Error('Email is required for email notifications');
|
|
293
|
+
}
|
|
294
|
+
if (data.type === 'sms' && !data.phoneNumber) {
|
|
295
|
+
return new Error('Phone number is required for SMS notifications');
|
|
296
|
+
}
|
|
297
|
+
if (data.type === 'expo' && !data.to) {
|
|
298
|
+
return new Error('Recipients are required for Expo notifications');
|
|
299
|
+
}
|
|
300
|
+
this.logger.debug('Notification data validation passed', {
|
|
301
|
+
type: data.type
|
|
302
|
+
});
|
|
303
|
+
return true;
|
|
304
|
+
} catch (error) {
|
|
305
|
+
this.logger.error('Error validating notification data: %o', error);
|
|
306
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while validating notification data');
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Gets notification statistics
|
|
311
|
+
*
|
|
312
|
+
* @description Convenience method to get notification delivery statistics
|
|
313
|
+
*
|
|
314
|
+
* @param {string} userId - The user identifier (optional)
|
|
315
|
+
* @param {Date} startDate - Start date for statistics
|
|
316
|
+
* @param {Date} endDate - End date for statistics
|
|
317
|
+
* @returns {Promise<any | Error>} - Notification statistics or error
|
|
318
|
+
*/
|
|
319
|
+
async getNotificationStatistics(userId, startDate, endDate) {
|
|
320
|
+
try {
|
|
321
|
+
this.logger.debug('Getting notification statistics via microservice', {
|
|
322
|
+
userId,
|
|
323
|
+
startDate: startDate?.toISOString(),
|
|
324
|
+
endDate: endDate?.toISOString()
|
|
325
|
+
});
|
|
326
|
+
const result = await this.broker.call(`${this.topic}.getNotificationStatistics`, {
|
|
327
|
+
userId,
|
|
328
|
+
startDate,
|
|
329
|
+
endDate
|
|
330
|
+
});
|
|
331
|
+
if (!result) {
|
|
332
|
+
return new Error('Failed to get notification statistics');
|
|
333
|
+
}
|
|
334
|
+
this.logger.debug('Notification statistics retrieved successfully via microservice', {
|
|
335
|
+
userId,
|
|
336
|
+
hasStats: !!result
|
|
337
|
+
});
|
|
338
|
+
return result;
|
|
339
|
+
} catch (error) {
|
|
340
|
+
this.logger.error('Error getting notification statistics via microservice: %o', error);
|
|
341
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while getting notification statistics');
|
|
342
|
+
}
|
|
48
343
|
}
|
|
49
344
|
};
|
|
50
345
|
MessengerNotificationMicroservice = __decorate([injectable(), __param(0, inject(CommonType.MOLECULER_BROKER)), __param(1, inject('Logger')), __metadata("design:paramtypes", [ServiceBroker, Object])], MessengerNotificationMicroservice);export{MessengerNotificationMicroservice};//# sourceMappingURL=messenger-notification-microservice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messenger-notification-microservice.js","sources":["../../../src/services/proxy-services/messenger-notification-microservice.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"messenger-notification-microservice.js","sources":["../../../src/services/proxy-services/messenger-notification-microservice.ts"],"sourcesContent":[null],"names":[],"mappings":"gVAiBA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AAEU,IAAA,iCAAiC,GAAvC,MAAM,iCAAiC,CAAA;AAMrB,EAAA,MAAA;AAEA,EAAA,MAAA;AAPF,EAAA,SAAA,GAAY,IAAA,oBAAwB,EAAA;AACvD,EAAA,KAAA,GAAQ,eAAA,CAAA,4BAAgB;aAIH,CAAA,MAAA,EAAqB,MAEI,EAAA;QAFzB,CAAM,MAAA,GAAA;QAEN,CAAM,MAAA,GAAA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