UNPKG

@lucidcms/core

Version:

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

2 lines 4.79 kB
import{queryFormatted as e,queryString as t}from"./helpers/querystring.mjs";import n from"zod";const r=n.union([n.literal(`pending`),n.literal(`processing`),n.literal(`completed`),n.literal(`failed`),n.literal(`cancelled`)]),i=n.object({id:n.number().meta({description:`The job ID`,example:1}),jobId:n.string().meta({description:`The unique job identifier`,example:`job_abc123`}),eventType:n.string().meta({description:`The type of event this job handles`,example:`email:send`}),eventData:n.record(n.string(),n.any()).meta({description:`The data associated with the job event`,example:{emailId:123,recipientEmail:`user@example.com`}}),queueAdapterKey:n.string().meta({description:`The queue adapter key used to process this job`,example:`passthrough`}),status:r.meta({description:`The current status of the job`,example:`completed`}),priority:n.number().nullable().meta({description:`The priority level of the job (higher = more priority)`,example:10}),attempts:n.number().meta({description:`The number of attempts made to process this job`,example:1}),maxAttempts:n.number().meta({description:`The maximum number of attempts allowed for this job`,example:3}),errorMessage:n.string().nullable().meta({description:`The error message if the job failed`,example:`Connection timeout`}),createdAt:n.string().nullable().meta({description:`Timestamp when the job was created`,example:`2024-04-25T14:30:00.000Z`}),scheduledFor:n.string().nullable().meta({description:`Timestamp when the job is scheduled to run`,example:`2024-04-25T14:30:00.000Z`}),startedAt:n.string().nullable().meta({description:`Timestamp when the job started processing`,example:`2024-04-25T14:30:05.000Z`}),completedAt:n.string().nullable().meta({description:`Timestamp when the job completed successfully`,example:`2024-04-25T14:30:10.000Z`}),failedAt:n.string().nullable().meta({description:`Timestamp when the job failed`,example:`2024-04-25T14:30:08.000Z`}),nextRetryAt:n.string().nullable().meta({description:`Timestamp when the job will be retried next`,example:`2024-04-25T14:35:00.000Z`}),createdByUserId:n.number().nullable().meta({description:`The ID of the user who created the job`,example:1}),updatedAt:n.string().nullable().meta({description:`Timestamp when the job was last updated`,example:`2024-04-25T14:30:10.000Z`})}),a={getMultiple:{body:void 0,query:{string:n.object({"filter[jobId]":t.schema.filter(!1,{example:`9d1fcfac-f491-43d4-a33b-4432b91a373c`}),"filter[eventType]":t.schema.filter(!1,{example:`email:send`}),"filter[status]":t.schema.filter(!0,{example:`completed`}),"filter[queueAdapterKey]":t.schema.filter(!1,{example:`passthrough`}),"filter[priority]":t.schema.filter(!1,{example:`5`}),"filter[attempts]":t.schema.filter(!1,{example:`1`}),"filter[maxAttempts]":t.schema.filter(!1,{example:`3`}),"filter[errorMessage]":t.schema.filter(!1,{example:`Connection refused`}),"filter[createdByUserId]":t.schema.filter(!1,{example:`1`}),"filter[createdAt]":t.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),"filter[scheduledFor]":t.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),"filter[startedAt]":t.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),"filter[completedAt]":t.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),"filter[failedAt]":t.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),"filter[nextRetryAt]":t.schema.filter(!1,{example:`2026-01-01T00:00:00Z`}),sort:t.schema.sort(`createdAt,scheduledFor,startedAt,completedAt,failedAt,priority,attempts`),page:t.schema.page,perPage:t.schema.perPage}).meta(t.meta),formatted:n.object({filter:n.object({jobId:e.schema.filters.single.optional(),eventType:e.schema.filters.single.optional(),status:e.schema.filters.union.optional(),queueAdapterKey:e.schema.filters.single.optional(),priority:e.schema.filters.single.optional(),attempts:e.schema.filters.single.optional(),maxAttempts:e.schema.filters.single.optional(),errorMessage:e.schema.filters.single.optional(),createdByUserId:e.schema.filters.single.optional(),createdAt:e.schema.filters.single.optional(),scheduledFor:e.schema.filters.single.optional(),startedAt:e.schema.filters.single.optional(),completedAt:e.schema.filters.single.optional(),failedAt:e.schema.filters.single.optional(),nextRetryAt:e.schema.filters.single.optional()}).optional(),filterOr:e.schema.filterOr,sort:n.array(n.object({key:n.enum([`createdAt`,`scheduledFor`,`startedAt`,`completedAt`,`failedAt`,`priority`,`attempts`]),direction:n.enum([`asc`,`desc`])})).optional(),page:e.schema.page,perPage:e.schema.perPage})},params:void 0,response:n.array(i)},getSingle:{body:void 0,query:{string:void 0,formatted:void 0},params:n.object({id:n.string().trim().meta({description:`The job ID`,example:1})}),response:i}};export{a as controllerSchemas,r as queueJobStatusSchema}; //# sourceMappingURL=jobs.mjs.map