Skip to main content

Module: backend

CromwellCMS Backend SDK

Exports backend helpers, ORM repositories and entities.

Install#

npm i @cromwell/core-backend

Use#

Example of usage

import { ProductRepository } from '@cromwell/core-backend';import { getCustomRepository } from 'typeorm';
const products = await getCustomRepository(ProductRepository).getProducts();

Table of contents#

Classes#

Type aliases#

Variables#

Functions#

Type aliases#

Action#

Ƭ Action<PayloadType, OutputType>: Object

Type parameters#

NameType
PayloadTypePayloadType
OutputTypeany

Type declaration#

NameType
outputOutputType
payloadPayloadType

Defined in#

system/core/backend/src/helpers/types.ts:25


ActionNames#

Ƭ ActionNames: keyof ActionTypes

Defined in#

system/core/backend/src/helpers/types.ts:91


ActionTypes#

Ƭ ActionTypes: Object

Type declaration#

NameType
create_attributeAction<TAttribute>
create_couponAction<TCoupon>
create_custom_entityAction<TCustomEntity>
create_orderAction<TOrder>
create_paymentAction<TOrderPaymentSession, Object>
create_postAction<TPost>
create_post_commentAction<TPostComment>
create_productAction<TProduct>
create_product_categoryAction<TProductCategory>
create_product_reviewAction<TProductReview>
create_tagAction<TTag>
create_userAction<TUser>
delete_attributeAction<Object>
delete_couponAction<Object>
delete_custom_entityAction<Object>
delete_orderAction<Object>
delete_postAction<Object>
delete_post_commentAction<Object>
delete_productAction<Object>
delete_product_categoryAction<Object>
delete_product_reviewAction<Object>
delete_tagAction<Object>
delete_userAction<Object>
install_pluginAction<Object>
install_themeAction<Object>
uninstall_pluginAction<Object>
uninstall_themeAction<Object>
update_attributeAction<TAttribute>
update_couponAction<TCoupon>
update_custom_entityAction<TCustomEntity>
update_orderAction<TOrder>
update_pluginAction<Object>
update_postAction<TPost>
update_post_commentAction<TPostComment>
update_productAction<TProduct>
update_product_categoryAction<TProductCategory>
update_product_reviewAction<TProductReview>
update_settingsAction<TCmsSettings>
update_tagAction<TTag>
update_themeAction<Object>
update_userAction<TUser>

Defined in#

system/core/backend/src/helpers/types.ts:30


DeepWriteable#

Ƭ DeepWriteable<T>: { -readonly[P in keyof T]: DeepWriteable<T[P]>}

Type parameters#

Name
T

Defined in#

system/core/backend/src/helpers/connect-database.ts:20


TAllThemeConfigs#

Ƭ TAllThemeConfigs: Object

Type declaration#

NameType
themeConfigTThemeConfig | null
themeInfoTPackageCromwellConfig | null
userConfigTThemeConfig | null

Defined in#

system/core/backend/src/helpers/theme-config.ts:18


TAuthSettings#

Ƭ TAuthSettings: Object

Type declaration#

NameType
accessSecretstring
accessTokenCookieNamestring
cookieSecretstring
expirationAccessTimenumber
expirationRefreshTimenumber
maxTokensPerUsernumber
refreshSecretstring
refreshTokenCookieNamestring
resetPasswordAttemptsnumber
resetPasswordCodeExpirationAccessTimenumber
serviceSecretstring

Defined in#

system/core/backend/src/helpers/auth-settings.ts:8


TAuthUserInfo#

Ƭ TAuthUserInfo: Object

Type declaration#

NameType
email?string | null
idnumber
roleTUserRole

Defined in#

system/core/backend/src/helpers/auth-guards.ts:7


TBackendModule#

Ƭ TBackendModule: Object

Type declaration#

NameType
controllers?unknown[]
entities?unknown[]
migrations?unknown[]
providers?unknown[]
resolvers?unknown[]

Defined in#

system/core/backend/src/helpers/types.ts:17


TEntityMeta#

Ƭ TEntityMeta: Object

