@messenger-box/platform-server 10.0.3-alpha.50 → 10.0.3-alpha.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/lib/containers/containers.js.map +1 -1
  2. package/lib/graphql/resolvers/channel-member.d.ts +2 -1
  3. package/lib/graphql/resolvers/channel-member.js +13 -3
  4. package/lib/graphql/resolvers/channel-member.js.map +1 -1
  5. package/lib/graphql/resolvers/channel.d.ts +2 -1
  6. package/lib/graphql/resolvers/channel.js +260 -126
  7. package/lib/graphql/resolvers/channel.js.map +1 -1
  8. package/lib/graphql/resolvers/extended-token-account.d.ts +2 -1
  9. package/lib/graphql/resolvers/extended-token-account.js +90 -23
  10. package/lib/graphql/resolvers/extended-token-account.js.map +1 -1
  11. package/lib/graphql/resolvers/post-thread.js +285 -179
  12. package/lib/graphql/resolvers/post-thread.js.map +1 -1
  13. package/lib/graphql/resolvers/post.js +669 -242
  14. package/lib/graphql/resolvers/post.js.map +1 -1
  15. package/lib/graphql/resolvers/reaction.d.ts +2 -1
  16. package/lib/graphql/resolvers/reaction.js +96 -14
  17. package/lib/graphql/resolvers/reaction.js.map +1 -1
  18. package/lib/graphql/schema/channel.graphql +331 -39
  19. package/lib/graphql/schema/channel.graphql.js +1 -1
  20. package/lib/graphql/schema/post-thread.graphql +157 -21
  21. package/lib/graphql/schema/post-thread.graphql.js +1 -1
  22. package/lib/graphql/schema/post.graphql +265 -40
  23. package/lib/graphql/schema/post.graphql.js +1 -1
  24. package/lib/graphql/schema/reaction.graphql +71 -13
  25. package/lib/graphql/schema/reaction.graphql.js +1 -1
  26. package/lib/graphql/schema/users.graphql +76 -13
  27. package/lib/graphql/schema/users.graphql.js +1 -1
  28. package/lib/plugins/channel-moleculer-service.d.ts +21 -1
  29. package/lib/plugins/channel-moleculer-service.js +417 -115
  30. package/lib/plugins/channel-moleculer-service.js.map +1 -1
  31. package/lib/plugins/extended-token-account-moleculer-service.d.ts +25 -1
  32. package/lib/plugins/extended-token-account-moleculer-service.js +348 -22
  33. package/lib/plugins/extended-token-account-moleculer-service.js.map +1 -1
  34. package/lib/plugins/messenger-notification-moleculer-service.d.ts +26 -3
  35. package/lib/plugins/messenger-notification-moleculer-service.js +403 -57
  36. package/lib/plugins/messenger-notification-moleculer-service.js.map +1 -1
  37. package/lib/plugins/post-moleculer-service.d.ts +84 -20
  38. package/lib/plugins/post-moleculer-service.js +891 -259
  39. package/lib/plugins/post-moleculer-service.js.map +1 -1
  40. package/lib/plugins/post-thread-moleculer-service.d.ts +33 -1
  41. package/lib/plugins/post-thread-moleculer-service.js +320 -13
  42. package/lib/plugins/post-thread-moleculer-service.js.map +1 -1
  43. package/lib/services/channel-service.d.ts +185 -33
  44. package/lib/services/channel-service.js +767 -282
  45. package/lib/services/channel-service.js.map +1 -1
  46. package/lib/services/extended-token-account-service.d.ts +127 -14
  47. package/lib/services/extended-token-account-service.js +459 -52
  48. package/lib/services/extended-token-account-service.js.map +1 -1
  49. package/lib/services/messenger-notification-service.d.ts +106 -13
  50. package/lib/services/messenger-notification-service.js +824 -442
  51. package/lib/services/messenger-notification-service.js.map +1 -1
  52. package/lib/services/post-service.d.ts +176 -16
  53. package/lib/services/post-service.js +553 -119
  54. package/lib/services/post-service.js.map +1 -1
  55. package/lib/services/post-thread-service.d.ts +114 -6
  56. package/lib/services/post-thread-service.js +397 -18
  57. package/lib/services/post-thread-service.js.map +1 -1
  58. package/lib/services/proxy-services/channel-microservice.d.ts +4 -3
  59. package/lib/services/proxy-services/channel-microservice.js +12 -9
  60. package/lib/services/proxy-services/channel-microservice.js.map +1 -1
  61. package/lib/services/proxy-services/messenger-notification-microservice.d.ts +128 -8
  62. package/lib/services/proxy-services/messenger-notification-microservice.js +324 -29
  63. package/lib/services/proxy-services/messenger-notification-microservice.js.map +1 -1
  64. package/lib/services/proxy-services/post-microservice.d.ts +186 -13
  65. package/lib/services/proxy-services/post-microservice.js +543 -59
  66. package/lib/services/proxy-services/post-microservice.js.map +1 -1
  67. package/lib/services/proxy-services/post-thread-microservice.d.ts +134 -4
  68. package/lib/services/proxy-services/post-thread-microservice.js +387 -10
  69. package/lib/services/proxy-services/post-thread-microservice.js.map +1 -1
  70. package/lib/services/proxy-services/reaction-microservice.d.ts +161 -3
  71. package/lib/services/proxy-services/reaction-microservice.js +474 -2
  72. package/lib/services/proxy-services/reaction-microservice.js.map +1 -1
  73. package/lib/services/reaction-service.d.ts +124 -4
  74. package/lib/services/reaction-service.js +415 -3
  75. package/lib/services/reaction-service.js.map +1 -1
  76. package/lib/store/models/channel.d.ts +2 -3
  77. package/lib/store/models/channel.js +169 -71
  78. package/lib/store/models/channel.js.map +1 -1
  79. package/lib/store/models/post-thread.d.ts +3 -3
  80. package/lib/store/models/post-thread.js +96 -14
  81. package/lib/store/models/post-thread.js.map +1 -1
  82. package/lib/store/models/post.d.ts +2 -3
  83. package/lib/store/models/post.js +85 -18
  84. package/lib/store/models/post.js.map +1 -1
  85. package/lib/store/models/reaction.d.ts +2 -3
  86. package/lib/store/models/reaction.js +67 -8
  87. package/lib/store/models/reaction.js.map +1 -1
  88. package/lib/store/repositories/channel-repository.d.ts +6 -6
  89. package/lib/store/repositories/channel-repository.js +5 -2
  90. package/lib/store/repositories/channel-repository.js.map +1 -1
  91. package/lib/store/repositories/post-repository.d.ts +6 -6
  92. package/lib/store/repositories/post-repository.js +5 -2
  93. package/lib/store/repositories/post-repository.js.map +1 -1
  94. package/lib/store/repositories/post-thread-repository.d.ts +6 -6
  95. package/lib/store/repositories/post-thread-repository.js +5 -2
  96. package/lib/store/repositories/post-thread-repository.js.map +1 -1
  97. package/lib/store/repositories/reaction-repository.d.ts +6 -6
  98. package/lib/store/repositories/reaction-repository.js +5 -2
  99. package/lib/store/repositories/reaction-repository.js.map +1 -1
  100. package/lib/templates/repositories/ChannelRepository.ts.template +3 -3
  101. package/lib/templates/repositories/PostRepository.ts.template +3 -3
  102. package/lib/templates/repositories/PostThreadRepository.ts.template +3 -3
  103. package/lib/templates/repositories/ReactionRepository.ts.template +3 -4
  104. package/lib/templates/services/ChannelService.ts.template +277 -38
  105. package/lib/templates/services/ExtendedTokenAccountService.ts.template +93 -8
  106. package/lib/templates/services/PostService.ts.template +182 -20
  107. package/lib/templates/services/PostThreadService.ts.template +100 -5
  108. package/lib/templates/services/ReactionService.ts.template +129 -2
  109. package/package.json +3 -3
  110. package/lib/store/models/common-options.js +0 -20
  111. package/lib/store/models/common-options.js.map +0 -1
