Support variables file email attachment (#21613)
<!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/21613?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
This commit is contained in:
@@ -51,7 +51,11 @@ export { workflowLogicFunctionActionSettingsSchema } from './schemas/logic-funct
|
||||
export { workflowManualTriggerSchema } from './schemas/manual-trigger-schema';
|
||||
export { objectRecordSchema } from './schemas/object-record-schema';
|
||||
export { workflowSendEmailActionSchema } from './schemas/send-email-action-schema';
|
||||
export { workflowSendEmailActionSettingsSchema } from './schemas/send-email-action-settings-schema';
|
||||
export type { WorkflowEmailFiles } from './schemas/send-email-action-settings-schema';
|
||||
export {
|
||||
workflowEmailFilesSchema,
|
||||
workflowSendEmailActionSettingsSchema,
|
||||
} from './schemas/send-email-action-settings-schema';
|
||||
export { stepFilterGroupSchema } from './schemas/step-filter-group-schema';
|
||||
export { stepFilterSchema } from './schemas/step-filter-schema';
|
||||
export { workflowUpdateRecordActionSchema } from './schemas/update-record-action-schema';
|
||||
|
||||
@@ -2,6 +2,24 @@ import { z } from 'zod';
|
||||
import { baseWorkflowActionSettingsSchema } from './base-workflow-action-settings-schema';
|
||||
import { workflowFileSchema } from './workflow-file-action-schema';
|
||||
|
||||
export const workflowEmailFilesSchema = z
|
||||
.array(
|
||||
z.union([
|
||||
workflowFileSchema,
|
||||
z
|
||||
.string()
|
||||
.regex(
|
||||
/^{{[^{}]+}}$/,
|
||||
'Expected a workflow variable reference like {{stepId.path}}',
|
||||
)
|
||||
.describe('A workflow variable reference resolving to files'),
|
||||
]),
|
||||
)
|
||||
.optional()
|
||||
.default([]);
|
||||
|
||||
export type WorkflowEmailFiles = z.infer<typeof workflowEmailFilesSchema>;
|
||||
|
||||
export const workflowSendEmailActionSettingsSchema =
|
||||
baseWorkflowActionSettingsSchema.extend({
|
||||
input: z.object({
|
||||
@@ -13,7 +31,7 @@ export const workflowSendEmailActionSettingsSchema =
|
||||
}),
|
||||
subject: z.string().optional(),
|
||||
body: z.string().optional(),
|
||||
files: z.array(workflowFileSchema).optional().default([]),
|
||||
files: workflowEmailFilesSchema,
|
||||
inReplyTo: z.string().trim().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user