mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 08:13:23 +00:00
- Validate that 'from' field is not removed - Validate that 'to' field is not removed or emptied - Validate that 'subject' field is not removed - Validate that at least 'html' or 'text' content exists - Throw clear error messages if validation fails - Bump version to 0.1.21
719 lines
15 KiB
TypeScript
719 lines
15 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
/**
|
|
* This file was automatically generated by Payload.
|
|
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
|
|
* and re-run `payload generate:types` to regenerate this file.
|
|
*/
|
|
|
|
/**
|
|
* Supported timezones in IANA format.
|
|
*
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "supportedTimezones".
|
|
*/
|
|
export type SupportedTimezones =
|
|
| 'Pacific/Midway'
|
|
| 'Pacific/Niue'
|
|
| 'Pacific/Honolulu'
|
|
| 'Pacific/Rarotonga'
|
|
| 'America/Anchorage'
|
|
| 'Pacific/Gambier'
|
|
| 'America/Los_Angeles'
|
|
| 'America/Tijuana'
|
|
| 'America/Denver'
|
|
| 'America/Phoenix'
|
|
| 'America/Chicago'
|
|
| 'America/Guatemala'
|
|
| 'America/New_York'
|
|
| 'America/Bogota'
|
|
| 'America/Caracas'
|
|
| 'America/Santiago'
|
|
| 'America/Buenos_Aires'
|
|
| 'America/Sao_Paulo'
|
|
| 'Atlantic/South_Georgia'
|
|
| 'Atlantic/Azores'
|
|
| 'Atlantic/Cape_Verde'
|
|
| 'Europe/London'
|
|
| 'Europe/Berlin'
|
|
| 'Africa/Lagos'
|
|
| 'Europe/Athens'
|
|
| 'Africa/Cairo'
|
|
| 'Europe/Moscow'
|
|
| 'Asia/Riyadh'
|
|
| 'Asia/Dubai'
|
|
| 'Asia/Baku'
|
|
| 'Asia/Karachi'
|
|
| 'Asia/Tashkent'
|
|
| 'Asia/Calcutta'
|
|
| 'Asia/Dhaka'
|
|
| 'Asia/Almaty'
|
|
| 'Asia/Jakarta'
|
|
| 'Asia/Bangkok'
|
|
| 'Asia/Shanghai'
|
|
| 'Asia/Singapore'
|
|
| 'Asia/Tokyo'
|
|
| 'Asia/Seoul'
|
|
| 'Australia/Brisbane'
|
|
| 'Australia/Sydney'
|
|
| 'Pacific/Guam'
|
|
| 'Pacific/Noumea'
|
|
| 'Pacific/Auckland'
|
|
| 'Pacific/Fiji';
|
|
|
|
export interface Config {
|
|
auth: {
|
|
users: UserAuthOperations;
|
|
};
|
|
blocks: {};
|
|
collections: {
|
|
users: User;
|
|
posts: Post;
|
|
media: Media;
|
|
'email-templates': EmailTemplate;
|
|
emails: Email;
|
|
'payload-jobs': PayloadJob;
|
|
'payload-locked-documents': PayloadLockedDocument;
|
|
'payload-preferences': PayloadPreference;
|
|
'payload-migrations': PayloadMigration;
|
|
};
|
|
collectionsJoins: {};
|
|
collectionsSelect: {
|
|
users: UsersSelect<false> | UsersSelect<true>;
|
|
posts: PostsSelect<false> | PostsSelect<true>;
|
|
media: MediaSelect<false> | MediaSelect<true>;
|
|
'email-templates': EmailTemplatesSelect<false> | EmailTemplatesSelect<true>;
|
|
emails: EmailsSelect<false> | EmailsSelect<true>;
|
|
'payload-jobs': PayloadJobsSelect<false> | PayloadJobsSelect<true>;
|
|
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
|
|
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
|
|
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
|
|
};
|
|
db: {
|
|
defaultIDType: string;
|
|
};
|
|
globals: {};
|
|
globalsSelect: {};
|
|
locale: null;
|
|
user: User & {
|
|
collection: 'users';
|
|
};
|
|
jobs: {
|
|
tasks: {
|
|
processEmails: ProcessEmailsJob;
|
|
'send-email': TaskSendEmail;
|
|
inline: {
|
|
input: unknown;
|
|
output: unknown;
|
|
};
|
|
};
|
|
workflows: unknown;
|
|
};
|
|
}
|
|
export interface UserAuthOperations {
|
|
forgotPassword: {
|
|
email: string;
|
|
password: string;
|
|
};
|
|
login: {
|
|
email: string;
|
|
password: string;
|
|
};
|
|
registerFirstUser: {
|
|
email: string;
|
|
password: string;
|
|
};
|
|
unlock: {
|
|
email: string;
|
|
password: string;
|
|
};
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "users".
|
|
*/
|
|
export interface User {
|
|
id: string;
|
|
firstName?: string | null;
|
|
lastName?: string | null;
|
|
updatedAt: string;
|
|
createdAt: string;
|
|
email: string;
|
|
resetPasswordToken?: string | null;
|
|
resetPasswordExpiration?: string | null;
|
|
salt?: string | null;
|
|
hash?: string | null;
|
|
loginAttempts?: number | null;
|
|
lockUntil?: string | null;
|
|
sessions?:
|
|
| {
|
|
id: string;
|
|
createdAt?: string | null;
|
|
expiresAt: string;
|
|
}[]
|
|
| null;
|
|
password?: string | null;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "posts".
|
|
*/
|
|
export interface Post {
|
|
id: string;
|
|
updatedAt: string;
|
|
createdAt: string;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "media".
|
|
*/
|
|
export interface Media {
|
|
id: string;
|
|
updatedAt: string;
|
|
createdAt: string;
|
|
url?: string | null;
|
|
thumbnailURL?: string | null;
|
|
filename?: string | null;
|
|
mimeType?: string | null;
|
|
filesize?: number | null;
|
|
width?: number | null;
|
|
height?: number | null;
|
|
focalX?: number | null;
|
|
focalY?: number | null;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "email-templates".
|
|
*/
|
|
export interface EmailTemplate {
|
|
id: string;
|
|
/**
|
|
* A descriptive name for this email template
|
|
*/
|
|
name: string;
|
|
/**
|
|
* Unique identifier for this template (e.g., "welcome-email", "password-reset")
|
|
*/
|
|
slug: string;
|
|
/**
|
|
* Email subject line. You can use Handlebars variables like {{firstName}} or {{siteName}}.
|
|
*/
|
|
subject: string;
|
|
/**
|
|
* Email content with rich text formatting. Supports Handlebars variables like {{firstName}} and helpers like {{formatDate createdAt "long"}}. Content is converted to HTML and plain text automatically.
|
|
*/
|
|
content: {
|
|
root: {
|
|
type: string;
|
|
children: {
|
|
type: string;
|
|
version: number;
|
|
[k: string]: unknown;
|
|
}[];
|
|
direction: ('ltr' | 'rtl') | null;
|
|
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
|
indent: number;
|
|
version: number;
|
|
};
|
|
[k: string]: unknown;
|
|
};
|
|
updatedAt: string;
|
|
createdAt: string;
|
|
}
|
|
/**
|
|
* Email delivery and status tracking
|
|
*
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "emails".
|
|
*/
|
|
export interface Email {
|
|
id: string;
|
|
/**
|
|
* Email template used (optional if custom content provided)
|
|
*/
|
|
template?: (string | null) | EmailTemplate;
|
|
/**
|
|
* Recipient email addresses
|
|
*/
|
|
to: string[];
|
|
/**
|
|
* CC email addresses
|
|
*/
|
|
cc?: string[] | null;
|
|
/**
|
|
* BCC email addresses
|
|
*/
|
|
bcc?: string[] | null;
|
|
/**
|
|
* Sender email address (optional, uses default if not provided)
|
|
*/
|
|
from?: string | null;
|
|
/**
|
|
* Sender display name (optional, e.g., "John Doe" for "John Doe <john@example.com>")
|
|
*/
|
|
fromName?: string | null;
|
|
/**
|
|
* Reply-to email address
|
|
*/
|
|
replyTo?: string | null;
|
|
/**
|
|
* Email subject line
|
|
*/
|
|
subject: string;
|
|
/**
|
|
* Rendered HTML content of the email
|
|
*/
|
|
html: string;
|
|
/**
|
|
* Plain text version of the email
|
|
*/
|
|
text?: string | null;
|
|
/**
|
|
* Template variables used to render this email
|
|
*/
|
|
variables?:
|
|
| {
|
|
[k: string]: unknown;
|
|
}
|
|
| unknown[]
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null;
|
|
/**
|
|
* When this email should be sent (leave empty for immediate)
|
|
*/
|
|
scheduledAt?: string | null;
|
|
/**
|
|
* When this email was actually sent
|
|
*/
|
|
sentAt?: string | null;
|
|
/**
|
|
* Current status of this email
|
|
*/
|
|
status: 'pending' | 'processing' | 'sent' | 'failed';
|
|
/**
|
|
* Number of send attempts made
|
|
*/
|
|
attempts?: number | null;
|
|
/**
|
|
* When the last send attempt was made
|
|
*/
|
|
lastAttemptAt?: string | null;
|
|
/**
|
|
* Last error message if send failed
|
|
*/
|
|
error?: string | null;
|
|
/**
|
|
* Email priority (1=highest, 10=lowest)
|
|
*/
|
|
priority?: number | null;
|
|
updatedAt: string;
|
|
createdAt: string;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "payload-jobs".
|
|
*/
|
|
export interface PayloadJob {
|
|
id: string;
|
|
/**
|
|
* Input data provided to the job
|
|
*/
|
|
input?:
|
|
| {
|
|
[k: string]: unknown;
|
|
}
|
|
| unknown[]
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null;
|
|
taskStatus?:
|
|
| {
|
|
[k: string]: unknown;
|
|
}
|
|
| unknown[]
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null;
|
|
completedAt?: string | null;
|
|
totalTried?: number | null;
|
|
/**
|
|
* If hasError is true this job will not be retried
|
|
*/
|
|
hasError?: boolean | null;
|
|
/**
|
|
* If hasError is true, this is the error that caused it
|
|
*/
|
|
error?:
|
|
| {
|
|
[k: string]: unknown;
|
|
}
|
|
| unknown[]
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null;
|
|
/**
|
|
* Task execution log
|
|
*/
|
|
log?:
|
|
| {
|
|
executedAt: string;
|
|
completedAt: string;
|
|
taskSlug: 'inline' | 'processEmails' | 'send-email';
|
|
taskID: string;
|
|
input?:
|
|
| {
|
|
[k: string]: unknown;
|
|
}
|
|
| unknown[]
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null;
|
|
output?:
|
|
| {
|
|
[k: string]: unknown;
|
|
}
|
|
| unknown[]
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null;
|
|
state: 'failed' | 'succeeded';
|
|
error?:
|
|
| {
|
|
[k: string]: unknown;
|
|
}
|
|
| unknown[]
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null;
|
|
id?: string | null;
|
|
}[]
|
|
| null;
|
|
taskSlug?: ('inline' | 'processEmails' | 'send-email') | null;
|
|
queue?: string | null;
|
|
waitUntil?: string | null;
|
|
processing?: boolean | null;
|
|
updatedAt: string;
|
|
createdAt: string;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "payload-locked-documents".
|
|
*/
|
|
export interface PayloadLockedDocument {
|
|
id: string;
|
|
document?:
|
|
| ({
|
|
relationTo: 'users';
|
|
value: string | User;
|
|
} | null)
|
|
| ({
|
|
relationTo: 'posts';
|
|
value: string | Post;
|
|
} | null)
|
|
| ({
|
|
relationTo: 'media';
|
|
value: string | Media;
|
|
} | null)
|
|
| ({
|
|
relationTo: 'email-templates';
|
|
value: string | EmailTemplate;
|
|
} | null)
|
|
| ({
|
|
relationTo: 'emails';
|
|
value: string | Email;
|
|
} | null)
|
|
| ({
|
|
relationTo: 'payload-jobs';
|
|
value: string | PayloadJob;
|
|
} | null);
|
|
globalSlug?: string | null;
|
|
user: {
|
|
relationTo: 'users';
|
|
value: string | User;
|
|
};
|
|
updatedAt: string;
|
|
createdAt: string;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "payload-preferences".
|
|
*/
|
|
export interface PayloadPreference {
|
|
id: string;
|
|
user: {
|
|
relationTo: 'users';
|
|
value: string | User;
|
|
};
|
|
key?: string | null;
|
|
value?:
|
|
| {
|
|
[k: string]: unknown;
|
|
}
|
|
| unknown[]
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null;
|
|
updatedAt: string;
|
|
createdAt: string;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "payload-migrations".
|
|
*/
|
|
export interface PayloadMigration {
|
|
id: string;
|
|
name?: string | null;
|
|
batch?: number | null;
|
|
updatedAt: string;
|
|
createdAt: string;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "users_select".
|
|
*/
|
|
export interface UsersSelect<T extends boolean = true> {
|
|
firstName?: T;
|
|
lastName?: T;
|
|
updatedAt?: T;
|
|
createdAt?: T;
|
|
email?: T;
|
|
resetPasswordToken?: T;
|
|
resetPasswordExpiration?: T;
|
|
salt?: T;
|
|
hash?: T;
|
|
loginAttempts?: T;
|
|
lockUntil?: T;
|
|
sessions?:
|
|
| T
|
|
| {
|
|
id?: T;
|
|
createdAt?: T;
|
|
expiresAt?: T;
|
|
};
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "posts_select".
|
|
*/
|
|
export interface PostsSelect<T extends boolean = true> {
|
|
updatedAt?: T;
|
|
createdAt?: T;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "media_select".
|
|
*/
|
|
export interface MediaSelect<T extends boolean = true> {
|
|
updatedAt?: T;
|
|
createdAt?: T;
|
|
url?: T;
|
|
thumbnailURL?: T;
|
|
filename?: T;
|
|
mimeType?: T;
|
|
filesize?: T;
|
|
width?: T;
|
|
height?: T;
|
|
focalX?: T;
|
|
focalY?: T;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "email-templates_select".
|
|
*/
|
|
export interface EmailTemplatesSelect<T extends boolean = true> {
|
|
name?: T;
|
|
slug?: T;
|
|
subject?: T;
|
|
content?: T;
|
|
updatedAt?: T;
|
|
createdAt?: T;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "emails_select".
|
|
*/
|
|
export interface EmailsSelect<T extends boolean = true> {
|
|
template?: T;
|
|
to?: T;
|
|
cc?: T;
|
|
bcc?: T;
|
|
from?: T;
|
|
fromName?: T;
|
|
replyTo?: T;
|
|
subject?: T;
|
|
html?: T;
|
|
text?: T;
|
|
variables?: T;
|
|
scheduledAt?: T;
|
|
sentAt?: T;
|
|
status?: T;
|
|
attempts?: T;
|
|
lastAttemptAt?: T;
|
|
error?: T;
|
|
priority?: T;
|
|
updatedAt?: T;
|
|
createdAt?: T;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "payload-jobs_select".
|
|
*/
|
|
export interface PayloadJobsSelect<T extends boolean = true> {
|
|
input?: T;
|
|
taskStatus?: T;
|
|
completedAt?: T;
|
|
totalTried?: T;
|
|
hasError?: T;
|
|
error?: T;
|
|
log?:
|
|
| T
|
|
| {
|
|
executedAt?: T;
|
|
completedAt?: T;
|
|
taskSlug?: T;
|
|
taskID?: T;
|
|
input?: T;
|
|
output?: T;
|
|
state?: T;
|
|
error?: T;
|
|
id?: T;
|
|
};
|
|
taskSlug?: T;
|
|
queue?: T;
|
|
waitUntil?: T;
|
|
processing?: T;
|
|
updatedAt?: T;
|
|
createdAt?: T;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "payload-locked-documents_select".
|
|
*/
|
|
export interface PayloadLockedDocumentsSelect<T extends boolean = true> {
|
|
document?: T;
|
|
globalSlug?: T;
|
|
user?: T;
|
|
updatedAt?: T;
|
|
createdAt?: T;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "payload-preferences_select".
|
|
*/
|
|
export interface PayloadPreferencesSelect<T extends boolean = true> {
|
|
user?: T;
|
|
key?: T;
|
|
value?: T;
|
|
updatedAt?: T;
|
|
createdAt?: T;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "payload-migrations_select".
|
|
*/
|
|
export interface PayloadMigrationsSelect<T extends boolean = true> {
|
|
name?: T;
|
|
batch?: T;
|
|
updatedAt?: T;
|
|
createdAt?: T;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "ProcessEmailsJob".
|
|
*/
|
|
export interface ProcessEmailsJob {
|
|
input?: unknown;
|
|
output?: unknown;
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "TaskSend-email".
|
|
*/
|
|
export interface TaskSendEmail {
|
|
input: {
|
|
/**
|
|
* Use a template (leave empty for direct email)
|
|
*/
|
|
templateSlug?: string | null;
|
|
/**
|
|
* JSON object with variables for template rendering
|
|
*/
|
|
variables?:
|
|
| {
|
|
[k: string]: unknown;
|
|
}
|
|
| unknown[]
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null;
|
|
/**
|
|
* Email subject (required if not using template)
|
|
*/
|
|
subject?: string | null;
|
|
/**
|
|
* HTML email content (required if not using template)
|
|
*/
|
|
html?: string | null;
|
|
/**
|
|
* Plain text email content (optional)
|
|
*/
|
|
text?: string | null;
|
|
/**
|
|
* Comma-separated list of email addresses
|
|
*/
|
|
to: string;
|
|
/**
|
|
* Optional comma-separated list of CC email addresses
|
|
*/
|
|
cc?: string | null;
|
|
/**
|
|
* Optional comma-separated list of BCC email addresses
|
|
*/
|
|
bcc?: string | null;
|
|
/**
|
|
* Optional sender email address (uses default if not provided)
|
|
*/
|
|
from?: string | null;
|
|
/**
|
|
* Optional sender display name (e.g., "John Doe")
|
|
*/
|
|
fromName?: string | null;
|
|
/**
|
|
* Optional reply-to email address
|
|
*/
|
|
replyTo?: string | null;
|
|
/**
|
|
* Optional date/time to schedule email for future delivery
|
|
*/
|
|
scheduledAt?: string | null;
|
|
/**
|
|
* Email priority (1 = highest, 10 = lowest)
|
|
*/
|
|
priority?: number | null;
|
|
};
|
|
output: {
|
|
id?: string | null;
|
|
};
|
|
}
|
|
/**
|
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
* via the `definition` "auth".
|
|
*/
|
|
export interface Auth {
|
|
[k: string]: unknown;
|
|
}
|
|
|
|
|
|
declare module 'payload' {
|
|
export interface GeneratedTypes extends Config {}
|
|
} |