Core
Class: Core
Defined in: packages/core/src/core/core.ts:44
This is the main class of the framework, it handles the routing, the services initialization and resolution
Core
Implements
Constructors
Constructor
new Core(
application?):Core
Defined in: packages/core/src/core/core.ts:95
Create a new Core
Parameters
application?
the application instance
Returns
Core
Properties
application
protectedapplication:Application
Defined in: packages/core/src/core/core.ts:58
Application that generates this Core
applicationConfiguration
applicationConfiguration:
Configuration
Defined in: packages/core/src/core/core.ts:89
configurationService?
optionalconfigurationService?:string
Defined in: packages/core/src/core/core.ts:88
Configuration service name
dependencies
dependencies:
Record<string,Set<string>> ={}
Defined in: packages/core/src/core/core.ts:84
Dependencies for each service
initOrders
initOrders:
string[] =[]
Defined in: packages/core/src/core/core.ts:80
Order of services initialization
operations
protectedoperations:object={}
Defined in: packages/core/src/core/core.ts:76
Contains all operations defined by services
Index Signature
[key: string]: OperationDefinitionInfo
Methods
createService()
protectedcreateService(service):AbstractService<ServiceParameters, { }>
Defined in: packages/core/src/core/core.ts:482
Create a specific service
Parameters
service
string
the service instance
Returns
AbstractService<ServiceParameters, { }>
the result
getApiUrl()
getApiUrl(
subpath?):string
Defined in: packages/core/src/core/core.ts:255
Get absolute url with subpath
Parameters
subpath?
string = ""
the subpath to append
Returns
string
the result string
getBeans()
getBeans():
any
Defined in: packages/core/src/core/core.ts:531
Get application beans
Returns
any
the result
getBinaryStore()
getBinaryStore<
T>(modelOrConstructor,attribute):AbstractService
Defined in: packages/core/src/core/core.ts:190
Get the service that manage a model
Type Parameters
T
T extends Model
Parameters
modelOrConstructor
string | T | ModelClass<T>
the model or its constructor
attribute
string
the attribute name
Returns
the result
Implementation of
getBinaryStoreCached()
protectedgetBinaryStoreCached<T>(model,attribute):BinaryService
Defined in: packages/core/src/core/core.ts:204
Find the best matching BinaryService for a given model and attribute, with caching
Type Parameters
T
T extends Model
Parameters
model
string
the model to use
attribute
string
the attribute name
Returns
the result
getConfiguration()
getConfiguration():
Record<string,any>
Defined in: packages/core/src/core/core.ts:130
Get the configuration object
Returns
Record<string, any>
the result
getInstanceId()
getInstanceId():
string
Defined in: packages/core/src/core/core.ts:245
Return Core instance id
It is a random generated string
Returns
string
the result string
Implementation of
getLocales()
getLocales():
string[]
Defined in: packages/core/src/core/core.ts:374
To define the locales just add a locales: ['en-GB', 'fr-FR'] in your host global configuration
Returns
string[]
The configured locales or "en-GB" if none are defined
Implementation of
getModelStore()
getModelStore<
T>(modelOrConstructor):Store
Defined in: packages/core/src/core/core.ts:140
Get the store assigned to this model
Type Parameters
T
T extends Model
Parameters
modelOrConstructor
string | T | CustomConstructor<T>
the model or its constructor
Returns
the result
Implementation of
getService()
getService<
T>(name?):T
Defined in: packages/core/src/core/core.ts:387
Check for a service name and return the wanted singleton or undefined if none found
Type Parameters
T
T = AbstractService<ServiceParameters, { }>
Parameters
name?
string = ""
The service name to retrieve
Returns
T
the result
Implementation of
getServices()
getServices():
object
Defined in: packages/core/src/core/core.ts:404
Return a map of defined services
Returns
object
the map of services
Implementation of
getVersion()
getVersion():
string
Defined in: packages/core/src/core/core.ts:364
Return webda current version
Returns
string
package version
Since
0.4.0
init()
init():
Promise<void>
Defined in: packages/core/src/core/core.ts:350
Init Webda
It will resolve Services init method and autolink.
Delegates to resolve for service creation + resolve, then calls
init() on every remaining non-configuration service.
Returns
Promise<void>
initService()
protectedinitService(service):Promise<void>
Defined in: packages/core/src/core/core.ts:266
Init one service
Parameters
service
string
the service instance
Returns
Promise<void>
isDebug()
isDebug():
boolean
Defined in: packages/core/src/core/core.ts:411
Return if Webda is in debug mode
Returns
boolean
true if the condition is met
Implementation of
log()
log(
level, ...args):void
Defined in: packages/core/src/core/core.ts:420
Log a message
Parameters
level
WorkerLogLevel
the log level
args
...any[]
additional arguments
Returns
void
registerBeans()
registerBeans():
void
Defined in: packages/core/src/core/core.ts:504
Auto-register application beans as services if not already configured. Tests can disable by overriding getBeans() to return empty/undefined.
Returns
void
resolve()
resolve():
Promise<void>
Defined in: packages/core/src/core/core.ts:298
Resolve services and their dependencies WITHOUT calling service.init().
After this completes:
- All services declared in configuration are constructed.
- Each service's
resolve()has been called (via createService / bean registration). this.initOrdersis finalized (Store services first).- The configuration service (if any) has been fully initialized — it must run early so other services can read config during construction.
No non-configuration service.init() calls — no DB/network I/O is performed.
Build-time hooks (@BuildCommand) run after this phase.
Returns
Promise<void>
stop()
stop():
Promise<void>
Defined in: packages/core/src/core/core.ts:540
Stop all services
Returns
Promise<void>
Implementation of
toJSON()
toJSON():
object
Defined in: packages/core/src/core/core.ts:560
Allow serialization
Returns
object
the result
application
application:
Application
configuration
configuration:
Record<string,any>
updateConfiguration()
updateConfiguration(
updates):void
Defined in: packages/core/src/core/core.ts:428
Update the configuration with new values
Parameters
updates
any
the updates to apply
Returns
void
Implementation of
deserialize()
staticdeserialize(json):Core
Defined in: packages/core/src/core/core.ts:572
Deserialize a Core instance from a plain JSON object
Parameters
json
any
the JSON data
Returns
Core
the result