@@ -1,44 +1,206 @@
1
+ /**
2
+ * Post Service Interface
3
+ * ----------------------
4
+ *
5
+ * This interface defines the business logic layer for post and message management
6
+ * within the messenger platform. It provides comprehensive operations for handling
7
+ * messages, file attachments, threading, and message state management across
8
+ * different channels and communication contexts.
9
+ *
10
+ * Key capabilities:
11
+ * - Post lifecycle management (creation, updates, deletion)
12
+ * - File upload and attachment handling (single and batch operations)
13
+ * - Message threading and conversation management
14
+ * - Message delivery and read status tracking
15
+ * - File management and cleanup operations
16
+ * - Cross-channel message coordination
17
+ * - Post-thread relationship management
18
+ * - Message state synchronization
19
+ *
20
+ * The service layer abstracts complex messaging operations and provides a
21
+ * cohesive API for post-related functionality throughout the messaging platform,
22
+ * handling file storage, threading logic, and message state consistency.
23
+ */
24
+
1
25
  import { IBaseService } from '@common-stack/store-mongo';
2
- import { IFileInfo, IMessageIdentifier, IPost, IPostThread, IThreadMessageInput, IUploadedFileInput } from 'common/server';
26
+ import {
27
+ IFileInfo,
28
+ IMessageIdentifier,
29
+ IPost,
30
+ IPostModel,
31
+ IPostThread,
32
+ IThreadMessageInput,
33
+ IUploadedFileInput,
34
+ Disposable,
35
+ AsDomainType
36
+ } from 'common/server';
3
37
 