Type declaration#

NameType
entityId?number
idnumber
key?string | null
value?string | null

Defined in#

system/core/backend/src/models/entities/meta/base-meta.entity.ts:4


TGraphQLContext#

Ƭ TGraphQLContext: Object

Type declaration#

NameType
user?TAuthUserInfo

Defined in#

system/core/backend/src/helpers/auth-guards.ts:30


TPluginInfo#

Ƭ TPluginInfo: Object

Type declaration#

NameType
adminPanelPath?string
backendPath?string
frontendPath?string
pluginDirstring
pluginNamestring

Defined in#

system/core/backend/src/helpers/plugin-exports.ts:19


TRequestWithUser#

Ƭ TRequestWithUser: FastifyRequest & { cookies: any ; user: TAuthUserInfo }

Defined in#

system/core/backend/src/helpers/auth-guards.ts:19


TTokenInfo#

Ƭ TTokenInfo: Object

Type declaration#

NameType
cookiestring
maxAgestring
tokenstring

Defined in#

system/core/backend/src/helpers/auth-guards.ts:24


TTokenPayload#

Ƭ TTokenPayload: Object

Type declaration#

NameType
roleTUserRole
subnumber
username?string | null

Defined in#

system/core/backend/src/helpers/auth-guards.ts:13


Writeable#

Ƭ Writeable<T>: { -readonly[P in keyof T]: T[P]}

Type parameters#

Name
T

Defined in#

system/core/backend/src/helpers/connect-database.ts:16

Variables#

CustomDateScalar#

Const CustomDateScalar: GraphQLScalarType

Defined in#

system/core/backend/src/models/objects/custom-date.scalar.ts:3


GenericCms#

Const GenericCms: Object

Type declaration#

NameType
abstractResolverany
createArgsany
pagedEntityany
repositoryObjectType<BaseRepository<CmsEntity, CmsEntity>>
updateArgsany

Defined in#

system/core/backend/src/helpers/generic-entities.ts:12


GenericPlugin#

Const GenericPlugin: Object

Type declaration#

NameType
abstractResolverany
createArgsany
pagedEntityany
repositoryObjectType<BaseRepository<PluginEntity, TPluginEntityInput>>
updateArgsany

Defined in#

system/core/backend/src/helpers/generic-entities.ts:11


GenericTheme#

Const GenericTheme: Object

Type declaration#

NameType
abstractResolverany
createArgsany
pagedEntityany
repositoryObjectType<BaseRepository<ThemeEntity, TThemeEntityInput>>
updateArgsany

Defined in#

system/core/backend/src/helpers/generic-entities.ts:10


ORMEntities#

Const ORMEntities: (typeof ThemeEntity | typeof Product | typeof ProductCategory | typeof Post | typeof User | typeof Attribute | typeof ProductReview | typeof Order | typeof CmsEntity | typeof Tag | typeof PageStats | typeof PostComment | typeof AttributeMeta | typeof OrderMeta | typeof PostMeta | typeof ProductCategoryMeta | typeof ProductMeta | typeof TagMeta | typeof UserMeta | typeof AttributeToProduct | typeof AttributeValue | typeof CustomEntity | typeof CustomEntityMeta | typeof Coupon | typeof CouponMeta | typeof ProductVariant | typeof ProductVariantMeta)[]

Defined in#

system/core/backend/src/helpers/constants.ts:34


PrimitiveValueScalar#

Const PrimitiveValueScalar: GraphQLScalarType

Defined in#

system/core/backend/src/models/objects/primitive-value.scalar.ts:16


adminPanelMessages#

Const adminPanelMessages: Object

Type declaration#

NameType
onBuildEndMessagestring
onBuildErrorMessagestring
onBuildStartMessagestring
onStartErrorMessagestring
onStartMessagestring

Defined in#

system/core/backend/src/helpers/constants.ts:54


bcryptSaltRounds#

Const bcryptSaltRounds: 10

Defined in#

system/core/backend/src/helpers/auth-settings.ts:6


buildDirName#

Const buildDirName: "build"

