Skip to content

Commit 2476a74

Browse files
committed
fix: items
1 parent 08a2484 commit 2476a74

File tree

3 files changed

+540
-26
lines changed

3 files changed

+540
-26
lines changed

apps/api/src/app/events/dtos/trigger-event-request.dto.ts

+30-4
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,36 @@ export class TriggerOverrides {
9898
},
9999
})
100100
providers?: Record<ProvidersIdEnum, Record<string, unknown>>;
101+
102+
@ApiProperty({
103+
description: 'Override the email provider specific configurations for the entire workflow',
104+
deprecated: true,
105+
})
106+
email?: Record<string, unknown>;
107+
108+
@ApiProperty({
109+
description: 'Override the push provider specific configurations for the entire workflow',
110+
deprecated: true,
111+
})
112+
push?: Record<string, any>;
113+
114+
@ApiProperty({
115+
description: 'Override the sms provider specific configurations for the entire workflow',
116+
deprecated: true,
117+
})
118+
sms?: Record<string, any>;
119+
120+
@ApiProperty({
121+
description: 'Override the chat provider specific configurations for the entire workflow',
122+
deprecated: true,
123+
})
124+
chat?: Record<string, any>;
125+
126+
@ApiProperty({
127+
description: 'Override the layout identifier for the entire workflow',
128+
deprecated: true,
129+
})
130+
layoutIdentifier?: string;
101131
}
102132

103133
@ApiExtraModels(SubscriberPayloadDto, TenantPayloadDto, TopicPayloadDto, StepsOverrides)
@@ -147,10 +177,6 @@ export class TriggerEventRequestDto {
147177
},
148178
},
149179
type: TriggerOverrides,
150-
additionalProperties: {
151-
type: 'object',
152-
additionalProperties: true,
153-
},
154180
required: false,
155181
})
156182
@IsObject()

libs/internal-sdk/src/models/components/triggereventrequestdto.ts

+233-22
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44

