/
githubmirror
/
novu
Обзор
Документация
Войти
/
githubmirror
/
novu
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
next
apps/api/src/app/events/usecases/parse-event-request/parse-event-request.command.ts
94 строки
3 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 { IsValidContextPayload } from '@novu/application-generic'; import { NotificationTemplateEntity } from '@novu/dal'; import { AddressingTypeEnum, ContextPayload, StatelessControls, TriggerOverrides, TriggerRecipientSubscriber, TriggerRecipientsPayload, TriggerRequestCategoryEnum, TriggerTenantContext, } from '@novu/shared'; import { IsDefined, IsEnum, IsOptional, IsString, ValidateIf, ValidateNested } from 'class-validator'; import { EnvironmentWithUserCommand } from '../../../shared/commands/project.command'; export class ParseEventRequestBaseCommand extends EnvironmentWithUserCommand { @IsDefined() @IsString() identifier: string; @IsDefined() payload: any; @IsDefined() overrides: TriggerOverrides; @IsOptional() @ValidateIf((_, value) => value !== null) @IsString() agentId?: string | null; @IsOptional() @ValidateIf((_, value) => value !== null) @IsString() _agentId?: string | null; @IsString() @IsOptional() transactionId?: string; @IsOptional() @ValidateIf((_, value) => typeof value !== 'string') @ValidateNested() actor?: TriggerRecipientSubscriber | null; @IsOptional() @ValidateNested() @ValidateIf((_, value) => typeof value !== 'string') tenant?: TriggerTenantContext | null; @IsOptional() @IsEnum(TriggerRequestCategoryEnum) requestCategory?: TriggerRequestCategoryEnum; @IsString() @IsOptional() bridgeUrl?: string; /** * A mapping of step IDs to their corresponding data. * Built for stateless triggering by the local studio, those values will not be persisted outside the job scope * First key is step id, second is controlId, value is the control value * @type {Record<stepId, Data>} * @optional */ controls?: StatelessControls; @IsString() requestId: string; @IsOptional() workflow?: Pick<NotificationTemplateEntity, '_id' | 'active' | 'payloadSchema' | 'validatePayload'>; @IsOptional() @IsValidContextPayload({ maxCount: 5 }) context?: ContextPayload; @IsOptional() skipQueueInsertion?: boolean; } export class ParseEventRequestMulticastCommand extends ParseEventRequestBaseCommand { @IsDefined() to: TriggerRecipientsPayload; @IsEnum(AddressingTypeEnum) addressingType: AddressingTypeEnum.MULTICAST; } export class ParseEventRequestBroadcastCommand extends ParseEventRequestBaseCommand { @IsEnum(AddressingTypeEnum) addressingType: AddressingTypeEnum.BROADCAST; } export type ParseEventRequestCommand = ParseEventRequestMulticastCommand | ParseEventRequestBroadcastCommand;