Defined in#

system/core/backend/src/helpers/paths.ts:10


cmsConfigFileName#

Const cmsConfigFileName: "cmsconfig.json"

Defined in#

system/core/backend/src/helpers/paths.ts:12


cmsName#

Const cmsName: "cromwell"

Defined in#

system/core/backend/src/helpers/paths.ts:8


cmsPackageName#

Const cmsPackageName: "@cromwell/cms"

Defined in#

system/core/backend/src/helpers/constants.ts:122


configFileName#

Const configFileName: string

Defined in#

system/core/backend/src/helpers/paths.ts:11


defaultCmsConfig#

Const defaultCmsConfig: TCmsConfig

Defined in#

system/core/backend/src/helpers/constants.ts:70


entityMetaRepository#

Const entityMetaRepository: EntityMetaRepository

Defined in#

system/core/backend/src/helpers/entity-meta.ts:165


pluginAdminBundlePath#

Const pluginAdminBundlePath: "admin/index.js"

Defined in#

system/core/backend/src/helpers/paths.ts:240


pluginAdminCjsPath#

Const pluginAdminCjsPath: "admin/cjs.js"

Defined in#

system/core/backend/src/helpers/paths.ts:241


pluginFrontendBundlePath#

Const pluginFrontendBundlePath: "frontend/index.js"

Defined in#

system/core/backend/src/helpers/paths.ts:238


pluginFrontendCjsPath#

Const pluginFrontendCjsPath: "frontend/cjs.js"

Defined in#

system/core/backend/src/helpers/paths.ts:239


rendererMessages#

Const rendererMessages: Object

Type declaration#

NameType
onBuildEndMessagestring
onBuildErrorMessagestring
onBuildStartMessagestring
onStartErrorMessagestring
onStartMessagestring

Defined in#

system/core/backend/src/helpers/constants.ts:46


serverMessages#

Const serverMessages: Object

Type declaration#

NameType
onBuildEndMessagestring
onBuildErrorMessagestring
onBuildStartMessagestring
onStartErrorMessagestring
onStartMessagestring

Defined in#

system/core/backend/src/helpers/constants.ts:62


tempDirName#

Const tempDirName: string

Defined in#

system/core/backend/src/helpers/paths.ts:9

Functions#

Roles#

Const Roles(...roles): CustomDecorator<string>

Parameters#

NameType
...rolesTAuthRole[]

Returns#

CustomDecorator<string>

Defined in#

system/core/backend/src/helpers/auth-guards.ts:34


applyBaseFilter#

Const applyBaseFilter<TEntity>(__namedParameters): SelectQueryBuilder<TEntity>

Type parameters#

Name
TEntity

Parameters#

NameType
__namedParametersObject
__namedParameters.EntityClass?(...args: any[]) => BasePageEntity & typeof BaseEntity
__namedParameters.dbType"mysql" | "mariadb" | "postgres" | "cockroachdb" | "sqlite" | "mssql" | "sap" | "oracle" | "cordova" | "nativescript" | "react-native" | "sqljs" | "mongodb" | "aurora-data-api" | "aurora-data-api-pg" | "expo" | "better-sqlite3" | "capacitor"
__namedParameters.entityType?EDBEntity
__namedParameters.filterBaseFilterInput
__namedParameters.qbSelectQueryBuilder<TEntity>

Returns#

SelectQueryBuilder<TEntity>

Defined in#

system/core/backend/src/helpers/base-queries.ts:147


applyGetManyFromOne#

Const applyGetManyFromOne<T>(qb, firstEntityName, firstEntityProp, secondEntityName, secondEntityId): SelectQueryBuilder<T>

Retrieve all related entities of one specified entity by id in many-to-many relationship E.g. get all products from a category

prop firstEntityName - table DB name of many

prop firstEntityProp - property of many that refers to relationship

prop secondEntityName - table DB name of one

prop secondEntityId - DB id of one

Type parameters#

Name
T

Parameters#

NameType
qbSelectQueryBuilder<T>
firstEntityNamestring
firstEntityPropkeyof T
secondEntityNamestring
secondEntityIdnumber

