chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:34:48 +08:00
commit 77bb5bf71f
3762 changed files with 353249 additions and 0 deletions
@@ -0,0 +1,24 @@
import { z } from '@botpress/sdk'
import { EMAIL_ADDRESS_DESCRIPTION, EmailAddressSchema, NonBlankString } from './common'
/** The common send email input schema which will be exposed to users in Botpress Studio */
export const sendMailInputSchema = z.object({
from: EmailAddressSchema.describe(EMAIL_ADDRESS_DESCRIPTION).title('Email Sender'),
to: EmailAddressSchema.describe(EMAIL_ADDRESS_DESCRIPTION).title('Email Recipient'),
cc: z.array(EmailAddressSchema).optional().describe('List of carbon copy recipients').title('Carbon Copy'),
bcc: z
.array(EmailAddressSchema)
.optional()
.describe('List of blind carbon copy recipients')
.title('Blind Carbon Copy'),
subject: NonBlankString.describe('The subject of the email (e.g. How to build a bot with Botpress!)').title(
'Email Subject'
),
body: NonBlankString.describe('The markdown rich-text body of the email').title('Email Body'), // TODO: Think of an example to place here
replyTo: EmailAddressSchema.describe(EMAIL_ADDRESS_DESCRIPTION).title('Reply To').optional(),
})
/** The response schema for Resend's send email endpoint for successful requests. */
export const sendEmailOutputSchema = z.object({
emailId: NonBlankString.or(z.null()).describe('The id of a successfully sent email').title('Email ID'),
})
+18
View File
@@ -0,0 +1,18 @@
import { z } from '@botpress/sdk'
/** A string that must contain at least 1 non-whitespace character.
*
* @remark This can still be an optional field */
export const NonBlankString = z.string().trim().min(1)
/** A common description that should apply to all Email Address Fields.
*
* @remark Using this constant so it can be re-used in multiple other schemas.
* This is because the linter doesn't detect the "describe" if I were to bind
* it to the "EmailAddressSchema" definition */
export const EMAIL_ADDRESS_DESCRIPTION = 'The email address of the correspondent (e.g. example@example.com)'
/** A string that represents an email address.
*
* @remark "correspondent" can refer to both the sender and the receiver of an email. */
export const EmailAddressSchema = NonBlankString.email().brand('Email')
+65
View File
@@ -0,0 +1,65 @@
import { z } from '@botpress/sdk'
import { emailHeaderSchema, emailTagSchema } from '../src/webhook-events/schemas/email'
const _baseWebhookEmailEventSchema = z.object({
emailId: z.string().optional().describe('The ID for the sent email').title('Email ID'),
createdAt: z
.string()
.datetime()
.describe('An ISO8601 datetime representing when the event was triggered')
.title('Event datetime'),
subject: z.string().describe('The subject of the email').title('Email subject'),
from: z.string().describe('The sender of the email').title('Email sender'),
to: z.array(z.string()).min(1).describe('The recipients of the email').title('Email recipients'),
cc: z.array(z.string()).min(1).optional().describe('The carbon copy recipients of the email').title('Carbon Copy'),
bcc: z
.array(z.string())
.min(1)
.optional()
.describe('The blind carbon copy recipients of the email')
.title('Blind Carbon Copy'),
headers: z.array(emailHeaderSchema).min(1).optional().describe('The headers of the email').title('Email headers'),
tags: z.array(emailTagSchema).min(1).optional().describe('The tags of the email').title('Email tags'),
})
export const sentEmailEventSchema = _baseWebhookEmailEventSchema
export const delayedDeliveryEmailEventSchema = _baseWebhookEmailEventSchema
export const deliveredEmailEventSchema = _baseWebhookEmailEventSchema
export const markedAsSpamEmailEventSchema = _baseWebhookEmailEventSchema
const _emailErrorEventSchema = _baseWebhookEmailEventSchema.extend({
reason: z.string().describe('The reason this event was triggered').title('Event reason'),
})
export const bouncedEmailEventSchema = _emailErrorEventSchema.extend({
type: z
.string()
.describe('The Resend type for why the email bounced (e.g. "Permanent", "Transient", "Undetermined")')
.title('Bounce type'),
subtype: z
.string()
.describe('The Resend subtype for why the email bounced (e.g. "General", "NoEmail", "MailboxFull", etc.)')
.title('Bounce subtype'),
})
export const openedEmailEventSchema = _baseWebhookEmailEventSchema.extend({
openedAt: z
.string()
.datetime()
.describe('An ISO8601 datetime representing when the email was opened')
.title('Email opened datetime'),
})
export const clickedEmailLinkEventSchema = _baseWebhookEmailEventSchema.extend({
clickedAt: z
.string()
.datetime()
.describe('An ISO8601 datetime representing when a link in the email was clicked')
.title('Link clicked datetime'),
url: z.string().describe('The destination URL of the link that was clicked').title('Clicked URL'),
})
export const failedToSendEmailEventSchema = _emailErrorEventSchema