@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
112 lines (106 loc) • 3.79 kB
TypeScript
import * as fastify from 'fastify';
import { FastifyInstance } from 'fastify';
import * as http from 'http';
import { D as DocumentVersionType, C as ClientGetSingleQueryParams, L as LucidErrorData, a as ClientDocumentResponse, b as ClientGetMultipleQueryParams, c as LocalesResponse, E as EmailResponse, d as LucidConfig, e as Config } from './types-CPsn9Vky.js';
export { f as DatabaseAdapter, l as logger } from './types-CPsn9Vky.js';
export { default as z } from 'zod';
import 'kysely';
import 'fs';
import 'stream';
import 'kysely/helpers/sqlite';
import 'node:stream';
import 'vite';
/**
* The LucidError class should be used to throw errors in functions that sit outside of API request lifecycle. This class will log the error and optionally kill the process.
* @class
* @extends Error
* @param {string} data.message - The error message
* @param {string} [data.scope] - Used to identify the scope of the logged error
* @param {boolean} [data.kill] - If true, the process will exit with code 1
* @returns {void}
* @example
* throw new LucidError({
* message: "Cannot set a value to a read-only property",
* scope: "plugin-name",
* kill: true,
* });
*/
declare class LucidError extends Error {
scope?: string;
kill?: boolean;
constructor(data: {
message: string;
scope?: string;
kill?: boolean;
data?: Record<string, unknown>;
});
}
declare const _default$1: (fastify: FastifyInstance) => Promise<void>;
declare const toolkit: {
document: {
getSingle: (data_0: {
collectionKey: string;
status: Exclude<DocumentVersionType, "revision">;
query: ClientGetSingleQueryParams;
}) => Promise<{
error: LucidErrorData;
data: undefined;
} | {
error: undefined;
data: ClientDocumentResponse;
}>;
getMultiple: (data_0: {
collectionKey: string;
status: Exclude<DocumentVersionType, "revision">;
query: ClientGetMultipleQueryParams;
}) => Promise<{
error: LucidErrorData;
data: undefined;
} | {
error: undefined;
data: {
data: ClientDocumentResponse[];
count: number;
};
}>;
};
locale: {
getAll: () => Promise<{
error: LucidErrorData;
data: undefined;
} | {
error: undefined;
data: LocalesResponse[];
}>;
};
email: {
sendEmail: (data_0: {
to: string;
subject: string;
template: string;
cc?: string;
bcc?: string;
replyTo?: string;
data: {
[key: string]: unknown;
};
}) => Promise<{
error: LucidErrorData;
data: undefined;
} | {
error: undefined;
data: EmailResponse;
}>;
};
};
declare const _default: {
start: (config?: {
port?: number;
host?: string;
}) => Promise<void>;
config: (config: LucidConfig) => Promise<Config>;
fastify: fastify.FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<fastify.FastifyInstance<http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>> & {
__linterBrands: "SafePromiseLike";
};
};
export { LucidError, _default as default, _default$1 as lucidPlugin, toolkit };