/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
libs/application-generic/src/utils/subscribers.utils.ts
48 строк
2 KB
Nikita Grossman
feat(dashboard,api-service): add workflow agent assignment fixes NV-8422 (#12139)
03 авг 2026, 11:04
Не верифицирован
03 авг 2026, 11:04
4d89e07
Код
Авторство
О чём код?
import { ISubscribersDefine, SubscriberSourceEnum } from '@novu/shared'; import { IProcessSubscriberBulkJobDto, SubscriberTopicPreference } from '../dtos'; import { BaseTriggerCommand } from '../usecases/trigger-base/trigger-base.usecase'; export function mapSubscribersToJobs( subscriberSource: SubscriberSourceEnum, subscribers: { subscriberId: string; topics?: SubscriberTopicPreference[] }[] | ISubscribersDefine[], command: BaseTriggerCommand ): IProcessSubscriberBulkJobDto[] { return subscribers.map((subscriber) => { const job: IProcessSubscriberBulkJobDto = { name: command.transactionId + subscriber.subscriberId, data: { environmentId: command.environmentId, organizationId: command.organizationId, userId: command.userId, contextKeys: command.contextKeys, ...(command.context && { context: command.context }), transactionId: command.transactionId, requestId: command.requestId, identifier: command.identifier, payload: command.payload, overrides: command.overrides, ...(command._agentId !== undefined && { _agentId: command._agentId }), subscriber, topics: subscriber.topics, templateId: command.template._id, _subscriberSource: subscriberSource, requestCategory: command.requestCategory, controls: command.controls, bridge: { url: command.bridgeUrl, workflow: command.bridgeWorkflow, }, }, groupId: command.organizationId, }; if (command.actor) { job.data.actor = command.actor; } if (command.tenant) { job.data.tenant = command.tenant; } return job; }); }