Returns#

SelectQueryBuilder<T>

Defined in#

system/core/backend/src/helpers/base-queries.ts:37


applyGetPaged#

Const applyGetPaged<T>(qb, sortByTableName?, params?): SelectQueryBuilder<T>

Type parameters#

Name
T

Parameters#

NameType
qbSelectQueryBuilder<T>
sortByTableName?string
params?TPagedParams<T>

Returns#

SelectQueryBuilder<T>

Defined in#

system/core/backend/src/helpers/base-queries.ts:11


checkEntitySlug#

Const checkEntitySlug<T>(entity, EntityClass): Promise<T>

Type parameters#

NameType
Textends BasePageEntity<T>

Parameters#

NameType
entityT
EntityClass(...args: any[]) => T

Returns#

Promise<T>

Defined in#

system/core/backend/src/helpers/base-queries.ts:96


collectPlugins#

Const collectPlugins(options?): Promise<TBackendModule>

Parameters#

NameType
options?Object
options.cwd?string
options.updateCache?boolean

Returns#

Promise<TBackendModule>

Defined in#

system/core/backend/src/helpers/plugin-exports.ts:76


connectDatabase#

Const connectDatabase(__namedParameters): Promise<void>

Parameters#

NameType
__namedParametersObject
__namedParameters.development?boolean
__namedParameters.ormConfigOverride?Partial<Writeable<MysqlConnectionOptions>>

Returns#

Promise<void>

Defined in#

system/core/backend/src/helpers/connect-database.ts:24


createGenericEntity#

Const createGenericEntity<EntityType, EntityInputType>(entityName, EntityClass, InputEntityClass?): Object

Type parameters#

NameType
EntityTypeEntityType
EntityInputTypeEntityType

Parameters#

NameType
entityNamestring
EntityClass(...args: any[]) => EntityType
InputEntityClass?(...args: any[]) => EntityInputType

Returns#

Object

NameType
abstractResolverany
createArgsany
pagedEntityany
repositoryObjectType<BaseRepository<EntityType, EntityInputType>>
updateArgsany

Defined in#

system/core/backend/src/helpers/create-generic-entity.ts:10


findPlugin#

Const findPlugin(pluginName): Promise<undefined | TPluginEntity>

Parameters#

NameType
pluginNamestring

Returns#

Promise<undefined | TPluginEntity>

Defined in#

system/core/backend/src/helpers/plugin-settings.ts:8


findTheme#

Const findTheme(themeName): Promise<undefined | TThemeEntity>

Parameters#

NameType
themeNamestring

Returns#

Promise<undefined | TThemeEntity>

Defined in#

system/core/backend/src/helpers/theme-config.ts:9


fireAction#

Const fireAction<T, TPayload, TOutput>(options): Promise<Record<string, TOutput>>

Type parameters#

NameType
Textends keyof ActionTypes
TPayloadActionTypes[T][``"payload"``]
TOutputActionTypes[T][``"output"``]

Parameters#

NameType
optionsObject
options.actionNamestring | T
options.payload?TPayload

Returns#

Promise<Record<string, TOutput>>

Defined in#

system/core/backend/src/helpers/actions.ts:27


getAdminPanelDir#

Const getAdminPanelDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:103


getAdminPanelServiceBuildDir#

Const getAdminPanelServiceBuildDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:104


getAdminPanelStartupPath#