55
import * as z from "zod";
66
import { remap as remap$ } from "../../lib/primitives.js";
7-
import {
8-
collectExtraKeys as collectExtraKeys$,
9-
safeParse,
10-
} from "../../lib/schemas.js";
7+
import { safeParse } from "../../lib/schemas.js";
118
import { Result as SafeParseResult } from "../../types/fp.js";
129
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
1310
import {
@@ -35,6 +32,34 @@ import {
3532
TopicPayloadDto$outboundSchema,
3633
} from "./topicpayloaddto.js";
3734

35+
/**
36+
* Override the email provider specific configurations for the entire workflow
37+
*
38+
* @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible.
39+
*/
40+
export type Email = {};
41+
42+
/**
43+
* Override the push provider specific configurations for the entire workflow
44+
*
45+
* @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible.
46+
*/
47+
export type Push = {};
48+
49+
/**
50+
* Override the sms provider specific configurations for the entire workflow
51+
*
52+
* @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible.
53+
*/
54+
export type Sms = {};
55+
56+
/**
57+
* Override the chat provider specific configurations for the entire workflow
58+
*
59+
* @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible.
60+
*/
61+
export type Chat = {};
62+
3863
/**
3964
* This could be used to override provider specific configurations
4065
*/
@@ -47,7 +72,36 @@ export type Overrides = {
4772
* Overrides the provider configuration for the entire workflow and all steps
4873
*/
4974
providers?: { [k: string]: { [k: string]: any } } | undefined;
50-
additionalProperties?: { [k: string]: { [k: string]: any } };
75+
/**
76+
* Override the email provider specific configurations for the entire workflow
77+
*
78+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
79+
*/
80+
email?: Email | undefined;
81+
/**
82+
* Override the push provider specific configurations for the entire workflow
83+
*
84+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
85+
*/
86+
push?: Push | undefined;
87+
/**
88+
* Override the sms provider specific configurations for the entire workflow
89+
*
90+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
91+
*/
92+
sms?: Sms | undefined;
93+
/**
94+
* Override the chat provider specific configurations for the entire workflow
95+
*
96+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
97+
*/
98+
chat?: Chat | undefined;
99+
/**
100+
* Override the layout identifier for the entire workflow
101+
*
102+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
103+
*/
104+
layoutIdentifier?: string | undefined;
51105
};
52106

53107
export type One = TopicPayloadDto | SubscriberPayloadDto | string;
@@ -122,25 +176,185 @@ export type TriggerEventRequestDto = {
122176
tenant?: TenantPayloadDto | string | undefined;
123177
};
124178

179+
/** @internal */
180+
export const Email$inboundSchema: z.ZodType<Email, z.ZodTypeDef, unknown> = z
181+
.object({});
182+
183+
/** @internal */
184+
export type Email$Outbound = {};
185+
186+
/** @internal */
187+
export const Email$outboundSchema: z.ZodType<
188+
Email$Outbound,
189+
z.ZodTypeDef,
190+
Email
191+
> = z.object({});
192+
193+
/**
194+
* @internal
195+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
196+
*/
197+
export namespace Email$ {
198+
/** @deprecated use `Email$inboundSchema` instead. */
199+
export const inboundSchema = Email$inboundSchema;
200+
/** @deprecated use `Email$outboundSchema` instead. */
201+
export const outboundSchema = Email$outboundSchema;
202+
/** @deprecated use `Email$Outbound` instead. */
203+
export type Outbound = Email$Outbound;
204+
}
205+
206+
export function emailToJSON(email: Email): string {
207+
return JSON.stringify(Email$outboundSchema.parse(email));
208+
}
209+
210+
export function emailFromJSON(
211+
jsonString: string,
212+
): SafeParseResult<Email, SDKValidationError> {
213+
return safeParse(
214+
jsonString,
215+
(x) => Email$inboundSchema.parse(JSON.parse(x)),
216+
`Failed to parse 'Email' from JSON`,
217+
);
218+
}
219+
220+
/** @internal */
221+
export const Push$inboundSchema: z.ZodType<Push, z.ZodTypeDef, unknown> = z
222+
.object({});
223+
224+
/** @internal */
225+
export type Push$Outbound = {};
226+
227+
/** @internal */
228+
export const Push$outboundSchema: z.ZodType<Push$Outbound, z.ZodTypeDef, Push> =
229+
z.object({});
230+
231+
/**
232+
* @internal
233+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
234+
*/
235+
export namespace Push$ {
236+
/** @deprecated use `Push$inboundSchema` instead. */
237+
export const inboundSchema = Push$inboundSchema;
238+
/** @deprecated use `Push$outboundSchema` instead. */
239+
export const outboundSchema = Push$outboundSchema;
240+
/** @deprecated use `Push$Outbound` instead. */
241+
export type Outbound = Push$Outbound;
242+
}
243+
244+
export function pushToJSON(push: Push): string {
245+
return JSON.stringify(Push$outboundSchema.parse(push));
246+
}
247+
248+
export function pushFromJSON(
249+
jsonString: string,
250+
): SafeParseResult<Push, SDKValidationError> {
251+
return safeParse(
252+
jsonString,
253+
(x) => Push$inboundSchema.parse(JSON.parse(x)),
254+
`Failed to parse 'Push' from JSON`,
255+
);
256+
}
257+
258+
/** @internal */
259+
export const Sms$inboundSchema: z.ZodType<Sms, z.ZodTypeDef, unknown> = z
260+
.object({});
261+
262+
/** @internal */
263+
export type Sms$Outbound = {};
264+
265+
/** @internal */
266+
export const Sms$outboundSchema: z.ZodType<Sms$Outbound, z.ZodTypeDef, Sms> = z
267+
.object({});
268+
269+
/**
270+
* @internal
271+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
272+
*/
273+
export namespace Sms$ {
274+
/** @deprecated use `Sms$inboundSchema` instead. */
275+
export const inboundSchema = Sms$inboundSchema;
276+
/** @deprecated use `Sms$outboundSchema` instead. */
277+
export const outboundSchema = Sms$outboundSchema;
278+
/** @deprecated use `Sms$Outbound` instead. */
279+
export type Outbound = Sms$Outbound;
280+
}
281+
282+
export function smsToJSON(sms: Sms): string {
283+
return JSON.stringify(Sms$outboundSchema.parse(sms));
284+
}
285+
286+
export function smsFromJSON(
287+
jsonString: string,
288+
): SafeParseResult<Sms, SDKValidationError> {
289+
return safeParse(
290+
jsonString,
291+
(x) => Sms$inboundSchema.parse(JSON.parse(x)),
292+
`Failed to parse 'Sms' from JSON`,
293+
);
294+
}
295+
296+
/** @internal */
297+
export const Chat$inboundSchema: z.ZodType<Chat, z.ZodTypeDef, unknown> = z
298+
.object({});
299+
300+
/** @internal */
301+
export type Chat$Outbound = {};
302+
303+
/** @internal */
304+
export const Chat$outboundSchema: z.ZodType<Chat$Outbound, z.ZodTypeDef, Chat> =
305+
z.object({});
306+
307+
/**
308+
* @internal
309+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
310+
*/
311+
export namespace Chat$ {
312+
/** @deprecated use `Chat$inboundSchema` instead. */
313+
export const inboundSchema = Chat$inboundSchema;
314+
/** @deprecated use `Chat$outboundSchema` instead. */
315+
export const outboundSchema = Chat$outboundSchema;
316+
/** @deprecated use `Chat$Outbound` instead. */
317+
export type Outbound = Chat$Outbound;
318+
}
319+
320+
export function chatToJSON(chat: Chat): string {
321+
return JSON.stringify(Chat$outboundSchema.parse(chat));
322+
}
323+
324+
export function chatFromJSON(
325+
jsonString: string,
326+
): SafeParseResult<Chat, SDKValidationError> {
327+
return safeParse(
328+
jsonString,
329+
(x) => Chat$inboundSchema.parse(JSON.parse(x)),
330+
`Failed to parse 'Chat' from JSON`,
331+
);
332+
}
333+
125334
/** @internal */
126335
export const Overrides$inboundSchema: z.ZodType<
127336
Overrides,
128337
z.ZodTypeDef,
129338
unknown
130-
> = collectExtraKeys$(
131-
z.object({
132-
steps: z.record(StepsOverrides$inboundSchema).optional(),
133-
providers: z.record(z.record(z.any())).optional(),
134-
}).catchall(z.record(z.any())),
135-
"additionalProperties",
136-
true,
137-
);
339+
> = z.object({
340+
steps: z.record(StepsOverrides$inboundSchema).optional(),
341+
providers: z.record(z.record(z.any())).optional(),
342+
email: z.lazy(() => Email$inboundSchema).optional(),
343+
push: z.lazy(() => Push$inboundSchema).optional(),
344+
sms: z.lazy(() => Sms$inboundSchema).optional(),
345+
chat: z.lazy(() => Chat$inboundSchema).optional(),
346+
layoutIdentifier: z.string().optional(),
347+
});
138348

139349
/** @internal */
140350
export type Overrides$Outbound = {
141351
steps?: { [k: string]: StepsOverrides$Outbound } | undefined;
142352
providers?: { [k: string]: { [k: string]: any } } | undefined;
143-
[additionalProperties: string]: unknown;
353+
email?: Email$Outbound | undefined;
354+
push?: Push$Outbound | undefined;
355+
sms?: Sms$Outbound | undefined;
356+
chat?: Chat$Outbound | undefined;
357+
layoutIdentifier?: string | undefined;
144358
};
145359

146360
/** @internal */
@@ -151,14 +365,11 @@ export const Overrides$outboundSchema: z.ZodType<
151365
> = z.object({
152366
steps: z.record(StepsOverrides$outboundSchema).optional(),
153367
providers: z.record(z.record(z.any())).optional(),
154-
additionalProperties: z.record(z.record(z.any())),
155-
}).transform((v) => {
156-
return {
157-
...v.additionalProperties,
158-
...remap$(v, {
159-
additionalProperties: null,
160-
}),
161-
};
368+
email: z.lazy(() => Email$outboundSchema).optional(),
369+
push: z.lazy(() => Push$outboundSchema).optional(),
370+
sms: z.lazy(() => Sms$outboundSchema).optional(),
371+
chat: z.lazy(() => Chat$outboundSchema).optional(),
372+
layoutIdentifier: z.string().optional(),
162373
});
163374

164375
/**

0 commit comments

Comments
 (0)