4
- export interface IPostServiceInput extends Omit<IPost, 'id' | 'files' | 'isRead' | 'isDelivered'> {
38
+ /**
39
+ * Post Service Input Interface
40
+ *
41
+ * @description Input parameters for post creation operations,
42
+ * excluding auto-generated and system-managed fields.
43
+ */
44
+ export interface IPostServiceInput extends Omit<IPostModel, 'id' | 'files' | 'isRead' | 'isDelivered' | '_id'> {
45
+ /** Array of file identifiers to attach to the post */
5
46
  files: string[];
47
+ /** Optional MongoDB ObjectId for the post */
6
48
  _id?: any;
7
49
  }
8
50
 
51
+ /**
52
+ * Post Thread Creation Options
53
+ *
54
+ * @description Configuration parameters for creating posts with associated threads.
55
+ */
9
56
  export type CreatePostThreadOptions = {
57
+ /** Thread message input data */
10
58
  threadMessageInput: IThreadMessageInput;
59
+ /** Channel identifier where the post will be created */
11
60
  channelId: string;
61
+ /** Optional responder user identifier */
12
62
  responderId?: string;
63
+ /** Optional parent post identifier for threading */
13
64
  postParentId?: string;
65
+ /** Optional existing post identifier */
14
66
  postId?: string;
67
+ /** Account identifier of the post creator */
15
68
  accountId: string;
69
+ /** Optional organization identifier */
16
70
  orgId?: string;
71
+ /** Optional existing post thread identifier */
17
72
  postThreadId?: string;
18
73
  };
19
74
 
20
- export interface IPostService extends IBaseService<IPost, IPostServiceInput, Partial<IPost>> {
21
- createFileUploadLink(postId: string, filename: string, userId: string): Promise<string>;
22
- attachUploadedFile(postId: string, file: IUploadedFileInput, createdBy: string): Promise<IFileInfo>;
75
+ /**
76
+ * Post Service Interface
77
+ *
78
+ * @description Provides comprehensive post and message management capabilities
79
+ * including file handling, threading, and message state management.
80
+ */
81
+ export interface IPostService extends IBaseService<IPostModel, IPostServiceInput, Partial<IPostModel>>, Disposable {
82
+ /**
83
+ * Creates a file upload link for a specific post
84
+ *
85
+ * @description Generates a secure upload URL for attaching a single file
86
+ * to an existing post, handling authentication and storage permissions.
87
+ *
88
+ * @param {string} postId - The unique identifier of the post
89
+ * @param {string} filename - The name of the file to upload
90
+ * @param {string} userId - The identifier of the user performing the upload
91
+ * @returns {Promise<string | Error>} - Upload URL or error
92
+ */
93
+ createFileUploadLink(postId: string, filename: string, userId: string): Promise<string | Error>;
94
+
95
+ /**
96
+ * Attaches an uploaded file to a post
97
+ *
98
+ * @description Associates a successfully uploaded file with a post,
99
+ * updating the post's file attachments and metadata.
100
+ *
101
+ * @param {string} postId - The unique identifier of the post
102
+ * @param {IUploadedFileInput} file - The uploaded file information
103
+ * @param {string} createdBy - The identifier of the user who uploaded the file
104
+ * @returns {Promise<IFileInfo | Error>} - File information or error
105
+ */
106
+ attachUploadedFile(postId: string, file: IUploadedFileInput, createdBy: string): Promise<IFileInfo | Error>;
107
+
108
+ /**
109
+ * Creates multiple file upload links for a post
110
+ *
111
+ * @description Generates secure upload URLs for attaching multiple files
112
+ * to an existing post in a single operation.
113
+ *
114
+ * @param {string} postId - The unique identifier of the post
115
+ * @param {string[]} filenames - Array of file names to upload
116
+ * @param {string} userId - The identifier of the user performing the upload
117
+ * @returns {Promise<string[] | Error>} - Array of upload URLs or error
118
+ */
119
+ createFilesUploadLink(postId: string, filenames: string[], userId: string): Promise<string[] | Error>;
120
+
121
+ /**
122
+ * Attaches multiple uploaded files to a post
123
+ *
124
+ * @description Associates multiple successfully uploaded files with a post
125
+ * in a single batch operation, optimizing performance and consistency.
126
+ *
127
+ * @param {string} postId - The unique identifier of the post
128
+ * @param {IUploadedFileInput[]} files - Array of uploaded file information
129
+ * @param {string} createdBy - The identifier of the user who uploaded the files
130
+ * @returns {Promise<IFileInfo[] | Error>} - Array of file information or error
131
+ */
132
+ attachUploadedFiles(postId: string, files: IUploadedFileInput[], createdBy: string): Promise<IFileInfo[] | Error>;
133
+
134
+ /**
135
+ * Deletes a file from storage
136
+ *
137
+ * @description Permanently removes a file from the storage system,
138
+ * typically used for cleanup or when files are no longer needed.
139
+ *
140
+ * @param {string} url - The URL or identifier of the file to delete
141
+ * @returns {Promise<boolean | Error>} - Success status or error
142
+ */
143
+ deleteFile(url: string): Promise<boolean | Error>;
23
144
 
24
- createFilesUploadLink(postId: string, filenames: string[], userId: string): Promise<string[]>;
25
- attachUploadedFiles(postId: string, files: IUploadedFileInput[], createdBy: string): Promise<IFileInfo[]>;
145
+ /**
146
+ * Marks a message as read by a user
147
+ *
148
+ * @description Updates the read status of a message for a specific user,
149
+ * affecting unread counts and notification states.
150
+ *
151
+ * @param {IMessageIdentifier} messageId - The message identifier
152
+ * @param {string} user - The identifier of the user marking the message as read
153
+ * @returns {Promise<boolean | Error>} - Success status or error
154
+ */
155
+ readMessage(messageId: IMessageIdentifier, user: string): Promise<boolean | Error>;
26
156
 
27
- deleteFile(url: string): Promise<boolean>;
157
+ /**
158
+ * Marks a message as delivered to a user
159
+ *
160
+ * @description Updates the delivery status of a message, indicating
161
+ * successful delivery to the target user's device or client.
162
+ *
163
+ * @param {IMessageIdentifier} messageId - The message identifier
164
+ * @param {string} user - The identifier of the user who received the message
165
+ * @returns {Promise<boolean | Error>} - Success status or error
166
+ */
167
+ deliverMessage(messageId: IMessageIdentifier, user: string): Promise<boolean | Error>;
28
168
 
29
- readMessage(messageId: IMessageIdentifier, user: string): Promise<boolean>;
169
+ /**
170
+ * Creates a post without triggering subscriptions
171
+ *
172
+ * @description Creates a new post while bypassing real-time subscription
173
+ * notifications, useful for bulk operations or system-generated content.
174
+ *
175
+ * @param {IPostServiceInput} data - The post creation data
176
+ * @returns {Promise<AsDomainType<IPostModel> | Error>} - Created post or error
177
+ */
178
+ createWithoutSubscription(data: IPostServiceInput): Promise<AsDomainType<IPostModel> | Error>;
30
179
 
31
- deliverMessage(messageId: IMessageIdentifier, user: string): Promise<boolean>;
32
- createWithoutSubscription(data: IPostServiceInput): Promise<IPost>;
180
+ /**
181
+ * Creates a post with an associated thread
182
+ *
183
+ * @description Creates both a post and its associated thread in a single
184
+ * transaction, ensuring data consistency and proper relationship setup.
185
+ *
186
+ * @param {CreatePostThreadOptions} options - The post and thread creation options
187
+ * @returns {Promise<{ post: AsDomainType<IPostModel>; postThread: IPostThread } | Error>} - Created post and thread or error
188
+ */
189
+ createPostWithPostThread(options: CreatePostThreadOptions): Promise<{ post: AsDomainType<IPostModel>; postThread: IPostThread } | Error>;
33
190
 
34
- createPostWithPostThread({
35
- threadMessageInput,
36
- channelId,
37
- responderId,
38
- postParentId,
39
- postId,
40
- accountId,
41
- }: CreatePostThreadOptions): Promise<{ post: IPost; postThread: IPostThread }>;
191
+ /**
192
+ * Retrieves the most recent message from a channel
193
+ *
194
+ * @description Fetches the latest post/message from a specific channel,
195
+ * useful for displaying channel previews and recent activity.
196
+ *
197
+ * @param {string} channelId - The unique identifier of the channel
198
+ * @returns {Promise<AsDomainType<IPostModel> | Error>} - Latest message or error
199
+ */
200
+ getLastMessage(channelId: string): Promise<AsDomainType<IPostModel> | Error>;
42
201
 
43
- getLastMessage(channelId: string): Promise<IPost>;
202
+ /**
203
+ * Disposes of resources used by the service
204
+ */
205
+ dispose(): void;
44
206
  }
@@ -1,11 +1,106 @@
1
- import { IPostThread } from 'common/server';
1
+ /**
2
+ * Post Thread Service Interface
3
+ * -----------------------------
4
+ *
5
+ * This interface defines the business logic layer for post thread management
6
+ * within the messenger platform. It provides comprehensive operations for handling
7
+ * threaded conversations, reply management, and discussion organization across
8
+ * different channels and messaging contexts.
9
+ *
10
+ * Key capabilities:
11
+ * - Thread lifecycle management (creation, updates, deletion)
12
+ * - Reply and response tracking within threads
13
+ * - Thread participant management and notifications
14
+ * - Thread statistics and metrics collection
15
+ * - Nested conversation organization
16
+ * - Thread visibility and access control
17
+ * - Cross-channel thread coordination
18
+ * - Thread state synchronization
19
+ *
20
+ * The service layer abstracts complex threading operations and provides a
21
+ * cohesive API for thread-related functionality throughout the messaging platform,
22
+ * handling conversation hierarchies, participant tracking, and thread state management.
23
+ */
24
+
25
+ import { IPostThread, IPostThreadModel, Disposable, AsDomainType } from 'common/server';
2
26
  import { IBaseService } from '@common-stack/store-mongo';
3
27
 
4
- export interface IPostThreadServiceInput extends Omit<IPostThread, 'id'> {}
28
+ /**
29
+ * Post Thread Service Input Interface
30
+ *
31
+ * @description Input parameters for post thread creation operations,
32
+ * excluding auto-generated fields like ID.
33
+ */
34
+ export interface IPostThreadServiceInput extends Omit<IPostThreadModel, 'id'> {}
5
35
 
6
36
  // export type IPostThreadService = IBaseService<IPostThread>;
7
37
 
8
- export interface IPostThreadService extends IBaseService<IPostThread> {
9
- getPostThread(data: any): Promise<IPostThread>;
10
- getPostThreadCount(data: any): Promise<Number>;
38
+ /**
39
+ * Post Thread Service Interface
40
+ *
41
+ * @description Provides comprehensive post thread management capabilities
42
+ * including thread creation, participant tracking, and conversation organization.
43
+ */
44
+ export interface IPostThreadService extends IBaseService<IPostThreadModel, IPostThreadServiceInput, Partial<IPostThreadModel>>, Disposable {
45
+ /**
46
+ * Retrieves a specific post thread with its metadata
47
+ *
48
+ * @description Fetches a complete post thread including all replies,
49
+ * participant information, and thread statistics for display and interaction.
50
+ *
51
+ * @param {any} data - Thread query parameters and filters
52
+ * @returns {Promise<AsDomainType<IPostThreadModel> | Error>} - Post thread data or error
53
+ */
54
+ getPostThread(data: any): Promise<AsDomainType<IPostThreadModel> | Error>;
55
+
56
+ /**
57
+ * Retrieves the total count of posts within a thread
58
+ *
59
+ * @description Calculates and returns the number of posts/replies
60
+ * within a specific thread for pagination and display purposes.
61
+ *
62
+ * @param {any} data - Thread identification and counting parameters
63
+ * @returns {Promise<number | Error>} - Thread post count or error
64
+ */
65
+ getPostThreadCount(data: any): Promise<number | Error>;
66
+
67
+ /**
68
+ * Updates a post thread
69
+ */
70
+ updateThread(threadId: string, updates: Partial<IPostThreadServiceInput>): Promise<AsDomainType<IPostThreadModel> | Error>;
71
+
72
+ /**
73
+ * Deletes a post thread
74
+ */
75
+ deleteThread(threadId: string): Promise<boolean | Error>;
76
+
77
+ /**
78
+ * Gets threads by post ID
79
+ */
80
+ getThreadsByPost(postId: string): Promise<Array<AsDomainType<IPostThreadModel>> | Error>;
81
+
82
+ /**
83
+ * Gets threads by channel with pagination
84
+ */
85
+ getThreadsByChannel(channelId: string, limit?: number, offset?: number): Promise<Array<AsDomainType<IPostThreadModel>> | Error>;
86
+
87
+ /**
88
+ * Gets thread participants
89
+ */
90
+ getThreadParticipants(threadId: string): Promise<Array<string> | Error>;
91
+
92
+ /**
93
+ * Adds a participant to a thread
94
+ */
95
+ addParticipant(threadId: string, userId: string): Promise<boolean | Error>;
96
+
97
+ /**
98
+ * Removes a participant from a thread
99
+ */
100
+ removeParticipant(threadId: string, userId: string): Promise<boolean | Error>;
101
+
102
+ /**
103
+ * Disposes of resources used by the service
104
+ */
105
+ dispose(): void;
11
106
  }
@@ -1,7 +1,134 @@
1
- import { IReaction, IReactionInput } from 'common/server';
1
+ /**
2
+ * Reaction Service Interface
3
+ * --------------------------
4
+ *
5
+ * This interface defines the business logic layer for reaction management
6
+ * within the messenger platform. It provides comprehensive operations for handling
7
+ * emoji reactions, sentiment tracking, and user engagement features across
8
+ * posts, messages, and other interactive content.
9
+ *
10
+ * Key capabilities:
11
+ * - Reaction lifecycle management (addition, removal, updates)
12
+ * - Emoji and custom reaction support
13
+ * - User reaction tracking and analytics
14
+ * - Reaction aggregation and statistics
15
+ * - Cross-platform reaction synchronization
16
+ * - Reaction notification management
17
+ * - Bulk reaction operations
18
+ * - Reaction validation and moderation
19
+ *
20
+ * The service layer abstracts reaction operations and provides a cohesive API
21
+ * for engagement-related functionality throughout the messaging platform,
22
+ * handling user interactions, emotion tracking, and social engagement metrics.
23
+ */
24
+
25
+ import { IReaction, IReactionModel, IReactionInput, Disposable, AsDomainType } from 'common/server';
2
26
  import { IBaseService } from '@common-stack/store-mongo';
3
27
 
28
+ /**
29
+ * Reaction Service Input Interface
30
+ *
31
+ * @description Input parameters for reaction creation and management operations,
32
+ * including user context and reaction metadata.
33
+ */
4
34
  export interface IReactionServiceInput extends IReactionInput {
35
+ /** User identifier who is creating or managing the reaction */
5
36
  user: string;
6
37
  }
7
- export type IReactionService = IBaseService<IReaction, IReactionServiceInput, Partial<IReactionInput>>;
38
+
39
+ /**
40
+ * Reaction Service Interface
41
+ *
42
+ * @description Provides comprehensive reaction management capabilities
43
+ * including emoji reactions, user engagement tracking, and reaction analytics.
44
+ */
45
+ export interface IReactionService extends IBaseService<IReactionModel, IReactionServiceInput, Partial<IReactionInput>>, Disposable {
46
+ /**
47
+ * Adds a reaction to a post or message
48
+ *
49
+ * @description Creates a new reaction entry for a specific content item,
50
+ * handling duplicate detection and user validation.
51
+ *
52
+ * @param {IReactionServiceInput} data - Reaction creation data including user and reaction type
53
+ * @returns {Promise<AsDomainType<IReactionModel> | Error>} - Created reaction or error
54
+ */
55
+ addReaction(data: IReactionServiceInput): Promise<AsDomainType<IReactionModel> | Error>;
56
+
57
+ /**
58
+ * Removes a reaction from a post or message
59
+ *
60
+ * @description Deletes an existing reaction entry, ensuring proper user
61
+ * authorization and content validation.
62
+ *
63
+ * @param {string} reactionId - The unique identifier of the reaction to remove
64
+ * @param {string} userId - The identifier of the user removing the reaction
65
+ * @returns {Promise<boolean | Error>} - Success status or error
66
+ */
67
+ removeReaction(reactionId: string, userId: string): Promise<boolean | Error>;
68
+
69
+ /**
70
+ * Retrieves all reactions for a specific content item
71
+ *
72
+ * @description Fetches reaction data with aggregation and user information
73
+ * for display in the user interface.
74
+ *
75
+ * @param {string} contentId - The identifier of the content (post, message, etc.)
76
+ * @param {string} contentType - The type of content being reacted to
77
+ * @returns {Promise<Array<AsDomainType<IReactionModel>> | Error>} - Array of reactions or error
78
+ */
79
+ getReactionsByContent(contentId: string, contentType: string): Promise<Array<AsDomainType<IReactionModel>> | Error>;
80
+
81
+ /**
82
+ * Retrieves reaction statistics for content
83
+ *
84
+ * @description Provides aggregated reaction counts and statistics
85
+ * for analytics and display purposes.
86
+ *
87
+ * @param {string} contentId - The identifier of the content
88
+ * @param {string} contentType - The type of content
89
+ * @returns {Promise<any | Error>} - Reaction statistics or error
90
+ */
91
+ getReactionStats(contentId: string, contentType: string): Promise<any | Error>;
92
+
93
+ /**
94
+ * Checks if a user has reacted to specific content
95
+ *
96
+ * @description Determines whether a user has already reacted to
97
+ * a piece of content, useful for UI state management.
98
+ *
99
+ * @param {string} contentId - The identifier of the content
100
+ * @param {string} userId - The identifier of the user
101
+ * @param {string} reactionType - The type of reaction to check
102
+ * @returns {Promise<boolean | Error>} - True if user has reacted, or error
103
+ */
104
+ hasUserReacted(contentId: string, userId: string, reactionType: string): Promise<boolean | Error>;
105
+
106
+ /**
107
+ * Updates an existing reaction
108
+ *
109
+ * @description Modifies an existing reaction, typically changing
110
+ * the reaction type while maintaining the same user and content association.
111
+ *
112
+ * @param {string} reactionId - The unique identifier of the reaction
113
+ * @param {Partial<IReactionInput>} updates - The reaction updates to apply
114
+ * @returns {Promise<AsDomainType<IReactionModel> | Error>} - Updated reaction or error
115
+ */
116
+ updateReaction(reactionId: string, updates: Partial<IReactionInput>): Promise<AsDomainType<IReactionModel> | Error>;
117
+
118
+ /**
119
+ * Removes all reactions from specific content
120
+ *
121
+ * @description Bulk removes all reactions from a content item,
122
+ * typically used during content deletion or moderation.
123
+ *
124
+ * @param {string} contentId - The identifier of the content
125
+ * @param {string} contentType - The type of content
126
+ * @returns {Promise<number | Error>} - Number of reactions removed or error
127
+ */
128
+ removeAllReactionsByContent(contentId: string, contentType: string): Promise<number | Error>;
129
+
130
+ /**
131
+ * Disposes of resources used by the service
132
+ */
133
+ dispose(): void;
134
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@messenger-box/platform-server",
3
- "version": "10.0.3-alpha.50",
3
+ "version": "10.0.3-alpha.54",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@container-stack/mailing-api": "5.4.1-alpha.2",
23
- "@messenger-box/core": "10.0.3-alpha.50",
23
+ "@messenger-box/core": "10.0.3-alpha.54",
24
24
  "@skoropletov/moleculer-cron-tasks": "~0.0.8",
25
25
  "date-fns": "^4.1.0"
26
26
  },
@@ -69,5 +69,5 @@
69
69
  "typescript": {
70
70
  "definition": "lib/index.d.ts"
71
71
  },
72
- "gitHead": "04bd383c41b79ec5f5f2254d8886b8ab2761eaab"
72
+ "gitHead": "7b4c5e0acfbb4bfc3aefab287374d5739c40b4bc"
73
73
  }
@@ -1,20 +0,0 @@
1
- const commonModeSchemaOptions = {
2
- timestamps: true,
3
- toJSON: {
4
- virtuals: true
5
- },
6
- toObject: {
7
- virtuals: true,
8
- getters: true,
9
- transform(doc, ret) {
10
- delete ret.__v;
11
- delete ret._id;
12
- }
13
- }
14
- };
15
- const addIdVirtualFields = schema => {
16
- schema.set('toJSON', {
17
- virtuals: true
18
- });
19
- return schema;
20
- };export{addIdVirtualFields,commonModeSchemaOptions};//# sourceMappingURL=common-options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common-options.js","sources":["../../../src/store/models/common-options.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGa,MAAA,uBAAuB,GAAG;AACnC,EAAA,UAAA,EAAU,IAAM;AAChB,EAAA,MAAA,EAAM;AACF,IAAA,QAAA,EAAA;AACH,GAAA;AACD,EAAA,QAAA,EAAQ;AACJ,IAAA,QAAA,EAAA,IAAU;AACV,IAAA,OAAA,EAAA,IAAS;aACA,CAAA,GAAA,EAAI,GAAA,EAAK;aACP,GAAA,CAAA,GAAA;aACA,GAAA,CAAA,GAAA;;AAEd;;AAGQ,MAAA,kBAAkB,GAAG,MAAC,IAAkB;AACjD,EAAA,MAAA,CAAA,GAAO,CAAA,QAAI,EAAQ;AACf,IAAA,QAAA,EAAA;AACH,GAAA,CAAA;AACD,EAAA,OAAA;AACJ"}