UnpackedApplication
Class: UnpackedApplication
An unpacked application load dynamically all webda.module.json And load also all the package description
The normal Application is designed to load all this information from the cachedModule to avoid any unecessary action within a production environment
Extends
Constructors
new UnpackedApplication(file, logger)
new UnpackedApplication(
file,logger?):UnpackedApplication
Parameters
• file: string
• logger?: WorkerOutput
Returns
Overrides
Source
packages/core/src/unpackedapplication.ts:36
Properties
_loaded
protected_loaded:string[] =[]
Contains already loaded modules
Inherited from
Source
packages/core/src/application.ts:473
appModule
protectedappModule:Module
Contains definitions of current application
Inherited from
Source
packages/core/src/application.ts:457
appPath
readonlyappPath:string
Get Application root path
Inherited from
Source
packages/core/src/application.ts:444
baseConfiguration
protectedbaseConfiguration:Configuration
Base configuration loaded from webda.config.json
Inherited from
Source
packages/core/src/application.ts:448
configurationFile
readonlyconfigurationFile:string
Configuration file
Inherited from
Source
packages/core/src/application.ts:523
currentDeployment
protectedcurrentDeployment:string
Current deployment
Inherited from
Source
packages/core/src/application.ts:452
deployers
protecteddeployers:Object={}
Deployers type registry
Index signature
[key: string]: any
Inherited from
Source
packages/core/src/application.ts:478
deploymentFile
deploymentFile:
string
Current deployment file
Inherited from
Source
packages/core/src/application.ts:527
flatHierarchy
protectedflatHierarchy:Object={}
Direct parent of a model
Index signature
[key: string]: string
Inherited from
Source
packages/core/src/application.ts:518
graph
protectedgraph:ModelsGraph={}
Models graph
Inherited from
Source
packages/core/src/application.ts:493
initTime
protectedinitTime:number
When the application got initiated
Inherited from
Source
packages/core/src/application.ts:513
logger
protectedlogger:WorkerOutput
Class Logger
Inherited from
Source
packages/core/src/application.ts:503
moddas
protectedmoddas:Object={}
Moddas registry
Index signature
[key: string]: Modda
Inherited from
Source
packages/core/src/application.ts:483
models
protectedmodels:Object={}
Models type registry
Index signature
[key: string]: CoreModelDefinition
Inherited from
Source
packages/core/src/application.ts:488
plurals
protectedplurals:Object={}
Models specific plurals
Index signature
[key: string]: string
Inherited from
Source
packages/core/src/application.ts:498
workspacesPath
protectedworkspacesPath:string=""
Detect if running as workspace
Inherited from
Source
packages/core/src/application.ts:508
active
staticprotectedactive:Application
Current application
Inherited from
Source
packages/core/src/application.ts:532
Methods
addDeployer()
addDeployer(
name,model):this
Add a new deployer
Parameters
• name: string
• model: any
Returns
this
Inherited from
Source
packages/core/src/application.ts:990
addModel()
addModel(
name,model,dynamic):this
Add a new model
Parameters
• name: string
• model: any
• dynamic: boolean= true
Returns
this
Inherited from
Source
packages/core/src/application.ts:969
addService()
addService(
name,service):this
Add a new service
Parameters
• name: string
• service: Modda
Returns
this
Inherited from
Source
packages/core/src/application.ts:737
completeConfiguration()
completeConfiguration(
configuration):Configuration
Add Moddas, Models and Deployers definitions It also add the project metadata
Parameters
• configuration: Configuration
Returns
Source
packages/core/src/unpackedapplication.ts:91
completeNamespace()
completeNamespace(
name):string
Return the full name including namespace
In Webda the ServiceType include namespace Webda/Store or Webda/Test
This method will make sure the namespace is present, adding it if no '/'
is found in the name
Parameters
• name: string= ""
Returns
string
Inherited from
Source
packages/core/src/application.ts:1234
filterModule()
filterModule(
_filename):boolean
Only allow local and core module and sample-app
Parameters
• _filename: string
Returns
boolean
Source
packages/core/src/unpackedapplication.ts:290
findModules()
findModules(
module):string[]
Load all imported modules and current module It will compile module Generate the current module file Load any imported webda.module.json
Parameters
• module: CachedModule
Returns
string[]
Source
packages/core/src/unpackedapplication.ts:259
getAppPath()
getAppPath(
subpath):string
Return the current app path
Parameters
• subpath: string= undefined
to append to
Returns
string
Inherited from
Source
packages/core/src/application.ts:721
getBeans()
getBeans():
Object
Return all beans of the application
Returns
Object
Inherited from
Source
packages/core/src/application.ts:836
getConfiguration()
getConfiguration(
_deployment):Configuration
Get application configuration
Parameters
• _deployment: string= undefined
Returns
Inherited from
Source
packages/core/src/application.ts:1128
getCurrentConfiguration()
getCurrentConfiguration():
Configuration
Return current Configuration of the Application
Same as calling
getConfiguration(this.currentDeployment);
Returns
Inherited from
Application.getCurrentConfiguration
Source
packages/core/src/application.ts:1141
getCurrentDeployment()
getCurrentDeployment():
string
Get current deployment name
Returns
string
Inherited from
Application.getCurrentDeployment
Source
packages/core/src/application.ts:1110
getDeployers()
getDeployers():
Object
Return all deployers
Returns
Object
Inherited from
Source
packages/core/src/application.ts:959
getFullNameFromPrototype()
getFullNameFromPrototype(
proto):string
Parameters
• proto: any
Prototype to send
Returns
string
Inherited from
Application.getFullNameFromPrototype
Source
packages/core/src/application.ts:605
getGitInformation()
getGitInformation(
_name?,_version?):GitInformation
Parameters
• _name?: string
• _version?: string
Returns
empty git information
Overrides
Source
packages/core/src/unpackedapplication.ts:133
getGraph()
getGraph():
ModelsGraph
Get the all graph
Returns
Inherited from
Source
packages/core/src/application.ts:663
getModda()
getModda(
name):Modda
Get a service based on name
Parameters
• name: any
Returns
Inherited from
Source
packages/core/src/application.ts:822
getModdas()
getModdas():
Object
Return all services of the application
Returns
Object
Inherited from
Source
packages/core/src/application.ts:829
getModel()
getModel<
T>(name):CoreModelDefinition<T>
Retrieve the model implementation
Type parameters
• T extends CoreModel = CoreModel
Parameters
• name: string
model to retrieve
Returns
Inherited from
Source
packages/core/src/application.ts:845
getModelFromConstructor()
getModelFromConstructor(
model):string
Return the model name for a object
Parameters
• model: Constructor<CoreModel>
Returns
string
Inherited from
Application.getModelFromConstructor
Source
packages/core/src/application.ts:893
getModelFromInstance()
getModelFromInstance(
object):string
Return the model name for a object
Parameters
• object: CoreModel
Returns
string
Inherited from
Application.getModelFromInstance
Source
packages/core/src/application.ts:885
getModelHierarchy()
getModelHierarchy(
model):Object
Get the model hierarchy
Parameters
• model: string | CoreModel | Constructor<CoreModel>
Returns
Object
ancestors
ancestors:
string[]children
children:
ModelsTree
Inherited from
Source
packages/core/src/application.ts:918
getModelName()
getModelName(
model):string
Get the model name from a model or a constructor
Parameters
• model: CoreModel | Constructor<CoreModel>
Returns
string
longId for a model
Inherited from
Source
packages/core/src/application.ts:903
getModelPlural()
getModelPlural(
name):string
Get plural of an Id
Parameters
• name: string
Returns
string
Inherited from
Source
packages/core/src/application.ts:760
getModelTypes()
getModelTypes(
model):string[]
Get all model types with the hierarchy
Parameters
• model: CoreModel
Returns
string[]
Inherited from
Source
packages/core/src/application.ts:948
getModels()
getModels():
Object
Get all models definitions
Returns
Object
Inherited from
Source
packages/core/src/application.ts:852
getModules()
getModules():
CachedModule
Return all application modules merged as one
Used when deployed
Returns
Inherited from
Source
packages/core/src/application.ts:1120
getModulesCache()
getModulesCache():
any
Store the current module
Returns
any
Source
packages/core/src/unpackedapplication.ts:198
getNamespace()
getNamespace():
string
Return current namespace
Returns
string
Inherited from
Source
packages/core/src/application.ts:1250
getPackageDescription()
getPackageDescription():
PackageDescriptor
Retrieve content of package.json
Returns
Inherited from
Application.getPackageDescription
Source
packages/core/src/application.ts:693
getPackageWebda()
getPackageWebda():
WebdaPackageDescriptor
Retrieve specific webda conf from package.json
In case of workspaces the object is combined
Returns
Inherited from
Source
packages/core/src/application.ts:683
getRelations()
getRelations(
model):ModelGraph
Get model graph
Parameters
• model: string | CoreModel | Constructor<CoreModel>
Returns
Inherited from
Source
packages/core/src/application.ts:652
getRootExposedModels()
getRootExposedModels():
string[]
Return models that do not have parents and are exposed Or specifically set as root via the Expose.root parameter
Returns
string[]
Inherited from
Application.getRootExposedModels
Source
packages/core/src/application.ts:871
getRootModels()
getRootModels():
string[]
Return models that do not have parents
Returns
string[]
Inherited from
Source
packages/core/src/application.ts:862
getSchema()
getSchema(
type):JSONSchema7
Get a schema from a type
Schema should be precomputed in the default app
Parameters
• type: string
Returns
JSONSchema7
Inherited from
Source
packages/core/src/application.ts:628
getSchemas()
getSchemas():
Object
Get schemas
Returns
Object
Inherited from
Source
packages/core/src/application.ts:636
getShortId()
getShortId(
name):string
Get short id for a name
Parameters
• name: string
if name is shortId return longId else return shortId
Returns
string
Inherited from
Source
packages/core/src/application.ts:1259
getWebdaObject()
getWebdaObject(
section,name,caseSensitive):any
Parameters
• section: Section
• name: string
• caseSensitive: boolean= false
Returns
any
Inherited from
Source
packages/core/src/application.ts:794
getWebdaVersion()
getWebdaVersion():
string
Return webda current version
Returns
string
package version
Inherited from
Since
0.4.0
Source
packages/core/src/application.ts:1002
getWorkerOutput()
getWorkerOutput():
WorkerOutput
Get current logger
Returns
WorkerOutput
Inherited from
Source
packages/core/src/application.ts:712
hasSchema()
hasSchema(
type):boolean
Check if a schema exists
Parameters
• type: string
Returns
boolean
schema name if it exists
Inherited from
Source
packages/core/src/application.ts:645
hasWebdaObject()
hasWebdaObject(
section,name,caseSensitive):boolean
Parameters
• section: Section
• name: string
• caseSensitive: boolean= false
Returns
boolean
Inherited from
Source
packages/core/src/application.ts:771
importFile()
importFile(
info,withExport):Promise<any>
Import a file
If the default is set take this or use old format
Parameters
• info: string
• withExport: boolean= true
Returns
Promise<any>
Inherited from
Source
packages/core/src/application.ts:1152
isCached()
isCached():
boolean
Check if application has cached modules
When deployed the application contains cachedModules in the webda.config.json
It allows to avoid the search for webda.module.json inside node_modules and
take the schema from the cached modules also
Returns
boolean
Inherited from
Source
packages/core/src/application.ts:674
load()
load():
Promise<UnpackedApplication>
Compute short ids
Returns
Promise<UnpackedApplication>
Overrides
Source
packages/core/src/unpackedapplication.ts:60
loadConfiguration()
loadConfiguration(
file):void
Load full configuration
webda.config.json and complete the cachedModule
Parameters
• file: string
Returns
void
Overrides
Source
packages/core/src/unpackedapplication.ts:48
loadLocalModule()
loadLocalModule():
Promise<void>
Load local module
Returns
Promise<void>
Inherited from
Source
packages/core/src/application.ts:1179
loadProjectInformation()
loadProjectInformation():
ProjectInformation
Check package.json
Returns
Source
packages/core/src/unpackedapplication.ts:147
loadWebdaModule()
loadWebdaModule(
moduleFile):CachedModule
Load a webda.module.json file Resolve the linked file to current application
Parameters
• moduleFile: string
to load
Returns
Source
packages/core/src/unpackedapplication.ts:301
log()
log(
level, ...args):void
Log information
Parameters
• level: WorkerLogLevel
to log for
• ...args: any[]
anything to display same as console.log
Returns
void
Inherited from
Source
packages/core/src/application.ts:703
mergeModules()
mergeModules(
configuration):void
Merge all modules into one cached module
Parameters
• configuration: Configuration
Returns
void
Source
packages/core/src/unpackedapplication.ts:333
registerSchema()
registerSchema(
name,schema):void
Register a new schema in the application
Parameters
• name: string
• schema: JSONSchema7
Returns
void
Inherited from
Source
packages/core/src/application.ts:748
replaceVariables()
replaceVariables(
object,replacements):any
Allow variable inside object strings
Example
replaceVariables({
myobj: "${test.replace}"
}, {
test: {
replace: 'plop'
}
})
will return
{
myobj: 'plop'
}
By default the replacements map contains
{
git: GitInformation,
package: 'package.json content',
deployment: string,
now: number,
...replacements
}
See: GitInformation
Parameters
• object: any
a duplicated object with replacement done
• replacements: any= {}
additional replacements to run
Returns
any
Inherited from
Source
packages/core/src/application.ts:1092
stringParameter()
protectedstringParameter(templateString,replacements):any
Allow variable inside of string
Parameters
• templateString: string
to copy
• replacements: any= {}
additional replacements to run
Returns
any
Inherited from
Source
packages/core/src/application.ts:1022
findModulesFiles()
staticfindModulesFiles(path):string[]
Search the node_modules structure for webda.module.json files
Parameters
• path: string
Returns
string[]