@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 30.9 kB
JavaScript
import e from"zod/v4";var t=`Headers were already sent.`,n=`An error occurred!`,r=`An error occurred! Please try again later.`,i=`Validation Error`,a=`Authorisation Error`,o=`Forbidden Error`,s=`An unknown error occurred.`,c=`An error occurred while saving the default option.`,l=`An error occurred while saving the default roles.`,u=`An error occurred while saving the default user.`,ee=`An error occurred while syncing the locales.`,te=`An error occured while syncing the collections`,ne=`An error occurred while clearing expired tokens.`,re=`An error occurred while clearing expired locales.`,ie=`An error occured while clearing expired collections.`,ae=`Successfull response`,oe=`Resource created response`,se=`No content response`,ce=`Bad request response`,le=`Unauthorised response`,ue=`Forbidden response`,de=`Not found response`,d=`Internal server error response`,f=`Catch all error response`,p=`A token that is used to protect against CSRF attacks. CSRF middleware expects this value to be passed in the header so it can be compared to the httpOnly _csrf cookie.`,m=`Stores the access token that is used to authenticate requests.`,h=`Stores the refresh token that can be used to obtain a new access token when the current one expires.`,g=`Seperate values by a comma if you want to include multiple values`,_=`Seperate values by a comma if you want to filter by multiple values`,v=`Prefix the value with a minus sign (-) to sort in descending order and seperate values by a comma if you want to sort by multiple values`,y=`The page number of the paginated response`,b=`The number of items per page in the paginated response`,x=`The locale code of the content you wish to filter translations by. If left empty, the default language will be used.`,S=`The client key for the client integration.`,C=`The Authorization header is required for client integrations and should take the API key as the value.`,w=`Your account has been suspended. Please contact an administrator.`,T=`Please check the request body and try again.`,E=`Please ensure the multipart/form-data body value is valid JSON.`,D=`The published version was not created.`,O=`Please check the query parameters and try again.`,k=`The draft version was not moved to a revision.`,A=`The revision version was not restored.`,j=`Revisions Not Enabled`,M=`Revisions are not enabled for this collection.`,N=`Please check the request parameters and try again.`,P=`There was an error obtaining an access token.`,F=`There was an error obtaining an access token. Please try logging in again.`,I=`There was an error obtaining a new access token.`,L=`There was an error obtaining a new access token. Please try logging in again.`,R=`You are not authorised to perform this action.`,z=`Failed to validate CSRF token.`,B=`An entry with the same value already exists.`,V=`This collection has a document already.`,H=`The permission '{{permission}}' is invalid.`,fe=`Please ensure that the value is unique and try again.`,pe=`This email address is already in use.`,me=`This username is already in use.`,he=`You do not have permission to perform this action.`,ge=`An error occurred while connecting to the database.`,_e=`If an account exists with the email provided, a password reset link will be sent to the email address.`,ve=`Reset your password`,ye=`You have been invited to join a Lucid project`,be=`Password reset successful`,xe=`Email update successful`,Se=`Please ensure that the passwords match and try again.`,Ce=`Please ensure that a file has been uploaded and try again.`,we=`Please make sure all translation locales exist.`,Te=`File is too large. Max file size is {{size}} bytes.`,Ee=`Files exceed storage limit. Max storage limit is {{size}} bytes.`,De=`Only found the following IDs: {{ids}}`,Oe=`None of the provided IDs were found.`,ke=`We couln't find the brick config for the brick key of: '{{key}}'. Ensure you are using the correct key for the brick defined in your lucid.config file.`,Ae=`Field Validation Error`,je=`There was an error validating some fields.`,Me=`Duplicate keys found for {{builder}} builder.`,Ne=`Cannot find the lucid.config.ts or lucid.config.js file at the root of your project.`,Pe=`Cannot find the repository for the {{name}}.`,Fe=`Cannot find the formatter for the {{name}}.`,Ie=`Configuration Error`,Le=`You cannot promote to the same version type.`,Re=`Email functionality is disabled because the email configuration is missing. Please provide the necessary email settings in the 'lucid.config.ts/js' file to enable email features.`,ze=`Media functionality is disabled because the media strategy configuration is missing.`,Be=`Database migration failed.`,Ve=`Duplicate field keys found ({{keys}}) in {{type}}: {{typeKey}}.`,He=`Repeater depth is too high in {{type}}: {{typeKey}} with key: {{repeaterKey}}. Please reduce the depth from {{depth}} to {{maxRepeaterDepth}}.`,Ue=`This plugin does not support version {{version}} of Lucid, only versions {{supportedVersions}}.`,We=`An error occurred while updating the media storage option.`,Ge=`An error occurred while deleting expired media.`,Ke=`No records provided.`,qe=`Failed to create document or version.`,Je=`Invalid media name.`,Ye=`The media name is invalid. Please ensure the media name is a valid string.`,Xe=`Permission Error`,Ze=`Collection Locked`,Qe=`Start Task Error`,$e=`The collection is locked and cannot be updated.`,et=`The collection is locked and cannot be deleted.`,tt=`Please ensure the locales array is not empty.`,nt=`Please ensure the defaultLocale is defined.`,rt=`Please ensure the defaultLocale exists in the locales array.`,it=`Please ensure the locales array does not contain duplicate values.`,at=`You can't update yourself.`,ot=`You can't delete yourself.`,st=`You can't delete the last remaining user.`,ct=`No refresh token found.`,lt=`Please ensure the password is correct and try again.`,ut=`Please provide a new password.`,dt=`Please provide your current password.`,ft=`Please enter a value for this field`,pt=`Please ensure the checkbox is checked`,mt=`Please select an option`,ht=`Please enter a valid value for this field`,gt=`Please ensure a valid option is selected`,_t=`Cannot find field within the collection or brick. Please ensure a field with this key exists.`,vt=`An unknown error occured when validating the field.`,yt=`Media width must be greater than {{min}}px`,bt=`Media width must be less than {{max}}px`,xt=`Media height must be greater than {{min}}px`,St=`Media height must be less than {{max}}px`,Ct=`Media must be of type "{{type}}"`,wt=`Media must be one of the following extensions: {{extensions}}`,Tt=`We couldn't find the media you selected`,Et=`We couldn't find the user you selected`,Dt=`We couldn't find the document you selected`,Ot=`This media does not have a type`,kt=`This media does not have a width`,At=`This media does not have a height`,jt=`The type of the field does not match the type of the config field. Received: "{{received}}" Expected: "{{expected}}"`,Mt=`Please ensure the date you have entered is valid`,Nt=`Please set the target to one of the following: {{valid}}`,Pt=`The data type is incorrect`,Ft=`An unknown error occurred`,It=`An unknown error occurred. Please try again later.`,Lt=`Processed image size limit exceeded.`,Rt=`User(s) Fetch Error`,zt=`An error occurred while fetching the user(s).`,Bt=`User Create Error`,Vt=`An error occurred while creating the user.`,Ht=`User Delete Error`,Ut=`An error occurred while deleting the user.`,Wt=`User Update Error`,Gt=`An error occurred while updating the user.`,Kt=`User Update Error`,qt=`An error occurred while updating your account.`,Jt=`Reset Password Error`,Yt=`An error occurred while resetting the password.`,Xt=`Send Password Reset Error`,Zt=`An error occurred while sending the password reset link.`,Qt=`Verify Password Reset Error`,$t=`An error occurred while verifying the password reset link.`,en=`Login Error`,tn=`An error occurred while logging in.`,nn=`Document(s) Delete Error`,rn=`An error occurred while deleting the document(s).`,an=`Document(s) Restore Revision Error`,on=`An error occurred while restoring the document revision.`,sn=`Document Revision(s) Fetch Error`,cn=`An error occurred while fetching the document revision(s).`,ln=`Document(s) Promote Version Error`,un=`An error occurred while promoting the document version.`,dn=`Document(s) Fetch Error`,fn=`An error occurred while fetching the document(s).`,pn=`Document Update Error`,mn=`An error occurred while updating the document.`,hn=`Document Create Error`,gn=`An error occurred while creating the document.`,_n=`Collection(s) Fetch Error`,vn=`An error occurred while fetching the collection(s).`,yn=`Email Delete Error`,bn=`An error occurred while deleting the email.`,xn=`Email(s) Fetch Error`,U=`An error occurred while fetching the email(s).`,Sn=`Email Resend Error`,Cn=`An error occurred while resending the email.`,wn=`Locale(s) Fetch Error`,Tn=`An error occurred while fetching the locale(s).`,En=`Processed Image(s) Clear Error`,Dn=`An error occurred while clearing the processed image(s).`,On=`Media Delete Error`,kn=`An error occurred while deleting the media.`,An=`Media(s) Fetch Error`,jn=`An error occurred while fetching the media(s).`,Mn=`Presigned URL Error`,Nn=`An error occurred while getting the presigned URL.`,Pn=`Media Update Error`,Fn=`An error occurred while updating the media.`,In=`Media Upload Error`,Ln=`An error occurred while uploading the media.`,Rn=`Role Create Error`,zn=`An error occurred while creating the role.`,Bn=`Role Delete Error`,Vn=`An error occurred while deleting the role.`,Hn=`Role(s) Fetch Error`,Un=`An error occurred while fetching the role(s).`,Wn=`Role Update Error`,Gn=`An error occurred while updating the role.`,Kn=`Settings Fetch Error`,qn=`An error occurred while fetching the settings.`,Jn=`Client Integration Create Error`,Yn=`An error occurred while creating the client integration.`,Xn=`Client Integration(s) Fetch Error`,Zn=`An error occurred while fetching the client integration(s).`,Qn=`Client Integration Delete Error`,$n=`An error occurred while deleting the client integration.`,er=`Client Integration Update Error`,tr=`An error occurred while updating the client integration.`,nr=`Setup Required Error`,rr=`An error occurred while checking if setup is required.`,ir=`The account you are trying to access does not exist.`,ar=`Media Not Found`,or=`The media you are trying to access does not exist.`,sr=`The document you are trying to access does not exist.`,cr=`The document version you are trying to access does not exist.`,lr=`The document version you are trying to access bellongs to a different document ID.`,ur=`The collection you are trying to access does not exist.`,dr=`The email you are trying to access does not exist.`,fr=`The locale you are trying to access does not exist.`,pr=`The option you are trying to access does not exist.`,mr=`The role you are trying to access does not exist.`,hr=`The token you are trying to access does not exist.`,gr=`The user you are trying to access does not exist.`,_r=`The client integration you are trying to access does not exist.`,vr=`The template you are trying to use cannot be found.`,yr=`Error Saving Bricks`,br=`Duplicate builder orders found: {{order}}.`,xr=`The username/email or password you entered is incorrect.`,Sr=`Cron Job Error`,Cr=`An error occurred while running/registering the cron jobs.`,wr=`Running cron jobs...`,Tr=`If you are updating the media file, a file name must be provided.`,Er=`Seed Error`,Dr=`An error occurred while seeding the database.`,Or=`Running database seed jobs...`,kr=`An error occurred during the initialisation of the Lucid server`,Ar=`An error occured during the vite admin SPA build step`,jr=`An error occurred while getting the media metadata.`,Mr=`The unique key for the client integration already exists, please re-send the request`,Nr=`The client key header is missing`,Pr=`The client you are trying to authenticate with does not exist`,Fr=`The client integration is disabled. Please enable it and try again.`,Ir=`The client integration API key is missing from the authorisation header.`,Lr=`The client integration API key is invalid. Please ensure it is correct and try again.`,Rr=`An error occurred while verifying the client integration API key.`,zr=`Rate Limit Error`,Br=`Route Not Found`,Vr=`The route you are trying to access does not exist.`,Hr=`You cannot promote a revision to a new version type. Please use the restore revision endpoint instead.`,Ur=`You cannot promote to a draft as the collection is not configured to use drafts.`,Wr=`The page you are trying to access does not exist.`,Gr=`Please ensure the data you have provided is correct.`,Kr=`Please ensure you are logged in and have the correct permissions.`,qr=`You do not have permission to perform this action.`,Jr=`Send Email Error`,Yr=`The collection '{{collection}}' does not exist or is not of mode multiple for the document field '{{field}}'.`,Xr=`The is missing relation data`,Zr=`The encrypted secret is invalid.`,Qr=`Media Duplicate Key Error`,$r=`The media key you have provided already exists.`,ei=`Media Create Error`,ti=`There was an error creating the media item.`,ni=`The media key has either expired, been created already or has been deleted.`,ri=`Vite Build Error`,ii=`An error occured while copying over a @lucidcms/admin asset export to the Vite build directory.`,ai=`An unknown error occured while building the SPA via Vite.`,oi=`An unknown error occured while generating the client build metadata file.`,si=`An unknown error occured while generating the admin client JS mount.`,ci=`An unknown error occured while generating the admin index.html entry.`,li=`An unknown error occured while reading the client build metadata file.`,ui=`Collection Migrate Error`,di=`The collection buildTableName function recieved type 'brick' but recieved no brick key.`,fi=`The collection buildTableName function recieved type 'repeater' but recieved no repeater keys.`,pi=`Cannot find field with key '{{key}}' in {{type}} '{{typeKey}}'.`,mi=`An error occurred while inferring the collection schema.`,hi=`Invalid table name format, must start with '{{prefix}}'.`,gi=`Invalid table name format. Contains insufficient parts.`,_i=`Failed to infer table parts.`,vi=`Repeater field contains errors.`,yi=`Too many groups have been added to the repeater. The group limit is set to "{{groups}}". `,bi=`The minimum groups have not been added to the repeater. The group minimum is set to "{{groups}}".`,xi=`An error occured while fetching users.`,Si=`An error occured while fetching documents.`,Ci=`An error occured while fetching {{collection}} documents.`,wi=`An error occured while fetching media.`,Ti=`This field is required and not being supplied.`,Ei=`An error occured while fetching media relation data on the document get endpoint.`,Di=`An error occured getting the document table names.`,Oi=`Failed to prerender MJML templates`,ki=`Setup has already been completed. Please login to continue.`,Ai=`Schema Migration Required`,ji=`The collection requires a schema migration. Please run the migration command to update the database.`,Mi=`The version you are trying to access does not exist.`,Ni=`Update Revision Error`,Pi=`You cannot update a revision version. The revision must be restored first.`,Fi={headers_already_sent:t,default_error_name:n,default_error_message:r,validation_error:i,authorisation_error:a,forbidden_error:o,an_unknown_error_occurred:s,option_error_occured_saving_default:c,roles_error_occured_saving_default:l,user_error_occured_saving_default:u,locale_error_occured_saving_default:ee,collection_error_occured_saving_default:te,an_error_occurred_clearing_expired_tokens:ne,an_error_occurred_clearing_expired_locales:re,an_error_occurred_clearing_expired_collections:ie,swagger_response_200:ae,swagger_response_201:oe,swagger_response_204:se,swagger_response_400:ce,swagger_response_401:le,swagger_response_403:ue,swagger_response_404:de,swagger_response_500:d,swagger_response_default:f,swagger_csrf_header_description:p,swagger_access_header_description:m,swagger_refresh_header_description:h,swagger_query_string_include_description:g,swagger_query_string_filter_description:_,swagger_query_string_sort_description:v,swagger_query_string_page_description:y,swagger_query_string_per_page_description:b,swagger_content_locale_header_description:x,swagger_client_key_header_description:S,swagger_authorization_header_description:C,login_suspended_error_message:w,validation_body_error_message:T,multipart_body_validation_error_message:E,published_version_not_created_message:D,validation_query_error_message:O,draft_version_not_moved_to_revision_message:k,revision_version_not_restored_message:A,revisions_not_enabled_error_name:j,revisions_not_enabled_message:M,validation_params_error_message:N,access_token_error_name:P,access_token_error_message:F,refresh_token_error_name:I,refresh_token_error_message:L,not_authorised_to_perform_action:R,failed_to_validate_csrf_token:z,duplicate_entry_error_message:B,this_collection_has_a_document_already:V,the_permission_is_invalid_against_mesage:H,not_unique_error_message:fe,this_email_is_already_in_use:pe,this_username_is_already_in_use:me,you_do_not_have_permission_to_perform_this_action:he,db_connection_error:ge,if_account_exists_with_email_not_found:_e,reset_password_email_subject:ve,user_invite_email_subject:ye,password_reset_success_subject:be,email_update_success_subject:xe,please_ensure_passwords_match:Se,ensure_file_has_been_uploaded:Ce,make_sure_all_translations_locales_exist:we,file_too_large_max_size_is:Te,file_exceeds_storage_limit_max_limit_is:Ee,only_found_ids_error_message:De,no_document_ids_found_message:Oe,error_saving_page_brick_couldnt_find_brick_config:ke,field_validation_error_name:Ae,field_validation_error_message:je,config_duplicate_keys:Me,cannot_find_config_path:Ne,cannot_find_repository:Pe,cannot_find_formatter:Fe,config_error_name:Ie,cannot_promote_to_same_version_message:Le,email_not_configured_message:Re,media_strategy_not_configured_message:ze,db_migration_failed:Be,duplicate_field_keys_message:Ve,repeater_depth_message:He,plugin_version_not_supported:Ue,an_error_occurred_updating_media_storage:We,an_error_occurred_deleting_expired_media:Ge,no_records_provided:Ke,failed_to_create_document_or_version:qe,media_name_invalid:Je,media_name_invalid_message:Ye,permission_error_name:Xe,error_locked_collection_name:Ze,start_error_name:Qe,error_locked_collection_message:$e,error_locked_collection_message_delete:et,config_locales_empty:tt,config_default_locale_undefined:nt,config_default_locale_not_found:rt,config_duplicate_locale:it,error_cant_update_yourself:at,error_cant_delete_yourself:ot,error_cant_delete_last_user:st,no_refresh_token_found:ct,please_ensure_password_is_correct:lt,please_provide_new_password:ut,please_provide_current_password:dt,generic_field_required:ft,checkbox_field_required:pt,select_field_required:mt,generic_field_invalid:ht,please_ensure_a_valid_option_is_selected:gt,cannot_find_field_in_collection_or_brick:_t,an_unknown_error_occurred_validating_the_field:vt,field_media_min_width:yt,field_media_max_width:bt,field_media_min_height:xt,field_media_max_height:St,field_media_type:Ct,field_media_extension:wt,field_media_not_found:Tt,field_user_not_found:Et,field_document_not_found:Dt,field_media_doenst_have_type:Ot,field_media_doenst_have_width:kt,field_media_doenst_have_height:At,field_type_mismatch:jt,field_date_invalid:Mt,field_link_target_error_message:Nt,generic_field_data_type_mismatch:Pt,unknown_service_error:Ft,unknown_service_error_message:It,processed_images_size_limit_exceeded:Lt,route_user_fetch_error_name:Rt,route_user_fetch_error_message:zt,route_user_create_error_name:Bt,route_user_create_error_message:Vt,route_user_delete_error_name:Ht,route_user_delete_error_message:Ut,route_user_update_error_name:Wt,route_user_update_error_message:Gt,route_user_me_update_error_name:Kt,route_user_me_update_error_message:qt,route_reset_password_error_name:Jt,route_reset_password_error_message:Yt,route_send_password_reset_error_name:Xt,route_send_password_reset_error_message:Zt,route_verify_password_reset_error_name:Qt,route_verify_password_reset_error_message:$t,route_login_error_name:en,route_login_error_message:tn,route_document_delete_error_name:nn,route_document_delete_error_message:rn,route_document_restore_revision_error_name:an,route_document_restore_revision_error_message:on,route_document_revision_fetch_error_name:sn,route_document_revision_fetch_error_message:cn,route_document_promote_version_error_name:ln,route_document_promote_version_error_message:un,route_document_fetch_error_name:dn,route_document_fetch_error_message:fn,route_document_update_error_name:pn,route_document_update_error_message:mn,route_document_create_error_name:hn,route_document_create_error_message:gn,route_collection_fetch_error_name:_n,route_collection_fetch_error_message:vn,route_email_delete_error_name:yn,route_email_delete_error_message:bn,route_email_fetch_error_name:xn,route_email_fetch_error_message:U,route_email_resend_error_name:Sn,route_email_resend_error_message:Cn,route_locale_fetch_error_name:wn,route_locale_fetch_error_message:Tn,route_media_clear_processed_error_name:En,route_media_clear_processed_error_message:Dn,route_media_delete_error_name:On,route_media_delete_error_message:kn,route_media_fetch_error_name:An,route_media_fetch_error_message:jn,route_media_presigned_url_error_name:Mn,route_media_presigned_url_error_message:Nn,route_media_update_error_name:Pn,route_media_update_error_message:Fn,route_media_upload_error_name:In,route_media_upload_error_message:Ln,route_roles_create_error_name:Rn,route_roles_create_error_message:zn,route_roles_delete_error_name:Bn,route_roles_delete_error_message:Vn,route_roles_fetch_error_name:Hn,route_roles_fetch_error_message:Un,route_roles_update_error_name:Wn,route_roles_update_error_message:Gn,route_settings_fetch_error_name:Kn,route_settings_fetch_error_message:qn,route_client_integrations_create_error_name:Jn,route_client_integrations_create_error_message:Yn,route_client_integrations_fetch_error_name:Xn,route_client_integrations_fetch_error_message:Zn,route_client_integrations_delete_error_name:Qn,route_client_integrations_delete_error_message:$n,route_client_integrations_update_error_name:er,route_client_integrations_update_error_message:tr,route_setup_required_error_name:nr,route_setup_required_error_message:rr,account_not_found_message:ir,media_not_found_name:ar,media_not_found_message:or,document_not_found_message:sr,document_version_not_found_message:cr,document_version_doesnt_belong_to_document:lr,collection_not_found_message:ur,email_not_found_message:dr,locale_not_found_message:fr,option_not_found_message:pr,role_not_found_message:mr,token_not_found_message:hr,user_not_found_message:gr,client_integration_not_found_message:_r,template_not_found_message:vr,error_saving_bricks:yr,error_saving_page_duplicate_order:br,login_error_message:xr,cron_job_error_name:Sr,cron_job_error_message:Cr,running_cron_jobs:wr,media_error_missing_file_name:Tr,seed_error_name:Er,seed_error_message:Dr,running_database_seed_jobs:Or,lucid_server_unknow_error:kr,lucid_server_unknow_build_error:Ar,media_error_getting_metadata:jr,client_integration_key_already_exists:Mr,client_integration_key_missing:Nr,cannot_find_client_integration:Pr,client_integration_is_disabled:Fr,client_integration_api_key_missing:Ir,invalid_client_integration_api_key:Lr,client_integration_error:Rr,rate_limit_error_name:zr,route_not_found:Br,route_not_found_message:Vr,cannot_promote_revision_message:Hr,cannot_promote_to_draft_message:Ur,page_not_found:Wr,validation_error_message:Gr,authorisation_error_message:Kr,forbidden_error_message:qr,send_email_error_name:Jr,field_document_collection_not_found:Yr,field_has_relation_data:Xr,invalid_encrypted_secret:Zr,media_duplicate_key_error_name:Qr,media_duplicate_key_error_message:$r,route_media_create_error_name:ei,route_media_create_error_message:ti,media_error_not_awaiting_sync:ni,vite_build_error_name:ri,vite_build_error_copy_assets_error:ii,vite_build_error_message:ai,vite_build_meta_generation_error:oi,vite_client_mount_generation_error:si,vite_client_index_generation_error:ci,vite_build_meta_read_error:li,collection_migrator_error_name:ui,collection_migrator_table_name_brick_key_missing_message:di,collection_migrator_table_name_repeater_keys_missing_message:fi,cannot_find_field_with_key_in_collection_brick:pi,infer_collection_schema_error:mi,invalid_table_name_format_start_with:hi,invalid_table_name_format_insufficient_parts:gi,failed_to_infer_table_parts:_i,repeater_field_contains_errors:vi,repeater_max_groups_exceeded:yi,repeater_groups_exceeded_min:bi,error_fetching_users_for_validation:xi,error_fetching_documents_for_validation:Si,error_fetching_documents_from_collection:Ci,error_fetching_media_for_validation:wi,field_is_required:Ti,error_fetching_media_for_document:Ei,error_getting_collection_names:Di,failed_to_prerender_mjml_templates:Oi,setup_already_completed:ki,error_schema_migration_required_name:Ai,error_schema_migration_required_message:ji,version_not_found_message:Mi,error_update_revision_version_name:Ni,error_update_revision_version_message:Pi};const Ii=Fi,Li=(e,t)=>{let n=Ii[e];return n?t?n.replace(/\{\{(\w+)\}\}/g,(e,n)=>t[n]):n:e};var W=Li;const Ri=Object.freeze({users:{key:`users_permissions`,permissions:[`create_user`,`update_user`,`delete_user`]},roles:{key:`roles_permissions`,permissions:[`create_role`,`update_role`,`delete_role`]},media:{key:`media_permissions`,permissions:[`create_media`,`update_media`,`delete_media`]},emails:{key:`emails_permissions`,permissions:[`read_email`,`delete_email`,`send_email`]},content:{key:`content_permissions`,permissions:[`create_content`,`update_content`,`delete_content`,`restore_content`,`publish_content`]},"client-integrations":{key:`client-integrations_permissions`,permissions:[`create_client_integration`,`update_client_integration`,`delete_client_integration`,`regenerate_client_integration`]}});var G=Ri,K=Object.freeze({locales:[`en`],swaggerRoutePrefix:`/documentation`,headers:{csrf:`_csrf`,contentLocale:`lucid-content-locale`},cookies:{csrf:`_csrf`,refreshToken:`_refresh`,accessToken:`_access`},scrypt:{N:2**16,r:8,p:1,dkLen:32},seedDefaults:{roles:[{name:`Admin`,description:`The admin role has permissions to do everything.`,permissions:[...G.users.permissions,...G.roles.permissions,...G.media.permissions,...G.emails.permissions,...G.content.permissions,...G[`client-integrations`].permissions]},{name:`Editor`,description:`The editor role has permissions to manage content.`,permissions:[...G.media.permissions,...G.content.permissions]}]},fieldBuiler:{maxRepeaterDepth:3},collectionBuilder:{isLocked:!1,useDrafts:!1,useRevisions:!1,useTranslations:!1,useAutoSave:!1},customFields:{link:{targets:[`_self`,`_blank`,`_parent`,`_top`,`framename`]}},query:{page:1,perPage:10},locations:{resetPassword:`/admin/reset-password`},errors:{name:W(`default_error_name`),message:W(`default_error_message`),status:500,code:void 0,errors:void 0},emailTemplates:{resetPassword:`reset-password`,userInvite:`user-invite`,passwordResetSuccess:`password-reset-success`,emailChanged:`email-changed`},emailRenderedOutput:`email-templates.json`,rateLimit:{max:100,timeWindow:`1 minute`},directories:{public:`public`,temp:`.lucid`},vite:{dist:`admin`,mount:`mount.jsx`,html:`index.html`,rootSelector:`root`,buildMetadata:`build-metadata.json`,port:24678},brickTypes:{builder:`builder`,fixed:`fixed`},db:{prefix:`lucid_`,collectionKeysJoin:`__`,generatedColumnPrefix:`_`},logScopes:{lucid:`lucid`,migrations:`migrations`,cron:`cron`,config:`config`,sync:`sync`,query:`query`,http:`http`,validation:`validation`},retention:{deletedCollections:30,deletedLocales:30},cronSchedule:`0 0 * * *`,csrfExpiration:604800,refreshTokenExpiration:604800,accessTokenExpiration:300,passwordResetTokenExpirationMinutes:15,userInviteTokenExpirationMinutes:1440,documentation:`https://lucidcms.io/getting-started`,lucidUi:`https://lucidui.io/`,mediaAwaitingSyncInterval:36e5,media:{imagePresetQuality:80},config:{filename:`lucid.config`,extensions:[`.ts`,`.js`,`.mjs`,`.mts`]}});const zi=e=>{switch(e.type){case`validation`:return{status:400,name:e.name??W(`validation_error`),message:e.message??W(`validation_error_message`)};case`authorisation`:return{status:401,name:e.name??W(`authorisation_error`),message:e.message??W(`authorisation_error_message`)};case`forbidden`:return{status:403,name:e.name??W(`forbidden_error`),message:e.message??W(`forbidden_error_message`)};default:return{status:e.status,name:e.name,message:e.message}}};var q=zi,Bi=class e extends Error{error;constructor(t){super(t.message),this.error=t,t.zod!==void 0&&(this.error.errors=e.formatZodErrors(t.zod?.issues||[]));let n=q(t);this.error.status=n.status,this.name=n.name??K.errors.name,this.message=n.message??K.errors.message}static formatZodErrors(e){let t={};for(let n of e){let e=t;for(let t of n.path)typeof t==`number`&&(e=e.children||(e.children=[])),e=e[t]||(e[t]={});e.code=n.code,e.message=n.message}return t??void 0}},Vi=Bi;const Hi=(e={})=>{let{colours:t=!0,timestamps:n=!0}=e,r={error:`\x1B[31m`,warn:`\x1B[33m`,info:`\x1B[36m`,debug:`\x1B[90m`,silent:``},i=`\x1B[0m`;return(e,a)=>{if(e===`silent`)return;let o=n?`${new Date().toISOString()} `:``,s=t?r[e]:``,c=t?i:``,l=`${o}${s}[${e.toUpperCase()}${a.scope?`:${a.scope.toUpperCase()}`:``}]${c}`,u;switch(e){case`error`:u=console.error;break;case`warn`:u=console.warn;break;case`info`:u=console.info;break;case`debug`:u=console.debug;break;default:u=console.log;break}try{let e=a.data?JSON.stringify(a.data):void 0;u(`${l} ${a.message}`,e||``)}catch(e){u(`${l} ${a.message}`)}}};var Ui=Hi;const J={silent:-1,error:0,warn:1,info:2,debug:3};let Y=null;const X=(e,t)=>J[t]<=J[e],Z=e=>{let t=e?.level??`info`,n=e?.force??!1,r=e?.transport??Ui();if(Y&&!n)return Y;Y={config:{level:t,transport:r},error:e=>{X(t,`error`)&&r(`error`,e)},warn:e=>{X(t,`warn`)&&r(`warn`,e)},info:e=>{X(t,`info`)&&r(`info`,e)},debug:e=>{X(t,`debug`)&&r(`debug`,e)}}};Y||Z();const Q=()=>{if(!Y)throw Error(`Logger has not been initialised. Call initialiseLogger() first.`);return Y},Wi={get config(){return Q().config},error:e=>Q().error(e),warn:e=>Q().warn(e),info:e=>Q().info(e),debug:e=>Q().debug(e)};var $=Wi,Gi=class extends Error{scope;kill;constructor(e){super(e.message),this.scope=e.scope,this.kill=e.kill,$.error({message:this.message,scope:this.scope,data:e.data??void 0}),this.kill&&process.exit(1)}},Ki=Gi;const qi=t=>e.prettifyError(t).replace(/✖/g,``);var Ji=qi;export{K as constants_default,q as error_type_defaults_default,Z as initialiseLogger,$ as logger_default,Vi as lucid_api_error_default,Ki as lucid_error_default,G as permission_groups_default,Ji as tidy_zod_errors_default,W as translations_default};
//# sourceMappingURL=errors-RyYO6qM6.js.map