@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1,490 lines (1,469 loc) • 188 kB
TypeScript
import z, { ZodType } from 'zod';
import { Kysely, Dialect, KyselyPlugin, ColumnDataType, ColumnDefinitionBuilder, ColumnType, Generated, JSONColumnType, Transaction, Migration, ComparisonOperatorExpression } from 'kysely';
import * as fastify from 'fastify';
import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
import * as fs from 'fs';
import * as stream from 'stream';
import { jsonArrayFrom } from 'kysely/helpers/sqlite';
import { Readable } from 'node:stream';
import { InlineConfig } from 'vite';
declare const _default: Readonly<{
locales: readonly ["en"];
tempDir: "./tmp";
swaggerRoutePrefix: "/documentation";
headers: {
accessToken: string;
csrf: string;
refreshToken: string;
clientIntegrationKey: string;
contentLocale: string;
};
seedDefaults: {
user: {
firstName: string;
lastName: string;
email: string;
username: string;
password: string;
superAdmin: boolean;
};
roles: {
name: string;
description: string;
permissions: Permission[];
}[];
};
fieldBuiler: {
maxRepeaterDepth: number;
};
collectionBuilder: {
isLocked: boolean;
useDrafts: boolean;
useRevisions: boolean;
useTranslations: boolean;
};
customFields: {
link: {
targets: string[];
};
};
query: {
page: number;
perPage: number;
};
locations: {
resetPassword: string;
};
errors: {
name: string;
message: string;
status: number;
code: undefined;
errorResponse: undefined;
};
emailTemplates: {
resetPassword: string;
userInvite: string;
passwordResetSuccess: string;
emailChanged: string;
};
rateLimit: {
max: number;
timeWindow: string;
};
runtimeStore: {
dist: string;
};
vite: {
outputDir: string;
dist: string;
mount: string;
html: string;
rootSelector: string;
buildMetadata: string;
port: number;
};
arguments: {
noCache: string;
};
brickTypes: {
readonly builder: "builder";
readonly fixed: "fixed";
};
db: {
prefix: string;
collectionKeysJoin: string;
generatedColumnPrefix: "_";
};
logScopes: {
readonly lucid: "lucid";
readonly migrations: "migrations";
readonly cron: "cron";
readonly config: "config";
readonly sync: "sync";
readonly query: "query";
};
retention: {
deletedCollections: number;
deletedLocales: number;
};
cronSchedule: "0 0 * * *";
csrfExpiration: 604800;
refreshTokenExpiration: 604800;
accessTokenExpiration: 300;
passwordResetTokenExpirationMinutes: 15;
userInviteTokenExpirationMinutes: 1440;
documentation: "https://lucidcms.io/getting-started";
lucidUi: "https://lucidui.io/";
mediaAwaitingSyncInterval: 3600000;
fastify: {
version: string;
};
}>;
type SupportedLocales = (typeof _default.locales)[number];
type LocaleValue = Partial<Record<SupportedLocales, string>> | string;
interface TranslationsObj {
localeCode: string;
value: string | null;
}
interface BrickConfigProps {
details?: {
name?: LocaleValue;
summary?: LocaleValue;
};
preview?: {
image?: string;
};
}
interface BrickConfig {
key: string;
details: {
name: LocaleValue;
summary?: LocaleValue;
};
preview?: {
image?: string;
};
}
type BrickTypes = (typeof _default.brickTypes)[keyof typeof _default.brickTypes];
declare abstract class DatabaseAdapter {
db: Kysely<LucidDB> | undefined;
adapter: string;
constructor(config: {
adapter: string;
dialect: Dialect;
plugins?: Array<KyselyPlugin>;
});
abstract initialise(): Promise<void>;
/**
* Return your Kysely DB's adapters jsonArrayFrom helper that aggregates a subquery into a JSON array
*/
abstract get jsonArrayFrom(): typeof jsonArrayFrom;
/**
* Configure the features your DB supports, default values and fallback data types
*/
abstract get config(): DatabaseConfig;
/**
* Infers the database schema. Uses the transaction client if provided, otherwise falls back to the base client
*/
abstract inferSchema(tx?: KyselyDB): Promise<InferredTable[]>;
/**
* Handles formatting of certain values based on the columns data type. This is used specifically for default values
*/
abstract formatDefaultValue(type: ColumnDataType, value: unknown): unknown;
/**
* Handles formatting of certain values based on the columns data type
* - booleans are returned as either a boolean or 1/0 depending on adapter support
* - json is stringified
*/
formatInsertValue<T>(type: ColumnDataType, value: unknown): T;
/**
* A helper for returning supported column data types
*/
getDataType(type: keyof DatabaseConfig["dataTypes"], ...args: unknown[]): ColumnDataType;
/**
* A helper for extending a column definition based on auto increment support
*/
primaryKeyColumnBuilder(col: ColumnDefinitionBuilder): ColumnDefinitionBuilder;
/**
* A helper for feature support
*/
supports(key: keyof DatabaseConfig["support"]): boolean;
/**
* A helper for accessing the config default values
*/
getDefault<T extends keyof DatabaseConfig["defaults"], K extends keyof DatabaseConfig["defaults"][T] | undefined = undefined>(type: T, key?: K): K extends keyof DatabaseConfig["defaults"][T] ? DatabaseConfig["defaults"][T][K] : DatabaseConfig["defaults"][T];
/**
* Runs all migrations that have not been ran yet. This doesnt include the generated migrations for collections
* @todo expose migrations so they can be extended?
*/
migrateToLatest(): Promise<void>;
/**
* Returns the database client instance
*/
get client(): Kysely<LucidDB>;
}
type TableType = "document" | "versions" | "document-fields" | "brick" | "repeater";
type CollectionSchemaColumn = {
name: string;
source: "core" | "field";
type: ColumnDataType;
nullable?: boolean;
default?: unknown;
foreignKey?: {
table: string;
column: string;
onDelete?: OnDelete;
onUpdate?: OnUpdate;
};
customField?: {
type: FieldTypes;
};
unique?: boolean;
primary?: boolean;
};
type CollectionSchemaTable<TableName = string> = {
name: TableName;
type: TableType;
key: {
collection: string;
brick?: string;
repeater?: Array<string>;
};
columns: Array<CollectionSchemaColumn>;
};
type CollectionSchema = {
key: string;
tables: Array<CollectionSchemaTable>;
};
type ModifyColumnOperation = {
type: "modify";
column: CollectionSchemaColumn;
changes: {
type?: {
from: ColumnDataType;
to: ColumnDataType;
};
nullable?: {
from: boolean | undefined;
to: boolean | undefined;
};
default?: {
from: unknown;
to: unknown;
};
foreignKey?: {
from: CollectionSchemaColumn["foreignKey"];
to: CollectionSchemaColumn["foreignKey"];
};
unique?: {
from: boolean | undefined;
to: boolean | undefined;
};
};
};
type AddColumnOperation = {
type: "add";
column: CollectionSchemaColumn;
};
type RemoveColumnOperation = {
type: "remove";
columnName: string;
};
type ColumnOperation = AddColumnOperation | ModifyColumnOperation | RemoveColumnOperation;
type TableMigration = {
type: "create" | "modify" | "remove";
priority: number;
tableName: string;
columnOperations: ColumnOperation[];
};
type MigrationPlan = {
collectionKey: string;
tables: TableMigration[];
};
type KyselyDB = Kysely<LucidDB> | Transaction<LucidDB>;
type MigrationFn = (adapter: DatabaseAdapter) => Migration;
type Select<T> = {
[P in keyof T]: T[P] extends {
__select__: infer S;
} ? S : T[P];
};
type Insert<T> = {
[P in keyof T]: T[P] extends {
__insert__: infer S;
} ? S : T[P];
};
type Update<T> = {
[P in keyof T]: T[P] extends {
__update__: infer S;
} ? S : T[P];
};
type DefaultValueType<T> = T extends object ? keyof T extends never ? T : {
[K in keyof T]: T[K];
} : T;
type DocumentVersionType = "draft" | "published" | "revision";
type OnDelete = "cascade" | "set null" | "restrict" | "no action";
type OnUpdate = "cascade" | "set null" | "no action" | "restrict";
type DatabaseConfig = {
support: {
/**
* Whether the database supports the ALTER COLUMN statement.
*/
alterColumn: boolean;
/**
* Whether multiple columns can be altered in a single ALTER TABLE statement.
* Some databases require separate statements for each column modification.
*/
multipleAlterTables: boolean;
/**
* Set to true if the database supports boolean column data types.
* If you're database doesnt, booleans are stored as integers as either 1 or 0.
*/
boolean: boolean;
/**
* Determines if a primary key colum needs auto increment.
*/
autoIncrement: boolean;
};
/**
* Maps column data types to their database-specific implementations.
* Each adapter maps these standard types to what their database supports:
*
* Examples:
* - 'primary' maps to 'serial' in PostgreSQL, 'integer' in SQLite (with autoincrement)
* - 'boolean' maps to 'boolean' in PostgreSQL, 'integer' in SQLite
* - 'json' maps to 'jsonb' in PostgreSQL, 'json' in SQLite
*/
dataTypes: {
primary: ColumnDataType;
integer: ColumnDataType;
boolean: ColumnDataType;
json: ColumnDataType;
text: ColumnDataType;
timestamp: ColumnDataType;
char: ((length: number) => ColumnDataType) | ColumnDataType;
varchar: ((length?: number) => ColumnDataType) | ColumnDataType;
};
/**
* Maps column default values to their database-specific implementations.
* Each adapter maps these values to what their database supports:
*
* Examples:
* - 'timestamp.now' maps to 'NOW()' in PostgreSQL and 'CURRENT_TIMESTAMP' in SQLite
* - 'boolean.true' maps to 'true' in PostgreSQL and '1' in SQLite
*
* Remember that the values used here should reflect the column dataTypes as well as database support.
*/
defaults: {
timestamp: {
now: string;
};
boolean: {
true: true | 1;
false: false | 0;
};
};
/**
* The operator used for fuzzy text matching.
*/
fuzzOperator: "like" | "ilike" | "%";
};
interface InferredColumn {
name: string;
type: ColumnDataType;
nullable: boolean;
default: unknown | null;
unique?: boolean;
primary?: boolean;
foreignKey?: {
table: string;
column: string;
onDelete?: OnDelete;
onUpdate?: OnUpdate;
};
}
interface InferredTable {
name: string;
columns: InferredColumn[];
}
type TimestampMutateable = ColumnType<string | Date | null, string | undefined, string | null>;
type TimestampImmutable = ColumnType<string | Date, string | undefined, never>;
/** Should only be used for DB column insert/response values. Everything else should be using booleans and can be converted for response/insert with boolean helpers */
type BooleanInt = 0 | 1 | boolean;
interface LucidLocales {
code: string;
created_at: TimestampImmutable;
updated_at: TimestampMutateable;
is_deleted: ColumnType<BooleanInt, BooleanInt | undefined, BooleanInt>;
is_deleted_at: TimestampMutateable;
}
interface LucidTranslationKeys {
id: Generated<number>;
created_at: TimestampImmutable;
}
interface LucidTranslations {
id: Generated<number>;
translation_key_id: number;
locale_code: string;
value: string | null;
}
interface LucidOptions {
name: OptionName;
value_int: number | null;
value_text: string | null;
value_bool: BooleanInt | null;
}
interface LucidUsers {
id: Generated<number>;
super_admin: ColumnType<BooleanInt, BooleanInt | undefined, BooleanInt>;
email: string;
username: string;
first_name: string | null;
last_name: string | null;
password: ColumnType<string, string | undefined, string>;
secret: ColumnType<string, string, string>;
triggered_password_reset: ColumnType<BooleanInt, BooleanInt | undefined, BooleanInt>;
is_deleted: BooleanInt | null;
is_deleted_at: TimestampMutateable;
deleted_by: number | null;
created_at: TimestampImmutable;
updated_at: TimestampMutateable;
}
interface LucidRoles {
id: Generated<number>;
name: string;
description: string | null;
created_at: TimestampImmutable;
updated_at: TimestampMutateable;
}
interface LucidRolePermissions {
id: Generated<number>;
role_id: number;
permission: string;
created_at: TimestampImmutable;
updated_at: TimestampMutateable;
}
interface LucidUserRoles {
id: Generated<number>;
user_id: number | null;
role_id: number | null;
created_at: TimestampImmutable;
updated_at: TimestampMutateable;
}
interface LucidUserTokens {
id: Generated<number>;
user_id: number | null;
token_type: "password_reset" | "refresh";
token: string;
created_at: TimestampImmutable;
expiry_date: TimestampMutateable;
}
interface LucidEmails {
id: Generated<number>;
email_hash: string;
from_address: string;
from_name: string;
to_address: string;
subject: string;
cc: string | null;
bcc: string | null;
delivery_status: "pending" | "delivered" | "failed";
template: string;
data: JSONColumnType<Record<string, unknown>, Record<string, unknown> | null, string | null>;
type: "internal" | "external";
sent_count: number;
error_count: number;
last_error_message: string | null;
last_attempt_at: TimestampMutateable;
last_success_at: TimestampMutateable;
created_at: TimestampImmutable;
}
interface LucidMedia {
id: Generated<number>;
key: string;
e_tag: string | null;
visible: BooleanInt;
type: string;
mime_type: string;
file_extension: string;
file_size: number;
width: number | null;
height: number | null;
blur_hash: string | null;
average_colour: string | null;
is_dark: BooleanInt | null;
is_light: BooleanInt | null;
custom_meta: string | null;
title_translation_key_id: number | null;
alt_translation_key_id: number | null;
created_at: TimestampImmutable;
updated_at: TimestampMutateable;
}
interface LucidMediaAwaitingSync {
key: string;
timestamp: TimestampImmutable;
}
interface HeadlessProcessedImages {
key: string;
media_key: string | null;
file_size: number;
}
interface LucidCollections {
key: string;
is_deleted: ColumnType<BooleanInt, BooleanInt | undefined, BooleanInt>;
is_deleted_at: TimestampMutateable;
created_at: TimestampImmutable;
}
interface LucidCollectionMigrations {
id: Generated<number>;
collection_key: string;
migration_plans: JSONColumnType<MigrationPlan, MigrationPlan, MigrationPlan>;
created_at: TimestampImmutable;
}
interface LucidClientIntegrations {
id: Generated<number>;
name: string;
description: string | null;
enabled: BooleanInt;
key: string;
api_key: string;
secret: string;
created_at: TimestampImmutable;
updated_at: TimestampMutateable;
}
type LucidDocumentTableName = `lucid_document__${string}`;
interface LucidDocumentTable {
id: Generated<number>;
collection_key: string;
is_deleted: BooleanInt;
is_deleted_at: TimestampMutateable;
deleted_by: number;
created_by: number;
created_at: TimestampImmutable;
updated_by: number;
updated_at: TimestampMutateable;
}
type LucidVersionTableName = `lucid_document__${string}__versions`;
interface LucidVersionTable {
id: Generated<number>;
collection_key: string;
document_id: number;
type: DocumentVersionType;
promoted_from: number | null;
created_by: number;
updated_by: number;
created_at: TimestampImmutable;
updated_at: TimestampMutateable;
}
type LucidBrickTableName = `lucid_document__${string}__fields` | `lucid_document__${string}__${string}` | `lucid_document__${string}__${string}__${string}`;
interface LucidBricksTable {
id: Generated<number>;
collection_key: string;
document_id: number;
document_version_id: number;
locale: string;
position: number;
is_open: BooleanInt;
brick_type?: BrickTypes;
brick_instance_id?: string;
brick_id_ref?: number;
parent_id?: number | null;
parent_id_ref?: number | null;
brick_id?: number;
[key: CustomFieldColumnName]: unknown;
}
interface LucidDB {
lucid_locales: LucidLocales;
lucid_translation_keys: LucidTranslationKeys;
lucid_translations: LucidTranslations;
lucid_options: LucidOptions;
lucid_users: LucidUsers;
lucid_roles: LucidRoles;
lucid_role_permissions: LucidRolePermissions;
lucid_user_roles: LucidUserRoles;
lucid_user_tokens: LucidUserTokens;
lucid_emails: LucidEmails;
lucid_media: LucidMedia;
lucid_media_awaiting_sync: LucidMediaAwaitingSync;
lucid_processed_images: HeadlessProcessedImages;
lucid_client_integrations: LucidClientIntegrations;
lucid_collections: LucidCollections;
lucid_collection_migrations: LucidCollectionMigrations;
[key: LucidDocumentTableName]: LucidDocumentTable;
[key: LucidVersionTableName]: LucidVersionTable;
[key: LucidBrickTableName]: LucidBricksTable;
}
declare class BrickBuilder extends FieldBuilder {
key: string;
config: BrickConfig;
constructor(key: string, config?: BrickConfigProps);
addFields(Builder: BrickBuilder | FieldBuilder): this;
addTab(key: string, props?: CFProps<"tab">): this;
}
declare const CollectionConfigSchema: z.ZodObject<{
key: z.ZodString;
mode: z.ZodEnum<{
single: "single";
multiple: "multiple";
}>;
details: z.ZodObject<{
name: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodEnum<{
en: "en";
}>, z.ZodString>]>;
singularName: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodEnum<{
en: "en";
}>, z.ZodString>]>;
summary: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodEnum<{
en: "en";
}>, z.ZodString>]>>;
}, {}>;
config: z.ZodOptional<z.ZodObject<{
isLocked: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
useTranslations: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
useDrafts: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
useRevisions: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
}, {}>>;
hooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
event: z.ZodString;
handler: z.ZodUnknown;
}, {}>>>;
bricks: z.ZodOptional<z.ZodObject<{
fixed: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
builder: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
}, {}>>;
}, {}>;
declare const brickInputSchema: z.ZodInterface<{
ref: z.ZodString;
key: z.ZodString;
order: z.ZodNumber;
type: z.ZodUnion<readonly [z.ZodLiteral<"builder">, z.ZodLiteral<"fixed">]>;
open: z.ZodBoolean;
fields: z.ZodOptional<z.ZodArray<z.ZodInterface<{
key: z.ZodString;
type: z.ZodUnion<readonly [z.ZodLiteral<"text">, z.ZodLiteral<"wysiwyg">, z.ZodLiteral<"media">, z.ZodLiteral<"number">, z.ZodLiteral<"checkbox">, z.ZodLiteral<"select">, z.ZodLiteral<"textarea">, z.ZodLiteral<"json">, z.ZodLiteral<"colour">, z.ZodLiteral<"datetime">, z.ZodLiteral<"link">, z.ZodLiteral<"repeater">, z.ZodLiteral<"user">, z.ZodLiteral<"document">]>;
translations: z.ZodRecord<z.ZodString, z.ZodAny>;
value: z.ZodAny;
readonly groups: z.ZodOptional<z.ZodArray<z.ZodInterface<{
ref: z.ZodString;
order: z.ZodOptional<z.ZodNumber>;
open: z.ZodOptional<z.ZodBoolean>;
readonly fields: z.ZodArray<z.ZodInterface</*elided*/ any, {
optional: "value" | "translations" | "groups";
defaulted: never;
extra: {};
}>>;
}, {
optional: never;
defaulted: never;
extra: {};
}>>>;
}, {
optional: "value" | "translations" | "groups";
defaulted: never;
extra: {};
}>>>;
}, {
optional: "fields" | "open";
defaulted: never;
extra: {};
}>;
type BrickInputSchema = z.infer<typeof brickInputSchema>;
declare const fieldInputSchema: z.ZodInterface<{
key: z.ZodString;
type: z.ZodUnion<readonly [z.ZodLiteral<"text">, z.ZodLiteral<"wysiwyg">, z.ZodLiteral<"media">, z.ZodLiteral<"number">, z.ZodLiteral<"checkbox">, z.ZodLiteral<"select">, z.ZodLiteral<"textarea">, z.ZodLiteral<"json">, z.ZodLiteral<"colour">, z.ZodLiteral<"datetime">, z.ZodLiteral<"link">, z.ZodLiteral<"repeater">, z.ZodLiteral<"user">, z.ZodLiteral<"document">]>;
translations: z.ZodRecord<z.ZodString, z.ZodAny>;
value: z.ZodAny;
readonly groups: z.ZodOptional<z.ZodArray<z.ZodInterface<{
ref: z.ZodString;
order: z.ZodOptional<z.ZodNumber>;
open: z.ZodOptional<z.ZodBoolean>;
readonly fields: z.ZodArray<z.ZodInterface</*elided*/ any, {
optional: "value" | "translations" | "groups";
defaulted: never;
extra: {};
}>>;
}, {
optional: never;
defaulted: never;
extra: {};
}>>>;
}, {
optional: "value" | "translations" | "groups";
defaulted: never;
extra: {};
}>;
type FieldInputSchema = z.infer<typeof fieldInputSchema>;
interface LucidErrorData {
type?: "validation" | "basic" | "forbidden" | "authorisation" | "cron" | "toolkit";
name?: string;
message?: string;
status?: number;
code?: "csrf" | "login" | "authorisation" | "rate_limit" | "not_found";
zod?: z.ZodError;
errorResponse?: ErrorResult;
}
type ErrorResultValue = ErrorResultObj | ErrorResultObj[] | FieldError[] | GroupError[] | BrickError[] | string | undefined;
interface ErrorResultObj {
code?: string;
message?: string;
children?: ErrorResultObj[];
[key: string]: ErrorResultValue;
}
type ErrorResult = Record<string, ErrorResultValue>;
interface FieldError {
key: string;
/** Set if the error occured on a translation value, or it uses the default locale code when the field supports translations but only a value is given. Otherwise this is undefined. */
localeCode: string | null;
message: string;
groupErrors?: Array<GroupError>;
}
interface GroupError {
ref: string;
order: number;
fields: FieldError[];
}
interface BrickError {
ref: string;
key: string;
order: number;
fields: FieldError[];
}
interface ServiceData$1<K extends string> {
keys: Record<K, number | null>;
items: Array<{
translations: TranslationsObj[];
key: K;
}>;
}
interface ServiceData<K extends string> {
keys: K[];
translations: Array<{
value: string | null;
localeCode: string;
key: K;
}>;
}
declare const controllerSchemas$5: {
streamSingle: {
body: undefined;
query: {
string: z.ZodObject<{
width: z.ZodOptional<z.ZodString>;
height: z.ZodOptional<z.ZodString>;
format: z.ZodOptional<z.ZodEnum<{
avif: "avif";
webp: "webp";
jpeg: "jpeg";
png: "png";
}>>;
quality: z.ZodOptional<z.ZodString>;
fallback: z.ZodOptional<z.ZodEnum<{
false: "false";
true: "true";
}>>;
}, {}>;
formatted: z.ZodObject<{
width: z.ZodOptional<z.ZodString>;
height: z.ZodOptional<z.ZodString>;
format: z.ZodOptional<z.ZodEnum<{
avif: "avif";
webp: "webp";
jpeg: "jpeg";
png: "png";
}>>;
quality: z.ZodOptional<z.ZodString>;
fallback: z.ZodOptional<z.ZodEnum<{
false: "false";
true: "true";
}>>;
}, {}>;
};
params: z.ZodObject<{
"*": z.ZodString;
}, {}>;
response: undefined;
};
};
type StreamSingleQueryParams = z.infer<typeof controllerSchemas$5.streamSingle.query.formatted>;
interface MediaPropsT {
id: number;
key: string;
e_tag: string | null;
type: string;
mime_type: string;
file_extension: string;
file_size: number;
width: number | null;
height: number | null;
title_translation_key_id: number | null;
alt_translation_key_id: number | null;
created_at: Date | string | null;
updated_at: Date | string | null;
blur_hash: string | null;
average_colour: string | null;
is_dark: BooleanInt | null;
is_light: BooleanInt | null;
title_translations?: Array<{
value: string | null;
locale_code: string | null;
}>;
alt_translations?: Array<{
value: string | null;
locale_code: string | null;
}>;
title_translation_value?: string | null;
alt_translation_value?: string | null;
}
declare const controllerSchemas$4: {
getMultiple: {
query: {
string: z.ZodObject<{
"filter[title]": z.ZodOptional<z.ZodString>;
"filter[key]": z.ZodOptional<z.ZodString>;
"filter[mimeType]": z.ZodOptional<z.ZodString>;
"filter[type]": z.ZodOptional<z.ZodString>;
"filter[extension]": z.ZodOptional<z.ZodString>;
sort: z.ZodOptional<z.ZodString>;
page: z.ZodOptional<z.ZodString>;
perPage: z.ZodOptional<z.ZodString>;
}, {}>;
formatted: z.ZodObject<{
filter: z.ZodOptional<z.ZodObject<{
title: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
key: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
mimeType: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber, z.ZodArray<z.ZodNumber>]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
type: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber, z.ZodArray<z.ZodNumber>]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
extension: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber, z.ZodArray<z.ZodNumber>]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
}, {}>>;
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
key: z.ZodEnum<{
width: "width";
height: "height";
title: "title";
createdAt: "createdAt";
updatedAt: "updatedAt";
mimeType: "mimeType";
extension: "extension";
fileSize: "fileSize";
}>;
value: z.ZodEnum<{
asc: "asc";
desc: "desc";
}>;
}, {}>>>;
page: z.ZodNumber;
perPage: z.ZodNumber;
}, {}>;
};
params: undefined;
body: undefined;
response: z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
key: z.ZodString;
url: z.ZodString;
title: z.ZodArray<z.ZodObject<{
localeCode: z.ZodString;
value: z.ZodString;
}, {}>>;
alt: z.ZodArray<z.ZodObject<{
localeCode: z.ZodString;
value: z.ZodString;
}, {}>>;
type: z.ZodString;
meta: z.ZodObject<{
mimeType: z.ZodString;
extension: z.ZodString;
fileSize: z.ZodNumber;
width: z.ZodNullable<z.ZodNumber>;
height: z.ZodNullable<z.ZodNumber>;
blurHash: z.ZodNullable<z.ZodString>;
averageColour: z.ZodNullable<z.ZodString>;
isDark: z.ZodNullable<z.ZodBoolean>;
isLight: z.ZodNullable<z.ZodBoolean>;
}, {}>;
createdAt: z.ZodString;
updatedAt: z.ZodString;
}, {}>>;
};
getSingle: {
body: undefined;
query: {
string: undefined;
formatted: undefined;
};
params: z.ZodObject<{
id: z.ZodString;
}, {}>;
response: z.ZodObject<{
id: z.ZodNumber;
key: z.ZodString;
url: z.ZodString;
title: z.ZodArray<z.ZodObject<{
localeCode: z.ZodString;
value: z.ZodString;
}, {}>>;
alt: z.ZodArray<z.ZodObject<{
localeCode: z.ZodString;
value: z.ZodString;
}, {}>>;
type: z.ZodString;
meta: z.ZodObject<{
mimeType: z.ZodString;
extension: z.ZodString;
fileSize: z.ZodNumber;
width: z.ZodNullable<z.ZodNumber>;
height: z.ZodNullable<z.ZodNumber>;
blurHash: z.ZodNullable<z.ZodString>;
averageColour: z.ZodNullable<z.ZodString>;
isDark: z.ZodNullable<z.ZodBoolean>;
isLight: z.ZodNullable<z.ZodBoolean>;
}, {}>;
createdAt: z.ZodString;
updatedAt: z.ZodString;
}, {}>;
};
deleteSingle: {
body: undefined;
query: {
string: undefined;
formatted: undefined;
};
params: z.ZodObject<{
id: z.ZodString;
}, {}>;
response: undefined;
};
updateSingle: {
body: z.ZodObject<{
key: z.ZodOptional<z.ZodString>;
fileName: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodArray<z.ZodObject<{
localeCode: z.ZodString;
value: z.ZodNullable<z.ZodString>;
}, {}>>>;
alt: z.ZodOptional<z.ZodArray<z.ZodObject<{
localeCode: z.ZodString;
value: z.ZodNullable<z.ZodString>;
}, {}>>>;
}, {}>;
query: {
string: undefined;
formatted: undefined;
};
params: z.ZodObject<{
id: z.ZodString;
}, {}>;
response: undefined;
};
clearSingleProcessed: {
body: undefined;
query: {
string: undefined;
formatted: undefined;
};
params: z.ZodObject<{
id: z.ZodString;
}, {}>;
response: undefined;
};
clearAllProcessed: {
body: undefined;
query: {
string: undefined;
formatted: undefined;
};
params: undefined;
response: undefined;
};
getPresignedUrl: {
body: z.ZodObject<{
fileName: z.ZodString;
mimeType: z.ZodString;
}, {}>;
query: {
string: undefined;
formatted: undefined;
};
params: undefined;
response: z.ZodObject<{
url: z.ZodString;
key: z.ZodString;
}, {}>;
};
createSingle: {
body: z.ZodObject<{
key: z.ZodString;
fileName: z.ZodString;
title: z.ZodOptional<z.ZodArray<z.ZodObject<{
localeCode: z.ZodString;
value: z.ZodNullable<z.ZodString>;
}, {}>>>;
alt: z.ZodOptional<z.ZodArray<z.ZodObject<{
localeCode: z.ZodString;
value: z.ZodNullable<z.ZodString>;
}, {}>>>;
}, {}>;
query: {
string: undefined;
formatted: undefined;
};
params: undefined;
response: undefined;
};
};
type GetMultipleQueryParams$4 = z.infer<typeof controllerSchemas$4.getMultiple.query.formatted>;
interface MediaKitMeta {
mimeType: string;
name: string;
type: MediaType;
extension: string;
size: number;
key: string;
etag: string | null;
width: number | null;
height: number | null;
blurHash: string | null;
averageColour: string | null;
isDark: boolean | null;
isLight: boolean | null;
}
declare const controllerSchemas$3: {
createSingle: {
body: z.ZodObject<{
name: z.ZodString;
description: z.ZodOptional<z.ZodString>;
permissions: z.ZodArray<z.ZodString>;
}, {}>;
query: {
string: undefined;
formatted: undefined;
};
params: undefined;
response: z.ZodInterface<{
id: z.ZodNumber;
name: z.ZodString;
description: z.ZodNullable<z.ZodString>;
permissions: z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
permission: z.ZodString;
}, {}>>;
createdAt: z.ZodString;
updatedAt: z.ZodString;
}, {
optional: "permissions";
defaulted: never;
extra: {};
}>;
};
updateSingle: {
body: z.ZodObject<{
name: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, {}>;
query: {
string: undefined;
formatted: undefined;
};
params: z.ZodObject<{
id: z.ZodString;
}, {}>;
response: undefined;
};
deleteSingle: {
body: undefined;
query: {
string: undefined;
formatted: undefined;
};
params: z.ZodObject<{
id: z.ZodString;
}, {}>;
response: undefined;
};
getMultiple: {
body: undefined;
query: {
string: z.ZodObject<{
"filter[name]": z.ZodOptional<z.ZodString>;
"filter[roleIds]": z.ZodOptional<z.ZodString>;
sort: z.ZodOptional<z.ZodString>;
include: z.ZodOptional<z.ZodString>;
page: z.ZodOptional<z.ZodString>;
perPage: z.ZodOptional<z.ZodString>;
}, {}>;
formatted: z.ZodObject<{
filter: z.ZodOptional<z.ZodObject<{
name: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
roleIds: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber, z.ZodArray<z.ZodNumber>]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
}, {}>>;
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
key: z.ZodEnum<{
name: "name";
createdAt: "createdAt";
}>;
value: z.ZodEnum<{
asc: "asc";
desc: "desc";
}>;
}, {}>>>;
include: z.ZodOptional<z.ZodArray<z.ZodEnum<{
permissions: "permissions";
}>>>;
page: z.ZodNumber;
perPage: z.ZodNumber;
}, {}>;
};
params: undefined;
response: z.ZodArray<z.ZodInterface<{
id: z.ZodNumber;
name: z.ZodString;
description: z.ZodNullable<z.ZodString>;
permissions: z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
permission: z.ZodString;
}, {}>>;
createdAt: z.ZodString;
updatedAt: z.ZodString;
}, {
optional: "permissions";
defaulted: never;
extra: {};
}>>;
};
getSingle: {
body: undefined;
query: {
string: undefined;
formatted: undefined;
};
params: z.ZodObject<{
id: z.ZodString;
}, {}>;
response: z.ZodInterface<{
id: z.ZodNumber;
name: z.ZodString;
description: z.ZodNullable<z.ZodString>;
permissions: z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
permission: z.ZodString;
}, {}>>;
createdAt: z.ZodString;
updatedAt: z.ZodString;
}, {
optional: "permissions";
defaulted: never;
extra: {};
}>;
};
};
type GetMultipleQueryParams$3 = z.infer<typeof controllerSchemas$3.getMultiple.query.formatted>;
declare const controllerSchemas$2: {
getMultiple: {
body: undefined;
query: {
string: z.ZodObject<{
"filter[toAddress]": z.ZodOptional<z.ZodString>;
"filter[subject]": z.ZodOptional<z.ZodString>;
"filter[deliveryStatus]": z.ZodOptional<z.ZodString>;
"filter[type]": z.ZodOptional<z.ZodString>;
"filter[template]": z.ZodOptional<z.ZodString>;
sort: z.ZodOptional<z.ZodString>;
page: z.ZodOptional<z.ZodString>;
perPage: z.ZodOptional<z.ZodString>;
}, {}>;
formatted: z.ZodObject<{
filter: z.ZodOptional<z.ZodObject<{
toAddress: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
subject: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
deliveryStatus: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber, z.ZodArray<z.ZodNumber>]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
type: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber, z.ZodArray<z.ZodNumber>]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
template: z.ZodOptional<z.ZodObject<{
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
operator: z.ZodOptional<z.ZodEnum<{
"=": "=";
"!=": "!=";
"<>": "<>";
in: "in";
"not in": "not in";
is: "is";
"is not": "is not";
like: "like";
ilike: "ilike";
"%": "%";
}>>;
}, {}>>;
}, {}>>;
sort: z.ZodOptional<z.ZodArray<z.ZodObject<{
key: z.ZodEnum<{
createdAt: "createdAt";
lastAttemptAt: "lastAttemptAt";
lastSuccessAt: "lastSuccessAt";
sentCount: "sentCount";
errorCount: "errorCount";
}>;
value: z.ZodEnum<{
asc: "asc";
desc: "desc";
}>;
}, {}>>>;
page: z.ZodNumber;
perPage: z.ZodNumber;
}, {}>;
};
params: undefined;
response: z.ZodArray<z.ZodObject<{
id: z.ZodNumber;
mailDetails: z.ZodObject<{
from: z.ZodObject<{
address: z.ZodEmail;
name: z.ZodString;
}, {}>;
to: z.ZodString;
subject: z.ZodString;
cc: z.ZodNullable<z.ZodString>;
bcc: z.ZodNullable<z.ZodString>;
template: z.ZodString;
}, {}>;
data: z.ZodNullable<z.ZodRecord<z.ZodAny, z.ZodAny>>;
deliveryStatus: z.ZodUnion<readonly [z.ZodLiteral<"sent">, z.ZodLiteral<"failed">, z.ZodLiteral<"pending">]>;
type: z.ZodUnion<readonly [z.ZodLiteral<"external">, z.ZodLiteral<"internal">]>;
emailHash: z.ZodString;
sentCount: z.ZodNumber;
errorCount: z.ZodNumber;
html: z.ZodNullable<z.ZodString>;
errorMessage: z.ZodNullable<z.ZodString>;
createdAt: z.ZodNullable<z.ZodString>;
lastSuccessAt: z.ZodNullable<z.ZodString>;
lastAttemptAt: z.ZodNullable<z.ZodString>;
}, {}>>;
};
getSingle: {
body: undefined;
query: {
string: undefined;
formatted: undefined;
};
params: z.ZodObject<{
id: z.ZodString;
}, {}>;
response: z.ZodObject<{
id: z.ZodNumber;
mailDetails: z.ZodObject<{
from: z.ZodObject<{
address: z.ZodEmail;
name: z.ZodString;
}, {}>;
to: z.ZodString;
subject: z.ZodString;
cc: z.ZodNullable<z.ZodString>;
bcc: z.ZodNullable<z.ZodString>;
template: z.ZodString;
}, {}>;
data: z.ZodNullable<z.ZodRecord<z.ZodAny, z.ZodAny>>;
deliveryStatus: z.ZodUnion<readonly [z.ZodLiteral<"sent">, z.ZodLiteral<"failed">, z.ZodLiteral<"pending">]>;
type: z.ZodUnion<readonly [z.ZodLiteral<"external">, z.ZodLiteral<"internal">]>;
emailHash: z.ZodString;
sentCount: z.ZodNumber;
errorCount: z.ZodNumber;
html: z.ZodNullable<z.ZodString>;
errorMessage: z.ZodNullable<z.ZodString>;
createdAt: z.ZodNullable<z.ZodString>;
lastSuccessAt: z.ZodNullable<z.ZodString>;
lastAttemptAt: z.ZodNullable<z.ZodString>;
}, {}>;
};
deleteSingle: {
body: undefined;
query: {
string: undefined;
formatted: undefined;
};
params: z.ZodObject<{
id: z.ZodString;
}, {}>;
response: undefined;
};
resendSingle: {
body: undefined;
query: {
string: undefined;
formatted: undefined;
};
params: z.ZodObject<{
id: z.ZodString;
}, {}>;
response: z.ZodObject<{
success: z.ZodBoolean;
message: z.ZodString;
}, {}>;
};
};
type GetMultipleQueryParams$2 = z.infer<typeof controllerSchemas$2.getMultiple.query.formatted>;
interface UserPropT {
created_at: Date | string | null;
email: string;
first_name: string | null;
super_admin: BooleanInt | null;
id: number;
last_name: string | null;
updated_at: Date | string | null;
username: string;
triggered_password_reset?: BooleanInt;
roles?: {
id: number;
description: string | n