Const getAdminPanelStartupPath(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:116


getAdminPanelStaticDir#

Const getAdminPanelStaticDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:120


getAdminPanelTempDir#

Const getAdminPanelTempDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:108


getAdminPanelWebPublicDir#

Const getAdminPanelWebPublicDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:113


getAdminPanelWebServiceBuildDir#

Const getAdminPanelWebServiceBuildDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:110


getAuthSettings#

Const getAuthSettings(options?): Promise<TAuthSettings>

Parameters#

NameType
options?Object
options.serverCachePath?string

Returns#

Promise<TAuthSettings>

Defined in#

system/core/backend/src/helpers/auth-settings.ts:24


getBundledModulesDir#

Const getBundledModulesDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:251


getCmsConfigPath#

Const getCmsConfigPath(dir?): Promise<any>

Parameters#

NameType
dir?string

Returns#

Promise<any>

Defined in#

system/core/backend/src/helpers/paths.ts:44


getCmsConfigPathSync#

Const getCmsConfigPathSync(dir?): any

Parameters#

NameType
dir?string

Returns#

any

Defined in#

system/core/backend/src/helpers/paths.ts:60


getCmsEntity#

Const getCmsEntity(): Promise<CmsEntity>

Returns#

Promise<CmsEntity>

Defined in#

system/core/backend/src/helpers/cms-settings.ts:57


getCmsInfo#

Const getCmsInfo(): Promise<TCmsInfo>

Returns#

Promise<TCmsInfo>

Defined in#

system/core/backend/src/helpers/cms-settings.ts:104


getCmsModuleConfig#

Const getCmsModuleConfig(moduleName?): Promise<undefined | TModuleConfig>

Parameters#

NameType
moduleName?string

Returns#

Promise<undefined | TModuleConfig>

Defined in#

system/core/backend/src/helpers/paths.ts:209


getCmsModuleInfo#

Const getCmsModuleInfo(moduleName?): Promise<undefined | TPackageCromwellConfig>

Parameters#

NameType
moduleName?string

Returns#

Promise<undefined | TPackageCromwellConfig>

Defined in#

system/core/backend/src/helpers/paths.ts:220


getCmsSettings#

Const getCmsSettings(): Promise<undefined | TCmsSettings>

Returns#

Promise<undefined | TCmsSettings>

Defined in#

system/core/backend/src/helpers/cms-settings.ts:72


getCoreBackendDir#

Const getCoreBackendDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:78


getCoreCommonDir#

Const getCoreCommonDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:76


getCoreFrontendDir#

Const getCoreFrontendDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:77


getEmailTemplate#

Const getEmailTemplate(fileName, props?): Promise<undefined | string>

Parameters#

NameType
fileNamestring
props?Record<string, any>

Returns#

Promise<undefined | string>

Defined in#

system/core/backend/src/helpers/emailing.ts:14


getErrorLogPath#

Const getErrorLogPath(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:80


getLogger#

Const getLogger(writeToFile?): Object

Parameters#

NameTypeDefault value
writeToFilebooleantrue

Returns#

Object

NameType
error(...args: any[]) => void
info(...args: any[]) => void
log(...args: any[]) => void
warn(...args: any[]) => void

Defined in#

system/core/backend/src/helpers/logger.ts:17


getLogsDir#

Const getLogsDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:79


getManagerDir#

Const getManagerDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:83


getManagerTempDir#

Const getManagerTempDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:84


getMetaInfoPath#

Const getMetaInfoPath(filename): string

Parameters#

NameType
filenamestring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:236


getMigrationsDirName#

Const getMigrationsDirName(dbType): undefined | "migrations/sqlite" | "migrations/mysql" | "migrations/postgres"

Parameters#

NameType
dbType"mysql" | "mariadb" | "postgres" | "cockroachdb" | "sqlite" | "mssql" | "sap" | "oracle" | "cordova" | "nativescript" | "react-native" | "sqljs" | "mongodb" | "aurora-data-api" | "aurora-data-api-pg" | "expo" | "better-sqlite3" | "capacitor"

Returns#

undefined | "migrations/sqlite" | "migrations/mysql" | "migrations/postgres"

Defined in#

system/core/backend/src/helpers/constants.ts:124


getModulePackage#

Const getModulePackage(moduleName?): Promise<undefined | TPackageJson>

Parameters#

NameType
moduleName?string

Returns#

Promise<undefined | TPackageJson>

Defined in#

system/core/backend/src/helpers/paths.ts:262


getModuleStaticDir#

Const getModuleStaticDir(moduleName): Promise<undefined | string>

Parameters#

NameType
moduleNamestring

Returns#

Promise<undefined | string>

Defined in#

system/core/backend/src/helpers/paths.ts:229


getNodeModuleDir#

Const getNodeModuleDir(moduleName): Promise<undefined | string>

Parameters#

NameType
moduleNamestring

Returns#

Promise<undefined | string>

Defined in#

system/core/backend/src/helpers/paths.ts:31


getNodeModuleDirSync#

Const getNodeModuleDirSync(moduleName): undefined | string

Parameters#

NameType
moduleNamestring

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:22


getPaged#

Const getPaged<T>(qb, sortByTableName?, params?): Promise<TPagedList<T>>

Type parameters#

Name
T

Parameters#

NameType
qbSelectQueryBuilder<T>
sortByTableName?string
params?TPagedParams<T>

Returns#

Promise<TPagedList<T>>

Defined in#

system/core/backend/src/helpers/base-queries.ts:44


getPluginAdminBundlePath#

Const getPluginAdminBundlePath(distDir): string

Parameters#

NameType
distDirstring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:245


getPluginAdminCjsPath#

Const getPluginAdminCjsPath(distDir): string

Parameters#

NameType
distDirstring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:246


getPluginBackendPath#

Const getPluginBackendPath(distDir): string

Parameters#

NameType
distDirstring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:247


getPluginFrontendBundlePath#

Const getPluginFrontendBundlePath(distDir): string

Parameters#

NameType
distDirstring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:242


getPluginFrontendCjsPath#

Const getPluginFrontendCjsPath(distDir): string

Parameters#

NameType
distDirstring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:243


getPluginFrontendMetaPath#

Const getPluginFrontendMetaPath(distDir): string

Parameters#

NameType
distDirstring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:244


getPluginSettings#

Const getPluginSettings(pluginName): Promise<any>

Parameters#

NameType
pluginNamestring

Returns#

Promise<any>

Defined in#

system/core/backend/src/helpers/plugin-settings.ts:26


getPublicDir#

Const getPublicDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:253


getPublicPluginsDir#

Const getPublicPluginsDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:254


getPublicThemesDir#

Const getPublicThemesDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:255


getRendererBuildDir#

Const getRendererBuildDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:95


getRendererDir#

Const getRendererDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:88


getRendererStartupPath#

Const getRendererStartupPath(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:89


getRendererTempDevDir#

Const getRendererTempDevDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:94


getRendererTempDir#

Const getRendererTempDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:93


getServerBuildDir#

Const getServerBuildDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:131


getServerBuildMonitorPath#

Const getServerBuildMonitorPath(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:143


getServerBuildPath#

Const getServerBuildPath(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:135


getServerBuildProxyPath#

Const getServerBuildProxyPath(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:139


getServerCachePath#

Const getServerCachePath(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:153


getServerDefaultEmailsDir#

Const getServerDefaultEmailsDir(): void

Returns#

void

Defined in#

system/core/backend/src/helpers/paths.ts:149


getServerDir#

Const getServerDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:126


getServerStartupPath#

Const getServerStartupPath(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:127


getServerTempDir#

Const getServerTempDir(dir?): string

Parameters#

NameType
dir?string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:147


getServerTempEmailsDir#

Const getServerTempEmailsDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:148


getSqlBoolStr#

Const getSqlBoolStr(dbType, b): "true" | "false" | "1" | "0"

Parameters#

NameType
dbType"mysql" | "mariadb" | "postgres" | "cockroachdb" | "sqlite" | "mssql" | "sap" | "oracle" | "cordova" | "nativescript" | "react-native" | "sqljs" | "mongodb" | "aurora-data-api" | "aurora-data-api-pg" | "expo" | "better-sqlite3" | "capacitor"
bboolean

Returns#

"true" | "false" | "1" | "0"

Defined in#

system/core/backend/src/helpers/base-queries.ts:130


getSqlLike#

Const getSqlLike(dbType): "ILIKE" | "LIKE"

Parameters#

NameType
dbType"mysql" | "mariadb" | "postgres" | "cockroachdb" | "sqlite" | "mssql" | "sap" | "oracle" | "cordova" | "nativescript" | "react-native" | "sqljs" | "mongodb" | "aurora-data-api" | "aurora-data-api-pg" | "expo" | "better-sqlite3" | "capacitor"

Returns#

"ILIKE" | "LIKE"

Defined in#

system/core/backend/src/helpers/base-queries.ts:137


getTempDir#

Const getTempDir(dir?): string

Parameters#

NameType
dir?string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:14


getThemeAdminPanelDir#

Const getThemeAdminPanelDir(themeModuleName): Promise<undefined | string>

Parameters#

NameType
themeModuleNamestring

Returns#

Promise<undefined | string>

Defined in#

system/core/backend/src/helpers/paths.ts:202


getThemeBuildDir#

Const getThemeBuildDir(themeModuleName): Promise<undefined | string>

Parameters#

NameType
themeModuleNamestring

Returns#

Promise<undefined | string>

Defined in#

system/core/backend/src/helpers/paths.ts:170


getThemeConfigs#

Const getThemeConfigs(themeName): Promise<TAllThemeConfigs>

Get currently active Theme's configs from DB

Parameters#

NameTypeDescription
themeNamestringspecify Theme to get config from, otherwise it will return from an active theme

Returns#

Promise<TAllThemeConfigs>

Defined in#

system/core/backend/src/helpers/theme-config.ts:28


getThemeNextBuildDir#

Const getThemeNextBuildDir(themeModuleName): Promise<undefined | string>

Parameters#

NameType
themeModuleNamestring

Returns#

Promise<undefined | string>

Defined in#

system/core/backend/src/helpers/paths.ts:189


getThemeNextBuildDirByPath#

Const getThemeNextBuildDirByPath(themeDir): string

Parameters#

NameType
themeDirstring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:195


getThemePagesMetaPath#

Const getThemePagesMetaPath(distDir): string

Parameters#

NameType
distDirstring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:248


getThemePagesVirtualPath#

Const getThemePagesVirtualPath(distDir): string

Parameters#

NameType
distDirstring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:249


getThemeRollupBuildDir#

Const getThemeRollupBuildDir(themeModuleName): Promise<undefined | string>

Parameters#

NameType
themeModuleNamestring

Returns#

Promise<undefined | string>

Defined in#

system/core/backend/src/helpers/paths.ts:179


getThemeRollupBuildDirByPath#

Const getThemeRollupBuildDirByPath(themeDir): string

Parameters#

NameType
themeDirstring

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:185


getThemeTempAdminPanelDir#

Const getThemeTempAdminPanelDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:198


getThemeTempRollupBuildDir#

Const getThemeTempRollupBuildDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:176


getUtilsBuildDir#

Const getUtilsBuildDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:163


getUtilsDir#

Const getUtilsDir(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:158


getUtilsImporterPath#

Const getUtilsImporterPath(): undefined | string

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:159


getUtilsTempDir#

Const getUtilsTempDir(): string

Returns#

string

Defined in#

system/core/backend/src/helpers/paths.ts:167


graphQlAuthChecker#

Const graphQlAuthChecker(options?, roles?): boolean

Parameters#

NameType
options?null | { args?: Record<string, any> ; context?: TGraphQLContext ; info?: any ; root?: any }
roles?null | TAuthRole[]

Returns#

boolean

Defined in#

system/core/backend/src/helpers/auth-guards.ts:51


handleBaseInput#

Const handleBaseInput(entity, input): Promise<void>

Parameters#

NameType
entityBasePageEntity
inputTBasePageEntityInput

Returns#

Promise<void>

Defined in#

system/core/backend/src/helpers/base-queries.ts:62


handleCustomMetaInput#

Const handleCustomMetaInput<T>(entity, input): Promise<void>

Type parameters#

NameType
Textends Object

Parameters#

NameType
entityBasePageEntity
inputT

Returns#

Promise<void>

Defined in#

system/core/backend/src/helpers/base-queries.ts:77


isExternalForm#

Const isExternalForm(id): boolean

Parameters#

NameType
idany

Returns#

boolean

Defined in#

system/core/backend/src/helpers/paths.ts:250


isSimpleString#

Const isSimpleString(str): undefined | boolean | ""

Parameters#

NameType
strundefined | string

Returns#

undefined | boolean | ""

Defined in#

system/core/backend/src/helpers/base-queries.ts:128


readCMSConfig#

Const readCMSConfig(path?): Promise<TCmsConfig>

Read CMS config from file in [project root]/cmsconfig.json, saves it into the store and returns

Parameters#

NameType
path?string

Returns#

Promise<TCmsConfig>

Defined in#

system/core/backend/src/helpers/cms-settings.ts:39


readCMSConfigSync#

Const readCMSConfigSync(path?): TCmsConfig

Read CMS config from file in [project root]/cmsconfig.json, saves it into the store and returns

Parameters#

NameType
path?string

Returns#

TCmsConfig

Defined in#

system/core/backend/src/helpers/cms-settings.ts:21


readCmsModules#

Const readCmsModules(dir?): Promise<Object>

Parameters#

NameType
dir?string

Returns#

Promise<Object>

Defined in#

system/core/backend/src/helpers/cms-modules.ts:7


readPackage#

Const readPackage(path): Promise<any>

Parameters#

NameType
pathstring

Returns#

Promise<any>

Defined in#

system/core/backend/src/helpers/paths.ts:257


readPluginsExports#

Const readPluginsExports(options?): Promise<TPluginInfo[]>

Parameters#

NameType
options?Object
options.cwd?string

Returns#

Promise<TPluginInfo[]>

Defined in#

system/core/backend/src/helpers/plugin-exports.ts:29


registerAction#

Const registerAction<T, TPayload, TOutput>(options): void

Type parameters#

NameType
Textends keyof ActionTypeskeyof ActionTypes
TPayloadActionTypes[T][``"payload"``]
TOutputActionTypes[T][``"output"``]

Parameters#

NameType
optionsObject
options.actionNameT
options.pluginNamestring
options.action(payload: TPayload) => Promise<TOutput>

Returns#

void

Defined in#

system/core/backend/src/helpers/actions.ts:7


resolvePackageJsonPath#

Const resolvePackageJsonPath(moduleName): undefined | string

Parameters#

NameType
moduleNamestring

Returns#

undefined | string

Defined in#

system/core/backend/src/helpers/paths.ts:16


runShellCommand#

Const runShellCommand(command, cwd?): Promise<void>

Parameters#

NameType
commandstring
cwd?string

Returns#

Promise<void>

Defined in#

system/core/backend/src/helpers/shell.ts:7


savePlugin#

Const savePlugin(plugin): Promise<TPluginEntity>

Parameters#

NameType
pluginTPluginEntity

Returns#

Promise<TPluginEntity>

Defined in#

system/core/backend/src/helpers/plugin-settings.ts:21


savePluginSettings#

Const savePluginSettings(pluginName, input): Promise<boolean>

Parameters#

NameType
pluginNamestring
inputany

Returns#

Promise<boolean>

Defined in#

system/core/backend/src/helpers/plugin-settings.ts:50


sendEmail#

Const sendEmail(addresses, subject, htmlContent): Promise<boolean>

Parameters#

NameType
addressesstring[]
subjectstring
htmlContentstring

Returns#

Promise<boolean>

Defined in#

system/core/backend/src/helpers/emailing.ts:34


validateEmail#

Const validateEmail(email): boolean

Parameters#

NameType
emailany

Returns#

boolean

Defined in#

system/core/backend/src/helpers/validation.ts:1


wrapInQuotes#

Const wrapInQuotes(dbType, str): string

Parameters#

NameType
dbType"mysql" | "mariadb" | "postgres" | "cockroachdb" | "sqlite" | "mssql" | "sap" | "oracle" | "cordova" | "nativescript" | "react-native" | "sqljs" | "mongodb" | "aurora-data-api" | "aurora-data-api-pg" | "expo" | "better-sqlite3" | "capacitor"
strstring

Returns#

string

Defined in#

system/core/backend/src/helpers/base-queries.ts:142