@@ -2,6 +2,9 @@ import { IsDefined, IsObject, IsOptional, IsString, ValidateIf, ValidateNested }
2
2
import { Type } from 'class-transformer' ;
3
3
import { ApiExtraModels , ApiHideProperty , ApiProperty , ApiPropertyOptional , getSchemaPath } from '@nestjs/swagger' ;
4
4
import {
5
+ EmailProviderIdEnum ,
6
+ ProvidersIdEnum ,
7
+ ProvidersIdEnumConst ,
5
8
TriggerRecipientsPayload ,
6
9
TriggerRecipientsTypeEnum ,
7
10
TriggerRecipientSubscriber ,
@@ -24,9 +27,9 @@ export class WorkflowToStepControlValuesDto {
24
27
type : 'object' ,
25
28
additionalProperties : {
26
29
type : 'object' ,
27
- additionalProperties : true , // Allows any additional properties
30
+ additionalProperties : true ,
28
31
} ,
29
- required : false , // Indicates that this property is optional
32
+ required : false ,
30
33
} )
31
34
steps ?: Record < string , Record < string , unknown > > ;
32
35
}
@@ -45,7 +48,59 @@ export class TopicPayloadDto {
45
48
type : TriggerRecipientsTypeEnum ;
46
49
}
47
50
48
- @ApiExtraModels ( SubscriberPayloadDto , TenantPayloadDto , TopicPayloadDto )
51
+ export class StepsOverrides {
52
+ @ApiProperty ( {
53
+ description : 'Passing the provider id and the provider specific configurations' ,
54
+ example : {
55
+ sendgrid : {
56
+ templateId : '1234567890' ,
57
+ } ,
58
+ } ,
59
+ type : 'object' ,
60
+ additionalProperties : {
61
+ type : 'object' ,
62
+ additionalProperties : true ,
63
+ } ,
64
+ } )
65
+ providers : Record < ProvidersIdEnum , Record < string , unknown > > ;
66
+ }
67
+
68
+ export class TriggerOverrides {
69
+ @ApiProperty ( {
70
+ description : 'This could be used to override provider specific configurations' ,
71
+ example : {
72
+ 'email-step' : {
73
+ providers : {
74
+ sendgrid : {
75
+ templateId : '1234567890' ,
76
+ } ,
77
+ } ,
78
+ } ,
79
+ } ,
80
+ type : 'object' ,
81
+ additionalProperties : {
82
+ $ref : getSchemaPath ( StepsOverrides ) ,
83
+ } ,
84
+ } )
85
+ steps ?: Record < string , StepsOverrides > ;
86
+
87
+ @ApiProperty ( {
88
+ description : 'Overrides the provider configuration for the entire workflow and all steps' ,
89
+ example : {
90
+ sendgrid : {
91
+ templateId : '1234567890' ,
92
+ } ,
93
+ } ,
94
+ type : 'object' ,
95
+ additionalProperties : {
96
+ type : 'object' ,
97
+ additionalProperties : true ,
98
+ } ,
99
+ } )
100
+ providers ?: Record < ProvidersIdEnum , Record < string , unknown > > ;
101
+ }
102
+
103
+ @ApiExtraModels ( SubscriberPayloadDto , TenantPayloadDto , TopicPayloadDto , StepsOverrides )
49
104
export class TriggerEventRequestDto {
50
105
@SdkApiProperty (
51
106
{
@@ -91,16 +146,16 @@ export class TriggerEventRequestDto {
91
146
} ,
92
147
} ,
93
148
} ,
94
- type : 'object' ,
149
+ type : TriggerOverrides ,
95
150
additionalProperties : {
96
151
type : 'object' ,
97
- additionalProperties : true , // Allows any additional properties
152
+ additionalProperties : true ,
98
153
} ,
99
- required : false , // Indicates that this property is optional
154
+ required : false ,
100
155
} )
101
156
@IsObject ( )
102
157
@IsOptional ( )
103
- overrides ?: Record < string , Record < string , unknown > > ;
158
+ overrides ?: TriggerOverrides ;
104
159
105
160
@ApiProperty ( {
106
161
description : 'The recipients list of people who will receive the notification.' ,
0 commit comments