UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 7.04 kB
import{queryFormatted as e,queryString as t}from"./helpers/querystring.mjs";import n from"zod";const r=n.union([n.literal(`sent`),n.literal(`delivered`),n.literal(`delayed`),n.literal(`complained`),n.literal(`bounced`),n.literal(`clicked`),n.literal(`failed`),n.literal(`opened`),n.literal(`scheduled`)]),i=n.union([n.literal(`external`),n.literal(`internal`)]),a=n.union([n.literal(`low`),n.literal(`normal`),n.literal(`high`)]),o=n.object({id:n.number().meta({description:`The email ID`,example:1}),mailDetails:n.object({from:n.object({address:n.email().meta({description:`The sender's email address`,example:`admin@lucidcms.io`}),name:n.string().meta({description:`The sender's name`,example:`Admin`})}),to:n.string().meta({description:`The recipient's email address`,example:`user@example.com`}),subject:n.string().meta({description:`The email subject line`,example:`Welcome to Lucid CMS`}),cc:n.string().nullable().meta({description:`Carbon copy recipients (comma-separated)`,example:`manager@example.com,team@example.com`}),bcc:n.string().nullable().meta({description:`Blind carbon copy recipients (comma-separated)`,example:`logs@example.com`}),template:n.string().meta({description:`The template identifier used for generating the email content`,example:`welcome-email`}),priority:a.meta({description:`The priority hint supplied to the email adapter`,example:`high`})}),data:n.record(n.any(),n.any()).nullable().meta({description:`Custom data passed to the email template for rendering`,example:{username:`JohnDoe`,accountType:`premium`,verificationUrl:`https://example.com/verify/token123`}}),attachments:n.array(n.object({type:n.literal(`url`).meta({description:`The attachment source type`,example:`url`}),url:n.url().meta({description:`The HTTP/S URL used as the attachment source`,example:`https://example.com/invoice.pdf`}),filename:n.string().meta({description:`The filename shown for the attachment`,example:`invoice.pdf`}),contentType:n.string().nullable().meta({description:`The MIME type of the attachment, if supplied`,example:`application/pdf`}),disposition:n.union([n.literal(`attachment`),n.literal(`inline`)]).meta({description:`Whether the attachment is displayed inline or as an attachment`,example:`attachment`}),contentId:n.string().nullable().meta({description:`The optional CID used for inline attachments`,example:`invoice-logo`})})),type:i.meta({description:`Whether the email was triggered internally from Lucid, or externally via an endpoint`,example:`internal`}),currentStatus:r.meta({description:`The current delivery status of the email`,example:`sent`}),attemptCount:n.number().meta({description:`The number of attempts to send the email`,example:1}),html:n.string().nullable().meta({description:`The rendered HTML content of the email template`}),resend:n.object({enabled:n.boolean().meta({description:`Whether this email can currently be resent`,example:!0}),reason:n.enum([`outsideResendWindow`,`unstoredData`]).optional().meta({description:`Why resend is disabled, if unavailable`,example:`outsideResendWindow`})}),transactions:n.array(n.object({deliveryStatus:r.meta({description:`The current delivery status of the email`,example:`sent`}),message:n.string().nullable().meta({description:`The message associated with the email delivery`,example:`Email sent successfully`}),strategyIdentifier:n.string().meta({description:`The identifier of the strategy used to send the email`,example:`smtp`}),strategyData:n.record(n.string(),n.any()).nullable().meta({description:`The data associated with the email delivery`,example:{username:`JohnDoe`,accountType:`premium`,verificationUrl:`https://example.com/verify/token123`}}),externalMessageId:n.string().nullable().meta({description:`The external message ID of the email. Used for tracking the email in the provider's system.`,example:`1234567890`}),simulate:n.boolean().meta({description:`Whether the email was simulated and not actually sent`,example:!0}),createdAt:n.string().nullable().meta({description:`Timestamp when the email was created`,example:`2024-04-25T14:30:00.000Z`}),updatedAt:n.string().nullable().meta({description:`Timestamp of the most recent delivery attempt`,example:`2024-04-25T14:31:10.000Z`})})),lastAttemptedAt:n.string().nullable().meta({description:`The timestamp of the last attempt to send the email`,example:`2024-04-25T14:30:00.000Z`}),createdAt:n.string().nullable().meta({description:`Timestamp when the email was created`,example:`2024-04-25T14:30:00.000Z`}),updatedAt:n.string().nullable().meta({description:`Timestamp of the most recent delivery attempt`,example:`2024-04-25T14:31:10.000Z`})}),s={getMultiple:{body:void 0,query:{string:n.object({"filter[fromAddress]":t.schema.filter(!1,{example:`noreply@lucidcms.io`}),"filter[toAddress]":t.schema.filter(!1,{example:`admin@lucidcms.io`}),"filter[subject]":t.schema.filter(!1,{example:`Welcome To Lucid`}),"filter[currentStatus]":t.schema.filter(!0,{example:`sent`}),"filter[type]":t.schema.filter(!0,{example:`internal`}),"filter[template]":t.schema.filter(!1,{example:`password-reset`}),"filter[priority]":t.schema.filter(!0,{example:`high`}),"filter[attemptCount]":t.schema.filter(!1,{example:`2`}),"filter[lastAttemptedAt]":t.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),"filter[createdAt]":t.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),"filter[updatedAt]":t.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),sort:t.schema.sort(`lastAttemptedAt,attemptCount,createdAt,updatedAt`),page:t.schema.page,perPage:t.schema.perPage}).meta(t.meta),formatted:n.object({filter:n.object({fromAddress:e.schema.filters.single.optional(),toAddress:e.schema.filters.single.optional(),subject:e.schema.filters.single.optional(),currentStatus:e.schema.filters.union.optional(),type:e.schema.filters.union.optional(),template:e.schema.filters.single.optional(),priority:e.schema.filters.union.optional(),attemptCount:e.schema.filters.single.optional(),lastAttemptedAt:e.schema.filters.single.optional(),createdAt:e.schema.filters.single.optional(),updatedAt:e.schema.filters.single.optional()}).optional(),filterOr:e.schema.filterOr,sort:n.array(n.object({key:n.enum([`lastAttemptedAt`,`attemptCount`,`createdAt`,`updatedAt`]),direction:n.enum([`asc`,`desc`])})).optional(),page:e.schema.page,perPage:e.schema.perPage})},params:void 0,response:n.array(o)},getSingle:{body:void 0,query:{string:void 0,formatted:void 0},params:n.object({id:n.string().trim().meta({description:`The email ID`,example:1})}),response:o},deleteSingle:{body:void 0,query:{string:void 0,formatted:void 0},params:n.object({id:n.string().trim().meta({description:`The email ID`,example:1})}),response:void 0},resendSingle:{body:void 0,query:{string:void 0,formatted:void 0},params:n.object({id:n.string().trim().meta({description:`The email ID`,example:1})}),response:n.object({jobId:n.string().meta({description:`The job ID`,example:`1234567890`})})}};export{s as controllerSchemas,r as emailDeliveryStatusSchema,a as emailPrioritySchema,i as emailTypeSchema}; //# sourceMappingURL=email.mjs.map