Skip to main content

IAdminForth

Properties

activatedPlugins

activatedPlugins: IAdminForthPlugin[]


auth

auth: IAdminForthAuth


codeInjector

codeInjector: ICodeInjector


config

config: AdminForthConfig


connectors

connectors: object

Index signature

[key: string]: IAdminForthDataSourceConnectorBase


express

express: IHttpServer


restApi

restApi: IAdminForthRestAPI


runningHotReload

runningHotReload: boolean

Internal flag which indicates if AdminForth is running in hot reload mode.


statuses

statuses: object

dbDiscover

dbDiscover: "running" | "done"


websocket

websocket: IWebSocketBroker

Methods

bundleNow()

bundleNow(__namedParameters): Promise<void>

Bundles AdminForth SPA by injecting custom components into internal pre-made SPA source code. It generates internally dist which then will be served by AdminForth HTTP adapter. Bundle is generated in /tmp folder so if you have ramfs or tmpfs this operation will be faster.

We recommend calling this method from dedicated script which will be run by CI/CD pipeline in build time. This ensures lowest downtime for your users. However for simple setup you can call it from your main script, and users will see some "AdminForth is bundling" message in the admin panel while app is bundling.

Parameters

ParameterType
__namedParametersobject
__namedParameters.hotReloadboolean
__namedParameters.verboseboolean

Returns

Promise<void>


createResourceRecord()

createResourceRecord(params): Promise<object>

Parameters

ParameterType
paramsobject
params.adminUserAdminUser
params.extra?HttpExtra
params.recordany
params.resourceAdminForthResource

Returns

Promise<object>

createdRecord?

optional createdRecord: any

error?

optional error: string


deleteResourceRecord()

deleteResourceRecord(params): Promise<object>

Parameters

ParameterType
paramsobject
params.adminUserAdminUser
params.extra?HttpExtra
params.recordany
params.recordIdstring
params.resourceAdminForthResource

Returns

Promise<object>

error?

optional error: string


discoverDatabases()

discoverDatabases(): Promise<void>

Connects to databases defined in datasources and fetches described resource columns to find out data types and constraints. You must call this method as soon as possible after AdminForth class is instantiated.

Returns

Promise<void>


resource()

resource(resourceId): IOperationalResource

Resource to get access to operational resources for data api fetching and manipulation.

Parameters

ParameterType
resourceIdstring

Returns

IOperationalResource


setupEndpoints()

setupEndpoints(server): void

This method will be automatically called from AdminForth HTTP adapter to serve AdminForth SPA.

Parameters

ParameterType
serverIHttpServer

Returns

void


updateResourceRecord()

updateResourceRecord(params): Promise<object>

Parameters

ParameterType
paramsobject
params.adminUserAdminUser
params.extra?HttpExtra
params.oldRecordany
params.recordany
params.recordIdany
params.resourceAdminForthResource

Returns

Promise<object>

error?

optional error: string