mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-11 21:11:57 +00:00
UBERF-10925: Add js doc
Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
parent
66f840c4e5
commit
1563c96133
@ -16,7 +16,7 @@ import { type GaxiosResponse } from 'gaxios'
|
|||||||
import { gmail_v1 } from 'googleapis'
|
import { gmail_v1 } from 'googleapis'
|
||||||
import sanitizeHtml from 'sanitize-html'
|
import sanitizeHtml from 'sanitize-html'
|
||||||
|
|
||||||
import { PersonId, TxOperations, type MeasureContext } from '@hcengineering/core'
|
import { type MeasureContext, PersonId, TxOperations } from '@hcengineering/core'
|
||||||
import {
|
import {
|
||||||
createMessages,
|
createMessages,
|
||||||
parseEmailHeader,
|
parseEmailHeader,
|
||||||
|
@ -46,6 +46,32 @@ import { PersonSpacesCacheFactory } from './personSpaces'
|
|||||||
import { ChannelCache, ChannelCacheFactory } from './channel'
|
import { ChannelCache, ChannelCacheFactory } from './channel'
|
||||||
import { ThreadLookupService } from './thread'
|
import { ThreadLookupService } from './thread'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates mail messages in the platform
|
||||||
|
*
|
||||||
|
* This function processes an email message and creates corresponding chat messages. It handles:
|
||||||
|
* - Ensuring persons exist for email addresses
|
||||||
|
* - Finding or creating channels for participants
|
||||||
|
* - Creating threads for messages
|
||||||
|
* - Uploading attachments to storage
|
||||||
|
* - Sending message events to Kafka
|
||||||
|
*
|
||||||
|
* @param {BaseConfig} config - Configuration options including storage and Kafka settings
|
||||||
|
* @param {MeasureContext} ctx - Context for logging and performance measurement
|
||||||
|
* @param {TxOperations} txClient - Client for database transactions
|
||||||
|
* @param {KeyValueClient} keyValueClient - Client for key-value storage operations
|
||||||
|
* @param {Producer} producer - Kafka producer for sending message events
|
||||||
|
* @param {string} token - Authentication token for API calls
|
||||||
|
* @param {WorkspaceLoginInfo} wsInfo - Workspace information including ID and URLs
|
||||||
|
* @param {EmailMessage} message - The email message to process
|
||||||
|
* @param {Attachment[]} attachments - Array of attachments for the message
|
||||||
|
* @param {PersonId[]} [targetPersons] - Optional list of specific persons who should receive the message.
|
||||||
|
* If not provided, all existing accounts from email addresses will be used.
|
||||||
|
* @returns {Promise<void>} A promise that resolves when all messages have been created
|
||||||
|
* @throws Will log errors but not throw exceptions for partial failures
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export async function createMessages (
|
export async function createMessages (
|
||||||
config: BaseConfig,
|
config: BaseConfig,
|
||||||
ctx: MeasureContext,
|
ctx: MeasureContext,
|
||||||
@ -56,7 +82,6 @@ export async function createMessages (
|
|||||||
wsInfo: WorkspaceLoginInfo,
|
wsInfo: WorkspaceLoginInfo,
|
||||||
message: EmailMessage,
|
message: EmailMessage,
|
||||||
attachments: Attachment[],
|
attachments: Attachment[],
|
||||||
// Persons who should receive messages in the platform, all existing accounts from email addresses by default
|
|
||||||
targetPersons?: PersonId[]
|
targetPersons?: PersonId[]
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { mailId, from, subject, replyTo } = message
|
const { mailId, from, subject, replyTo } = message
|
||||||
|
Loading…
Reference in New Issue
Block a user