Module: backend
CromwellCMS Backend SDK
Exports backend helpers, ORM repositories and entities.
Install#
npm i @cromwell/core-backendUse#
Example of usage
import { ProductRepository } from '@cromwell/core-backend';import { getCustomRepository } from 'typeorm';
const products = await getCustomRepository(ProductRepository).getProducts();Table of contents#
Classes#
- Attribute
- AttributeInput
- AttributeInstance
- AttributeInstanceValue
- AttributeMeta
- AttributeRepository
- AttributeToProduct
- AttributeValue
- AttributeValueInput
- BaseEntityMeta
- BaseFilterInput
- BasePageEntity
- BasePageInput
- BasePageMeta
- BasePageMetaInput
- BaseRepository
- CmsEntity
- Coupon
- CouponInput
- CouponMeta
- CouponRepository
- CreatePost
- CreateProduct
- CreateProductCategory
- CreateUser
- CustomEntity
- CustomEntityFilterInput
- CustomEntityInput
- CustomEntityMeta
- CustomEntityRepository
- DeleteManyInput
- FilteredProduct
- GenericPluginResolver
- GenericThemeResolver
- InputTag
- JwtAuthGuard
- Order
- OrderFilterInput
- OrderInput
- OrderMeta
- OrderRepository
- PageStats
- PageStatsRepository
- PagedCoupon
- PagedCustomEntity
- PagedMeta
- PagedOrder
- PagedParamsInput
- PagedPost
- PagedProduct
- PagedProductCategory
- PagedProductReview
- PagedTag
- PagedUser
- PluginEntity
- PluginInput
- PluginRepository
- Post
- PostComment
- PostFilterInput
- PostMeta
- PostRepository
- Product
- ProductCategory
- ProductCategoryFilterInput
- ProductCategoryMeta
- ProductCategoryRepository
- ProductFilterAttributes
- ProductFilterInput
- ProductFilterMeta
- ProductMeta
- ProductRating
- ProductRepository
- ProductReview
- ProductReviewFilter
- ProductReviewInput
- ProductReviewRepository
- ProductVariant
- ProductVariantInput
- ProductVariantMeta
- ProductVariantRepository
- PropertySearch
- SortByOptions
- Tag
- TagMeta
- TagRepository
- ThemeEntity
- UpdatePost
- UpdateProduct
- UpdateProductCategory
- UpdateUser
- User
- UserFilterInput
- UserMeta
- UserRepository
Type aliases#
- Action
- ActionNames
- ActionTypes
- DeepWriteable
- TAllThemeConfigs
- TAuthSettings
- TAuthUserInfo
- TBackendModule
- TEntityMeta
- TGraphQLContext
- TPluginInfo
- TRequestWithUser
- TTokenInfo
- TTokenPayload
- Writeable
Variables#
- CustomDateScalar
- GenericCms
- GenericPlugin
- GenericTheme
- ORMEntities
- PrimitiveValueScalar
- adminPanelMessages
- bcryptSaltRounds
- buildDirName
- cmsConfigFileName
- cmsName
- cmsPackageName
- configFileName
- defaultCmsConfig
- entityMetaRepository
- pluginAdminBundlePath
- pluginAdminCjsPath
- pluginFrontendBundlePath
- pluginFrontendCjsPath
- rendererMessages
- serverMessages
- tempDirName
Functions#
- Roles
- applyBaseFilter
- applyGetManyFromOne
- applyGetPaged
- checkEntitySlug
- collectPlugins
- connectDatabase
- createGenericEntity
- findPlugin
- findTheme
- fireAction
- getAdminPanelDir
- getAdminPanelServiceBuildDir
- getAdminPanelStartupPath
- getAdminPanelStaticDir
- getAdminPanelTempDir
- getAdminPanelWebPublicDir
- getAdminPanelWebServiceBuildDir
- getAuthSettings
- getBundledModulesDir
- getCmsConfigPath
- getCmsConfigPathSync
- getCmsEntity
- getCmsInfo
- getCmsModuleConfig
- getCmsModuleInfo
- getCmsSettings
- getCoreBackendDir
- getCoreCommonDir
- getCoreFrontendDir
- getEmailTemplate
- getErrorLogPath
- getLogger
- getLogsDir
- getManagerDir
- getManagerTempDir
- getMetaInfoPath
- getMigrationsDirName
- getModulePackage
- getModuleStaticDir
- getNodeModuleDir
- getNodeModuleDirSync
- getPaged
- getPluginAdminBundlePath
- getPluginAdminCjsPath
- getPluginBackendPath
- getPluginFrontendBundlePath
- getPluginFrontendCjsPath
- getPluginFrontendMetaPath
- getPluginSettings
- getPublicDir
- getPublicPluginsDir
- getPublicThemesDir
- getRendererBuildDir
- getRendererDir
- getRendererStartupPath
- getRendererTempDevDir
- getRendererTempDir
- getServerBuildDir
- getServerBuildMonitorPath
- getServerBuildPath
- getServerBuildProxyPath
- getServerCachePath
- getServerDefaultEmailsDir
- getServerDir
- getServerStartupPath
- getServerTempDir
- getServerTempEmailsDir
- getSqlBoolStr
- getSqlLike
- getTempDir
- getThemeAdminPanelDir
- getThemeBuildDir
- getThemeConfigs
- getThemeNextBuildDir
- getThemeNextBuildDirByPath
- getThemePagesMetaPath
- getThemePagesVirtualPath
- getThemeRollupBuildDir
- getThemeRollupBuildDirByPath
- getThemeTempAdminPanelDir
- getThemeTempRollupBuildDir
- getUtilsBuildDir
- getUtilsDir
- getUtilsImporterPath
- getUtilsTempDir
- graphQlAuthChecker
- handleBaseInput
- handleCustomMetaInput
- isExternalForm
- isSimpleString
- readCMSConfig
- readCMSConfigSync
- readCmsModules
- readPackage
- readPluginsExports
- registerAction
- resolvePackageJsonPath
- runShellCommand
- savePlugin
- savePluginSettings
- sendEmail
- validateEmail
- wrapInQuotes
Type aliases#
Action#
Ƭ Action<PayloadType, OutputType>: Object
Type parameters#
| Name | Type |
|---|---|
PayloadType | PayloadType |
OutputType | any |
Type declaration#
| Name | Type |
|---|---|
output | OutputType |
payload | PayloadType |
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#
| Name | Type |
|---|---|
create_attribute | Action<TAttribute> |
create_coupon | Action<TCoupon> |
create_custom_entity | Action<TCustomEntity> |
create_order | Action<TOrder> |
create_payment | Action<TOrderPaymentSession, Object> |
create_post | Action<TPost> |
create_post_comment | Action<TPostComment> |
create_product | Action<TProduct> |
create_product_category | Action<TProductCategory> |
create_product_review | Action<TProductReview> |
create_tag | Action<TTag> |
create_user | Action<TUser> |
delete_attribute | Action<Object> |
delete_coupon | Action<Object> |
delete_custom_entity | Action<Object> |
delete_order | Action<Object> |
delete_post | Action<Object> |
delete_post_comment | Action<Object> |
delete_product | Action<Object> |
delete_product_category | Action<Object> |
delete_product_review | Action<Object> |
delete_tag | Action<Object> |
delete_user | Action<Object> |
install_plugin | Action<Object> |
install_theme | Action<Object> |
uninstall_plugin | Action<Object> |
uninstall_theme | Action<Object> |
update_attribute | Action<TAttribute> |
update_coupon | Action<TCoupon> |
update_custom_entity | Action<TCustomEntity> |
update_order | Action<TOrder> |
update_plugin | Action<Object> |
update_post | Action<TPost> |
update_post_comment | Action<TPostComment> |
update_product | Action<TProduct> |
update_product_category | Action<TProductCategory> |
update_product_review | Action<TProductReview> |
update_settings | Action<TCmsSettings> |
update_tag | Action<TTag> |
update_theme | Action<Object> |
update_user | Action<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#
| Name | Type |
|---|---|
themeConfig | TThemeConfig | null |
themeInfo | TPackageCromwellConfig | null |
userConfig | TThemeConfig | null |
Defined in#
system/core/backend/src/helpers/theme-config.ts:18
TAuthSettings#
Ƭ TAuthSettings: Object
Type declaration#
| Name | Type |
|---|---|
accessSecret | string |
accessTokenCookieName | string |
cookieSecret | string |
expirationAccessTime | number |
expirationRefreshTime | number |
maxTokensPerUser | number |
refreshSecret | string |
refreshTokenCookieName | string |
resetPasswordAttempts | number |
resetPasswordCodeExpirationAccessTime | number |
serviceSecret | string |
Defined in#
system/core/backend/src/helpers/auth-settings.ts:8
TAuthUserInfo#
Ƭ TAuthUserInfo: Object
Type declaration#
| Name | Type |
|---|---|
email? | string | null |
id | number |
role | TUserRole |
Defined in#
system/core/backend/src/helpers/auth-guards.ts:7
TBackendModule#
Ƭ TBackendModule: Object
Type declaration#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
entityId? | number |
id | number |
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#
| Name | Type |
|---|---|
user? | TAuthUserInfo |
Defined in#
system/core/backend/src/helpers/auth-guards.ts:30
TPluginInfo#
Ƭ TPluginInfo: Object
Type declaration#
| Name | Type |
|---|---|
adminPanelPath? | string |
backendPath? | string |
frontendPath? | string |
pluginDir | string |
pluginName | string |
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#
| Name | Type |
|---|---|
cookie | string |
maxAge | string |
token | string |
Defined in#
system/core/backend/src/helpers/auth-guards.ts:24
TTokenPayload#
Ƭ TTokenPayload: Object
Type declaration#
| Name | Type |
|---|---|
role | TUserRole |
sub | number |
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#
| Name | Type |
|---|---|
abstractResolver | any |
createArgs | any |
pagedEntity | any |
repository | ObjectType<BaseRepository<CmsEntity, CmsEntity>> |
updateArgs | any |
Defined in#
system/core/backend/src/helpers/generic-entities.ts:12
GenericPlugin#
• Const GenericPlugin: Object
Type declaration#
| Name | Type |
|---|---|
abstractResolver | any |
createArgs | any |
pagedEntity | any |
repository | ObjectType<BaseRepository<PluginEntity, TPluginEntityInput>> |
updateArgs | any |
Defined in#
system/core/backend/src/helpers/generic-entities.ts:11
GenericTheme#
• Const GenericTheme: Object
Type declaration#
| Name | Type |
|---|---|
abstractResolver | any |
createArgs | any |
pagedEntity | any |
repository | ObjectType<BaseRepository<ThemeEntity, TThemeEntityInput>> |
updateArgs | any |
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#
| Name | Type |
|---|---|
onBuildEndMessage | string |
onBuildErrorMessage | string |
onBuildStartMessage | string |
onStartErrorMessage | string |
onStartMessage | string |
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#
| Name | Type |
|---|---|
onBuildEndMessage | string |
onBuildErrorMessage | string |
onBuildStartMessage | string |
onStartErrorMessage | string |
onStartMessage | string |
Defined in#
system/core/backend/src/helpers/constants.ts:46
serverMessages#
• Const serverMessages: Object
Type declaration#
| Name | Type |
|---|---|
onBuildEndMessage | string |
onBuildErrorMessage | string |
onBuildStartMessage | string |
onStartErrorMessage | string |
onStartMessage | string |
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#
| Name | Type |
|---|---|
...roles | TAuthRole[] |
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#
| Name | Type |
|---|---|
__namedParameters | Object |
__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.filter | BaseFilterInput |
__namedParameters.qb | SelectQueryBuilder<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#
| Name | Type |
|---|---|
qb | SelectQueryBuilder<T> |
firstEntityName | string |
firstEntityProp | keyof T |
secondEntityName | string |
secondEntityId | number |
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#
| Name | Type |
|---|---|
qb | SelectQueryBuilder<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#
| Name | Type |
|---|---|
T | extends BasePageEntity<T> |
Parameters#
| Name | Type |
|---|---|
entity | T |
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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
__namedParameters | Object |
__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#
| Name | Type |
|---|---|
EntityType | EntityType |
EntityInputType | EntityType |
Parameters#
| Name | Type |
|---|---|
entityName | string |
EntityClass | (...args: any[]) => EntityType |
InputEntityClass? | (...args: any[]) => EntityInputType |
Returns#
Object
| Name | Type |
|---|---|
abstractResolver | any |
createArgs | any |
pagedEntity | any |
repository | ObjectType<BaseRepository<EntityType, EntityInputType>> |
updateArgs | any |
Defined in#
system/core/backend/src/helpers/create-generic-entity.ts:10
findPlugin#
â–¸ Const findPlugin(pluginName): Promise<undefined | TPluginEntity>
Parameters#
| Name | Type |
|---|---|
pluginName | string |
Returns#
Promise<undefined | TPluginEntity>
Defined in#
system/core/backend/src/helpers/plugin-settings.ts:8
findTheme#
â–¸ Const findTheme(themeName): Promise<undefined | TThemeEntity>
Parameters#
| Name | Type |
|---|---|
themeName | string |
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#
| Name | Type |
|---|---|
T | extends keyof ActionTypes |
TPayload | ActionTypes[T][``"payload"``] |
TOutput | ActionTypes[T][``"output"``] |
Parameters#
| Name | Type |
|---|---|
options | Object |
options.actionName | string | 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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
dir? | string |
Returns#
Promise<any>
Defined in#
system/core/backend/src/helpers/paths.ts:44
getCmsConfigPathSync#
â–¸ Const getCmsConfigPathSync(dir?): any
Parameters#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
moduleName? | string |
Returns#
Promise<undefined | TModuleConfig>
Defined in#
system/core/backend/src/helpers/paths.ts:209
getCmsModuleInfo#
â–¸ Const getCmsModuleInfo(moduleName?): Promise<undefined | TPackageCromwellConfig>
Parameters#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
fileName | string |
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#
| Name | Type | Default value |
|---|---|---|
writeToFile | boolean | true |
Returns#
Object
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
filename | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:236
getMigrationsDirName#
â–¸ Const getMigrationsDirName(dbType): undefined | "migrations/sqlite" | "migrations/mysql" | "migrations/postgres"
Parameters#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
moduleName? | string |
Returns#
Promise<undefined | TPackageJson>
Defined in#
system/core/backend/src/helpers/paths.ts:262
getModuleStaticDir#
â–¸ Const getModuleStaticDir(moduleName): Promise<undefined | string>
Parameters#
| Name | Type |
|---|---|
moduleName | string |
Returns#
Promise<undefined | string>
Defined in#
system/core/backend/src/helpers/paths.ts:229
getNodeModuleDir#
â–¸ Const getNodeModuleDir(moduleName): Promise<undefined | string>
Parameters#
| Name | Type |
|---|---|
moduleName | string |
Returns#
Promise<undefined | string>
Defined in#
system/core/backend/src/helpers/paths.ts:31
getNodeModuleDirSync#
â–¸ Const getNodeModuleDirSync(moduleName): undefined | string
Parameters#
| Name | Type |
|---|---|
moduleName | string |
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#
| Name | Type |
|---|---|
qb | SelectQueryBuilder<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#
| Name | Type |
|---|---|
distDir | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:245
getPluginAdminCjsPath#
â–¸ Const getPluginAdminCjsPath(distDir): string
Parameters#
| Name | Type |
|---|---|
distDir | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:246
getPluginBackendPath#
â–¸ Const getPluginBackendPath(distDir): string
Parameters#
| Name | Type |
|---|---|
distDir | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:247
getPluginFrontendBundlePath#
â–¸ Const getPluginFrontendBundlePath(distDir): string
Parameters#
| Name | Type |
|---|---|
distDir | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:242
getPluginFrontendCjsPath#
â–¸ Const getPluginFrontendCjsPath(distDir): string
Parameters#
| Name | Type |
|---|---|
distDir | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:243
getPluginFrontendMetaPath#
â–¸ Const getPluginFrontendMetaPath(distDir): string
Parameters#
| Name | Type |
|---|---|
distDir | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:244
getPluginSettings#
â–¸ Const getPluginSettings(pluginName): Promise<any>
Parameters#
| Name | Type |
|---|---|
pluginName | string |
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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
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" |
b | boolean |
Returns#
"true" | "false" | "1" | "0"
Defined in#
system/core/backend/src/helpers/base-queries.ts:130
getSqlLike#
â–¸ Const getSqlLike(dbType): "ILIKE" | "LIKE"
Parameters#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
dir? | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:14
getThemeAdminPanelDir#
â–¸ Const getThemeAdminPanelDir(themeModuleName): Promise<undefined | string>
Parameters#
| Name | Type |
|---|---|
themeModuleName | string |
Returns#
Promise<undefined | string>
Defined in#
system/core/backend/src/helpers/paths.ts:202
getThemeBuildDir#
â–¸ Const getThemeBuildDir(themeModuleName): Promise<undefined | string>
Parameters#
| Name | Type |
|---|---|
themeModuleName | string |
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#
| Name | Type | Description |
|---|---|---|
themeName | string | specify 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#
| Name | Type |
|---|---|
themeModuleName | string |
Returns#
Promise<undefined | string>
Defined in#
system/core/backend/src/helpers/paths.ts:189
getThemeNextBuildDirByPath#
â–¸ Const getThemeNextBuildDirByPath(themeDir): string
Parameters#
| Name | Type |
|---|---|
themeDir | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:195
getThemePagesMetaPath#
â–¸ Const getThemePagesMetaPath(distDir): string
Parameters#
| Name | Type |
|---|---|
distDir | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:248
getThemePagesVirtualPath#
â–¸ Const getThemePagesVirtualPath(distDir): string
Parameters#
| Name | Type |
|---|---|
distDir | string |
Returns#
string
Defined in#
system/core/backend/src/helpers/paths.ts:249
getThemeRollupBuildDir#
â–¸ Const getThemeRollupBuildDir(themeModuleName): Promise<undefined | string>
Parameters#
| Name | Type |
|---|---|
themeModuleName | string |
Returns#
Promise<undefined | string>
Defined in#
system/core/backend/src/helpers/paths.ts:179
getThemeRollupBuildDirByPath#
â–¸ Const getThemeRollupBuildDirByPath(themeDir): string
Parameters#
| Name | Type |
|---|---|
themeDir | string |
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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
entity | BasePageEntity |
input | TBasePageEntityInput |
Returns#
Promise<void>
Defined in#
system/core/backend/src/helpers/base-queries.ts:62
handleCustomMetaInput#
â–¸ Const handleCustomMetaInput<T>(entity, input): Promise<void>
Type parameters#
| Name | Type |
|---|---|
T | extends Object |
Parameters#
| Name | Type |
|---|---|
entity | BasePageEntity |
input | T |
Returns#
Promise<void>
Defined in#
system/core/backend/src/helpers/base-queries.ts:77
isExternalForm#
â–¸ Const isExternalForm(id): boolean
Parameters#
| Name | Type |
|---|---|
id | any |
Returns#
boolean
Defined in#
system/core/backend/src/helpers/paths.ts:250
isSimpleString#
â–¸ Const isSimpleString(str): undefined | boolean | ""
Parameters#
| Name | Type |
|---|---|
str | undefined | 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#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
path? | string |
Returns#
TCmsConfig
Defined in#
system/core/backend/src/helpers/cms-settings.ts:21
readCmsModules#
â–¸ Const readCmsModules(dir?): Promise<Object>
Parameters#
| Name | Type |
|---|---|
dir? | string |
Returns#
Promise<Object>
Defined in#
system/core/backend/src/helpers/cms-modules.ts:7
readPackage#
â–¸ Const readPackage(path): Promise<any>
Parameters#
| Name | Type |
|---|---|
path | string |
Returns#
Promise<any>
Defined in#
system/core/backend/src/helpers/paths.ts:257
readPluginsExports#
â–¸ Const readPluginsExports(options?): Promise<TPluginInfo[]>
Parameters#
| Name | Type |
|---|---|
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#
| Name | Type |
|---|---|
T | extends keyof ActionTypeskeyof ActionTypes |
TPayload | ActionTypes[T][``"payload"``] |
TOutput | ActionTypes[T][``"output"``] |
Parameters#
| Name | Type |
|---|---|
options | Object |
options.actionName | T |
options.pluginName | string |
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#
| Name | Type |
|---|---|
moduleName | string |
Returns#
undefined | string
Defined in#
system/core/backend/src/helpers/paths.ts:16
runShellCommand#
â–¸ Const runShellCommand(command, cwd?): Promise<void>
Parameters#
| Name | Type |
|---|---|
command | string |
cwd? | string |
Returns#
Promise<void>
Defined in#
system/core/backend/src/helpers/shell.ts:7
savePlugin#
â–¸ Const savePlugin(plugin): Promise<TPluginEntity>
Parameters#
| Name | Type |
|---|---|
plugin | TPluginEntity |
Returns#
Promise<TPluginEntity>
Defined in#
system/core/backend/src/helpers/plugin-settings.ts:21
savePluginSettings#
â–¸ Const savePluginSettings(pluginName, input): Promise<boolean>
Parameters#
| Name | Type |
|---|---|
pluginName | string |
input | any |
Returns#
Promise<boolean>
Defined in#
system/core/backend/src/helpers/plugin-settings.ts:50
sendEmail#
â–¸ Const sendEmail(addresses, subject, htmlContent): Promise<boolean>
Parameters#
| Name | Type |
|---|---|
addresses | string[] |
subject | string |
htmlContent | string |
Returns#
Promise<boolean>
Defined in#
system/core/backend/src/helpers/emailing.ts:34
validateEmail#
â–¸ Const validateEmail(email): boolean
Parameters#
| Name | Type |
|---|---|
email | any |
Returns#
boolean
Defined in#
system/core/backend/src/helpers/validation.ts:1
wrapInQuotes#
â–¸ Const wrapInQuotes(dbType, str): string
Parameters#
| Name | Type |
|---|---|
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" |
str | string |
Returns#
string