@messenger-box/platform-server 10.0.3-alpha.7 → 10.0.3-alpha.74
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/config/env-config.d.ts +7 -0
- package/lib/config/env-config.js +20 -0
- package/lib/config/env-config.js.map +1 -1
- package/lib/containers/containers.js +9 -1
- package/lib/containers/containers.js.map +1 -1
- package/lib/containers/context-services-from-container.d.ts +1 -1
- package/lib/containers/context-services-from-container.js +4 -2
- package/lib/containers/context-services-from-container.js.map +1 -1
- package/lib/graphql/resolvers/ai-fragment.d.ts +3 -0
- package/lib/graphql/resolvers/ai-fragment.js +276 -0
- package/lib/graphql/resolvers/ai-fragment.js.map +1 -0
- package/lib/graphql/resolvers/channel-member.d.ts +3 -2
- 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 -2
- package/lib/graphql/resolvers/channel.js +308 -53
- package/lib/graphql/resolvers/channel.js.map +1 -1
- package/lib/graphql/resolvers/extended-token-account.d.ts +3 -2
- 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 -1
- package/lib/graphql/resolvers/index.js +1 -1
- package/lib/graphql/resolvers/index.js.map +1 -1
- package/lib/graphql/resolvers/post-thread.d.ts +1 -1
- 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 +874 -239
- package/lib/graphql/resolvers/post.js.map +1 -1
- package/lib/graphql/resolvers/reaction.d.ts +3 -2
- package/lib/graphql/resolvers/reaction.js +96 -14
- package/lib/graphql/resolvers/reaction.js.map +1 -1
- package/lib/graphql/schema/ai-fragment.graphql +311 -0
- package/lib/graphql/schema/ai-fragment.graphql.js +1 -0
- package/lib/graphql/schema/ai-fragment.graphql.js.map +1 -0
- 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 +356 -38
- package/lib/graphql/schema/channel.graphql.js +1 -1
- package/lib/graphql/schema/index.js +2 -2
- package/lib/graphql/schema/index.js.map +1 -1
- package/lib/graphql/schema/post-thread.graphql +167 -21
- package/lib/graphql/schema/post-thread.graphql.js +1 -1
- package/lib/graphql/schema/post.graphql +360 -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 +21 -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/inngest/factory.d.ts +20 -0
- package/lib/inngest/factory.js +4 -0
- package/lib/inngest/factory.js.map +1 -0
- package/lib/inngest/functions.d.ts +235 -0
- package/lib/inngest/functions.js +1385 -0
- package/lib/inngest/functions.js.map +1 -0
- package/lib/inngest/index.d.ts +3 -0
- package/lib/inngest/prompt.d.ts +6 -0
- package/lib/inngest/prompt.js +871 -0
- package/lib/inngest/prompt.js.map +1 -0
- package/lib/inngest/utils.d.ts +5 -0
- package/lib/inngest/utils.js +32 -0
- package/lib/inngest/utils.js.map +1 -0
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/interfaces/services.d.ts +1 -1
- 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/module.js +10 -3
- package/lib/module.js.map +1 -1
- package/lib/plugins/ai-fragment-moleculer-service.d.ts +29 -0
- package/lib/plugins/ai-fragment-moleculer-service.js +516 -0
- package/lib/plugins/ai-fragment-moleculer-service.js.map +1 -0
- package/lib/plugins/channel-moleculer-service.d.ts +21 -1
- package/lib/plugins/channel-moleculer-service.js +426 -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/index.d.ts +1 -0
- 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 +1102 -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/ai-fragment-service.d.ts +195 -0
- package/lib/services/ai-fragment-service.js +631 -0
- package/lib/services/ai-fragment-service.js.map +1 -0
- package/lib/services/channel-service.d.ts +181 -33
- package/lib/services/channel-service.js +842 -273
- 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/index.d.ts +3 -0
- 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 +189 -16
- package/lib/services/post-service.js +949 -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/ai-fragment-microservice.d.ts +23 -0
- package/lib/services/proxy-services/ai-fragment-microservice.js +78 -0
- package/lib/services/proxy-services/ai-fragment-microservice.js.map +1 -0
- package/lib/services/proxy-services/channel-microservice.d.ts +6 -3
- package/lib/services/proxy-services/channel-microservice.js +25 -10
- package/lib/services/proxy-services/channel-microservice.js.map +1 -1
- package/lib/services/proxy-services/index.d.ts +1 -0
- 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 +207 -12
- package/lib/services/proxy-services/post-microservice.js +623 -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/services/redis-cache-manager.d.ts +18 -0
- package/lib/services/redis-cache-manager.js +83 -0
- package/lib/services/redis-cache-manager.js.map +1 -0
- package/lib/services/sandbox-error-service.d.ts +23 -0
- package/lib/services/sandbox-error-service.js +422 -0
- package/lib/services/sandbox-error-service.js.map +1 -0
- 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/ai-fragment.d.ts +4 -0
- package/lib/store/models/ai-fragment.js +125 -0
- package/lib/store/models/ai-fragment.js.map +1 -0
- package/lib/store/models/channel.d.ts +2 -3
- package/lib/store/models/channel.js +185 -71
- package/lib/store/models/channel.js.map +1 -1
- package/lib/store/models/index.d.ts +1 -0
- 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/ai-fragment-repository.d.ts +15 -0
- package/lib/store/repositories/ai-fragment-repository.js +69 -0
- package/lib/store/repositories/ai-fragment-repository.js.map +1 -0
- 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/index.d.ts +1 -0
- 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 +4 -4
- package/lib/templates/repositories/AiFragmentRepository.ts.template +4 -0
- 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/AiFragmentService.ts.template +123 -0
- package/lib/templates/services/ChannelService.ts.template +290 -39
- package/lib/templates/services/ExtendedTokenAccountService.ts.template +104 -9
- package/lib/templates/services/MessengerNotificationService.ts.template +94 -19
- package/lib/templates/services/PostService.ts.template +265 -20
- package/lib/templates/services/PostThreadService.ts.template +151 -6
- package/lib/templates/services/ReactionService.ts.template +129 -3
- package/lib/templates/services/RedisCacheManager.ts.template +22 -0
- package/lib/templates/services/SandboxErrorService.ts.template +125 -0
- package/package.json +14 -7
- 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
|
@@ -0,0 +1,78 @@
|
|
|
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,AiFragmentServiceCommands}from'common/server';import {BaseProxyService}from'@common-stack/store-mongo';let AiFragmentProxyService = class AiFragmentProxyService extends BaseProxyService {
|
|
2
|
+
logger;
|
|
3
|
+
topic = MoleculerTopics.AiFragmentService;
|
|
4
|
+
constructor(broker, logger) {
|
|
5
|
+
super(broker, logger.child({
|
|
6
|
+
className: 'AiFragmentProxyService'
|
|
7
|
+
}));
|
|
8
|
+
this.logger = logger;
|
|
9
|
+
}
|
|
10
|
+
dispose() {
|
|
11
|
+
// Cleanup resources if needed
|
|
12
|
+
}
|
|
13
|
+
// AI Fragment specific methods
|
|
14
|
+
createFragment(input) {
|
|
15
|
+
return this.callAction(AiFragmentServiceCommands.CreateFragment, {
|
|
16
|
+
input
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
getFragmentByMessageId(messageId) {
|
|
20
|
+
return this.callAction(AiFragmentServiceCommands.GetFragmentByMessageId, {
|
|
21
|
+
messageId
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
getFragmentsByUser(orgName, owner, limit, skip) {
|
|
25
|
+
return this.callAction(AiFragmentServiceCommands.GetFragmentsByUser, {
|
|
26
|
+
orgName,
|
|
27
|
+
owner,
|
|
28
|
+
limit,
|
|
29
|
+
skip
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
updateFragmentFiles(messageId, files) {
|
|
33
|
+
return this.callAction(AiFragmentServiceCommands.UpdateFragmentFiles, {
|
|
34
|
+
messageId,
|
|
35
|
+
files
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
deleteFragment(id) {
|
|
39
|
+
return this.callAction(AiFragmentServiceCommands.DeleteFragment, {
|
|
40
|
+
id
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
deleteFragmentByMessageId(messageId) {
|
|
44
|
+
return this.callAction(AiFragmentServiceCommands.DeleteFragmentByMessageId, {
|
|
45
|
+
messageId
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getFragmentById(fragmentId) {
|
|
49
|
+
return this.callAction(AiFragmentServiceCommands.GetFragmentById, {
|
|
50
|
+
fragmentId
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
updateSandboxUrl(fragmentId, newSandboxUrl) {
|
|
54
|
+
return this.callAction(AiFragmentServiceCommands.UpdateSandboxUrl, {
|
|
55
|
+
fragmentId,
|
|
56
|
+
newSandboxUrl
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
updateFileSync(fragmentId, fileVersions, syncStatus) {
|
|
60
|
+
return this.callAction(AiFragmentServiceCommands.UpdateFileSync, {
|
|
61
|
+
fragmentId,
|
|
62
|
+
fileVersions,
|
|
63
|
+
syncStatus
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
updateFilesAndSync(fragmentId, files, fileVersions, syncStatus) {
|
|
67
|
+
return this.callAction(AiFragmentServiceCommands.UpdateFilesAndSync, {
|
|
68
|
+
fragmentId,
|
|
69
|
+
files,
|
|
70
|
+
fileVersions,
|
|
71
|
+
syncStatus
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
AiFragmentProxyService = __decorate([injectable()
|
|
76
|
+
// @ts-ignore - Type compatibility issue between BaseProxyService and IAiFragmentService
|
|
77
|
+
// export class AiFragmentProxyService extends BaseProxyService<AsDomainType<IAiFragmentModel>> implements IAiFragmentService {
|
|
78
|
+
, __param(0, inject(CommonType.MOLECULER_BROKER)), __param(1, inject('Logger')), __metadata("design:paramtypes", [ServiceBroker, Object])], AiFragmentProxyService);export{AiFragmentProxyService};//# sourceMappingURL=ai-fragment-microservice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-fragment-microservice.js","sources":["../../../src/services/proxy-services/ai-fragment-microservice.ts"],"sourcesContent":[null],"names":[],"mappings":"sUAuBO,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,gBAAkC,CAAA;AAOnD,EAAA,MAAA;AANvB,EAAA,KAAA,GAAQ,eAAA,CAAA,iBAAgB;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;;AAID;AACI;gBACH,CAAA,KAAA,EAAA;AAED,IAAA,OAAA,IAAA,CAAA,UAAsB,CAAC,yBAAiB,CAAA,cAAA,EAAA;AACpC,MAAA;KACH,CAAA;AAED;AAMI,EAAA,sBAAY,CAAA,SAAoC,EAAA;IACpD,OAAC,IAAA,CAAA,UAAA,CAAA,yBAAA,CAAA,sBAAA,EAAA;MAEkB;AACf,KAAA,CAAA;;AAGJ,EAAA,kBAAyB,CAAA,OAAA,EAAA,KAAA,EAAA,KAAA,EAAA,IAAA,EAAA;AACrB,IAAA,OAAA,IAAO,CAAI,UAAW,CAAA,yBAA0B,CAAA,kBAAe,EAAE;MACpE,OAAA;AAED,MAAA,KAAA;AACI,MAAA,KAAA;MACH;AAED,KAAA,CAAA;AACI;qBACH,CAAA,SAAA,EAAA,KAAA,EAAA;IAED,OAAgB,IAAA,CAAA,UAAmB,CAAA,yBAAuB,CAAA,mBAAA,EAAA;AACtD,MAAA,SAAO;MACV;AAED,KAAA,CAAA;AAKI;gBACH,CAAA,EAAA,EAAA;AAED,IAAA,OAAA,IAAA,CAAA,UACsB,CAAA,yBAElB,CAAA,cACgC,EAAA;AAEhC,MAAA;;;2BAGgB,CAAA,SAAA,EAAA;eACF,CAAA,UAAA,CAAA,yBAAA,CAAA,yBAAA,EAAA;AACb,MAAA;KACJ,CAAA;;AA3EQ,EAAsB,eAAA,CAAA,UAAA,EAAA;AAHlC,IAAA,OAAA,IAAY,CAAA,UAAA,CAAA,yBAAA,CAAA,eAAA,EAAA;MAC2E;KACuC,CAAA;;AAKtH,EAAA,2BAAO,EAAA,aAAW,EAAA;AAElB,IAAA,OAAA,IAAA,CAAM,UAAS,CAAA,yBAAC,CAAA,gBAAA,EAAA;;AANZ,MAAA;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ServiceBroker } from 'moleculer';
|
|
2
2
|
import { CdmLogger } from '@cdm-logger/core';
|
|
3
|
-
import {
|
|
3
|
+
import { IChannelModel, MoleculerTopics as MoleculerTopics, IUserAccount, IChannelService, ISaveChannelParams, ISavePublicChannelParams, ISaveDirectChannelParams, ICreateDirectChannelParams, ISaveMembersToChannelParams, AsDomainType, FilterCriteria, IChannelInput } from 'common/server';
|
|
4
4
|
import { BaseProxyService } from '@common-stack/store-mongo';
|
|
5
5
|
type MethodsNames = keyof IChannelService;
|
|
6
6
|
type MethodResponse<T extends MethodsNames> = ReturnType<IChannelService[T]>;
|
|
7
|
-
export declare class ChannelProxyService extends BaseProxyService<
|
|
7
|
+
export declare class ChannelProxyService extends BaseProxyService<IChannelModel> implements IChannelService {
|
|
8
8
|
protected readonly logger: CdmLogger.ILogger;
|
|
9
9
|
topic: MoleculerTopics;
|
|
10
10
|
constructor(broker: ServiceBroker, logger: CdmLogger.ILogger);
|
|
11
|
+
dispose(): void;
|
|
11
12
|
addMemberToChannel(channelId: string, memberId: string): MethodResponse<'addMemberToChannel'>;
|
|
12
13
|
saveMembersToChannel(data: ISaveMembersToChannelParams): MethodResponse<'saveMembersToChannel'>;
|
|
13
14
|
createDirectChannel(data: ICreateDirectChannelParams): MethodResponse<'createDirectChannel'>;
|
|
@@ -17,7 +18,7 @@ export declare class ChannelProxyService extends BaseProxyService<IChannel, Omit
|
|
|
17
18
|
getByNames(teamId: string, names: string[]): MethodResponse<'getByNames'>;
|
|
18
19
|
getChannelCounts(teamId: string, userId: string): MethodResponse<'getChannelCounts'>;
|
|
19
20
|
getChannelUnread(channelId: string, userId: string): MethodResponse<'getChannelUnread'>;
|
|
20
|
-
getChannels(teamId: string, userId: string, includeDeleted: boolean, lastDeleteAt: number,
|
|
21
|
+
getChannels(teamId: string, userId: string, includeDeleted: boolean, lastDeleteAt: number, orgId: string): MethodResponse<'getChannels'>;
|
|
21
22
|
getDeleted(teamId: string, offset: number, limit: number, userId: string): MethodResponse<'getDeleted'>;
|
|
22
23
|
getDeletedByName(teamId: string, name: string): MethodResponse<'getDeletedByName'>;
|
|
23
24
|
getFromMaster(id: string): MethodResponse<'getFromMaster'>;
|
|
@@ -40,5 +41,7 @@ export declare class ChannelProxyService extends BaseProxyService<IChannel, Omit
|
|
|
40
41
|
saveMultipleMembers(members: IUserAccount[]): MethodResponse<'saveMultipleMembers'>;
|
|
41
42
|
isMember(channelId: string, user: string): Promise<boolean>;
|
|
42
43
|
viewChannel(id: string, user: string): Promise<boolean>;
|
|
44
|
+
bulkDelete(criteria: FilterCriteria<AsDomainType<IChannelModel>>): Promise<number>;
|
|
45
|
+
createChannelWithProjectId(projectId: string, channelInput: IChannelInput): Promise<boolean>;
|
|
43
46
|
}
|
|
44
47
|
export {};
|
|
@@ -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,19 @@ 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
|
+
}
|
|
204
|
+
createChannelWithProjectId(projectId, channelInput) {
|
|
205
|
+
return this.callAction(ChannelServiceCommands.CreateChannelWithProjectId, {
|
|
206
|
+
projectId,
|
|
207
|
+
channelInput
|
|
208
|
+
});
|
|
209
|
+
}
|
|
198
210
|
};
|
|
199
|
-
ChannelProxyService = __decorate([injectable()
|
|
211
|
+
ChannelProxyService = __decorate([injectable()
|
|
212
|
+
// @ts-ignore - Type compatibility issue between BaseProxyService and IChannelService
|
|
213
|
+
// export class ChannelProxyService extends BaseProxyService<AsDomainType<IChannelModel>> implements IChannelService {
|
|
214
|
+
, __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":"mUA4BO,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;A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,sBAAA,CAAA,wBAAA,EAAA;MACJ,MAAA;AA/KY,MAAmB,MAAA;AAH/B,MAAA;KACoF,CAAA;;;AAM5E,IAAA,OAAA,IAAA,WAAO,CAAA,sBAA2B,CAAC,eAAA,EAAA;AAEnC,MAAA;;AANI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -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
|
}
|