UnpackedApplication
Class: UnpackedApplication
Defined in: packages/core/src/application/unpackedapplication.ts:37
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
Constructor
new UnpackedApplication(
file,logger?):UnpackedApplication
Defined in: packages/core/src/application/unpackedapplication.ts:42
Create a new UnpackedApplication
Parameters
file
string | Partial<UnpackedConfiguration>
file path or partial configuration
logger?
WorkerOutput
the logger instance
Returns
UnpackedApplication
Overrides
Properties
applicationPath
readonlyapplicationPath:string
Defined in: packages/core/src/application/application.ts:112
Get Application root path
Inherited from
appModule
protectedappModule:WebdaModule
Defined in: packages/core/src/application/application.ts:131
Contains definitions of current application
Inherited from
baseConfiguration
protectedbaseConfiguration:Configuration
Defined in: packages/core/src/application/application.ts:116
Base configuration loaded from webda.config.json
Inherited from
beans
protectedbeans:object={}
Defined in: packages/core/src/application/application.ts:155
Beans registry
Index Signature
[key: string]: Modda
Inherited from
behaviors
protectedbehaviors:object={}
Defined in: packages/core/src/application/application.ts:170
Behaviors registry
Populated by loadModule from the top-level behaviors map of every
loaded webda.module.json. Each entry holds the metadata blob emitted by
the compiler so downstream consumers (DomainService, REST transport, etc.)
can introspect the Behavior's declared actions and shape.
The Behavior class itself is NOT loaded at runtime: the per-model
__hydrateBehaviors method emitted at compile time by
@webda/content-mapper holds a static import to the class, so the runtime
never needs to look it up by identifier.
Index Signature
[key: string]: object
Inherited from
configurationFile
readonlyconfigurationFile:string
Defined in: packages/core/src/application/application.ts:185
Configuration file
Inherited from
currentDeployment
protectedcurrentDeployment:string
Defined in: packages/core/src/application/application.ts:122
Current deployment
Defaults to the WEBDA_DEPLOYMENT environment variable
Inherited from
deployers
protecteddeployers:object={}
Defined in: packages/core/src/application/application.ts:140
Deployers type registry
Index Signature
[key: string]: any
Inherited from
deployment
protecteddeployment:Deployment
Defined in: packages/core/src/application/application.ts:126
Definition of the current deployment, once loaded
Inherited from
deploymentFile
deploymentFile:
string
Defined in: packages/core/src/application/application.ts:189
Current deployment file
Inherited from
logger
protectedlogger:WorkerOutput
Defined in: packages/core/src/application/application.ts:175
Class Logger
Inherited from
moddas
protectedmoddas:object={}
Defined in: packages/core/src/application/application.ts:145
Moddas registry
Index Signature
[key: string]: Modda
Inherited from
models
protectedmodels:object={}
Defined in: packages/core/src/application/application.ts:150
Models type registry
Index Signature
[key: string]: ModelDefinition
Inherited from
workspacesPath
protectedworkspacesPath:string=""
Defined in: packages/core/src/application/application.ts:180
Detect if running as workspace
Inherited from
_runner
static_runner: (app) =>Promise<void>
Defined in: packages/core/src/application/application.ts:232
Internal
Pluggable runner — set by runner.ts to avoid circular dependency with Core.
Parameters
app
Returns
Promise<void>
Inherited from
Methods
addModda()
addModda(
name,service):this
Defined in: packages/core/src/application/application.ts:423
Add a new service
Parameters
name
string
the name to use
service
the service instance
Returns
this
this for chaining
Inherited from
addModel()
addModel(
name,model,metadata?):this
Defined in: packages/core/src/application/application.ts:604
Add a new model
Parameters
name
string
the name to use
model
any
the model to use
metadata?
ModelMetadata = ...
the model metadata
Returns
this
this for chaining
Inherited from
applyCurrentDeployment()
protectedapplyCurrentDeployment():void
Defined in: packages/core/src/application/application.ts:277
Apply the current deployment parameters and services on the configuration
A packaged application already contains its deployment: the file is only required when the deployment differs from the packaged one
Returns
void
Inherited from
Application.applyCurrentDeployment
completeConfiguration()
completeConfiguration(
configuration):Configuration
Defined in: packages/core/src/application/unpackedapplication.ts:180
Add Moddas, Models and Deployers definitions It also add the project metadata
Parameters
configuration
the configuration
Returns
the result
completeNamespace()
completeNamespace(
name?):string
Defined in: packages/core/src/application/application.ts:894
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 = ""
the name to use
Returns
string
the result string
Inherited from
ensureDefaultConfiguration()
ensureDefaultConfiguration(
configuration):void
Defined in: packages/core/src/application/unpackedapplication.ts:82
Ensure default parameters are set on our application Creating the default services if they do not exist
Might want to have only this in unpackaged application as Application should have a perfectly valid configuration
Parameters
configuration
the configuration
Returns
void
filterModule()
filterModule(
_filename):boolean
Defined in: packages/core/src/application/unpackedapplication.ts:403
Only allow local and core module and sample-app
Parameters
_filename
string
the filename
Returns
boolean
true if the condition is met
findModules()
findModules(
module):Promise<string[]>
Defined in: packages/core/src/application/unpackedapplication.ts:368
Load all imported modules and current module It will compile module Generate the current module file Load any imported webda.module.json
Parameters
module
the module to load
Returns
Promise<string[]>
the list of results
getBehaviorMetadata()
getBehaviorMetadata(
identifier):BehaviorMetadata
Defined in: packages/core/src/application/application.ts:539
Return the metadata blob (Identifier, Actions, etc.) for a Behavior
loaded from webda.module.json.
Parameters
identifier
string
fully qualified Behavior id (e.g. Webda/MFA)
Returns
BehaviorMetadata
the metadata, or undefined if no Behavior with that id is registered
Inherited from
Application.getBehaviorMetadata
getBehaviors()
getBehaviors():
object
Defined in: packages/core/src/application/application.ts:549
Return all loaded Behaviors keyed by identifier.
Each entry exposes the original metadata blob emitted by the compiler.
Returns
object
the result
Inherited from
getConfiguration()
getConfiguration(
_deployment?):Configuration
Defined in: packages/core/src/application/application.ts:717
Get application configuration
Parameters
_deployment?
string = undefined
the deployment name
Returns
the result
Inherited from
getCurrentConfiguration()
getCurrentConfiguration():
Configuration
Defined in: packages/core/src/application/application.ts:731
Return current Configuration of the Application
Same as calling
getConfiguration(this.currentDeployment);
Returns
the result
Inherited from
Application.getCurrentConfiguration
getCurrentDeployment()
getCurrentDeployment():
string
Defined in: packages/core/src/application/application.ts:698
Get current deployment name
Returns
string
the result string
Inherited from
Application.getCurrentDeployment
getDeployers()
getDeployers():
object
Defined in: packages/core/src/application/application.ts:591
Return all deployers
Returns
object
the result
Inherited from
getDeployment()
getDeployment():
Deployment
Defined in: packages/core/src/application/application.ts:267
Get the definition of the current deployment
It includes the units and resources that are not part of the application configuration
Returns
the deployment or undefined if no deployment is selected
Inherited from
getGitInformation()
getGitInformation(
_name?,_version?):GitInformation
Defined in: packages/core/src/application/unpackedapplication.ts:206
Parameters
_name?
string
the name to use
_version?
string
the version string
Returns
empty git information
Overrides
getImplementations()
getImplementations<
T>(object):object
Defined in: packages/core/src/application/application.ts:784
Get implementations of a class
Type Parameters
T
T extends Service<ServiceParameters, { }>
Parameters
object
T
the target object
Returns
object
the result
Inherited from
Application.getImplementations
getModda()
getModda(
name):Modda
Defined in: packages/core/src/application/application.ts:500
Get a service based on name
Parameters
name
string
the name to use
Returns
the result
Inherited from
getModdas()
getModdas():
object
Defined in: packages/core/src/application/application.ts:508
Return all services of the application
Returns
object
the result
Inherited from
getModel()
getModel<
T>(name):ModelDefinition<T>
Defined in: packages/core/src/application/application.ts:518
Retrieve the model implementation
Type Parameters
T
T extends Model = Model
Parameters
name
string
model to retrieve
Returns
the result
Inherited from
getModelFromConstructor()
getModelFromConstructor(
model):string
Defined in: packages/core/src/application/application.ts:568
Return the model name for a object
Parameters
model
the model to use
Returns
string
the result
Inherited from
Application.getModelFromConstructor
getModelFromInstance()
getModelFromInstance(
object):string
Defined in: packages/core/src/application/application.ts:558
Return the model name for a object
Parameters
object
Storable
the target object
Returns
string
the result
Inherited from
Application.getModelFromInstance
getModelId()
getModelId(
model):string
Defined in: packages/core/src/application/application.ts:580
Get the model name from a model or a constructor
Parameters
model
Storable<any, any> | ModelClass<Storable<any, any>>
the model to use
Returns
string
longId for a model
Paramn
full if true always include the namespace, default is false e.g Webda/
Inherited from
getModels()
getModels():
object
Defined in: packages/core/src/application/application.ts:526
Get all models definitions
Returns
object
the result
Inherited from
getModules()
getModules():
CachedModule
Defined in: packages/core/src/application/application.ts:708
Return all application modules merged as one
Used when deployed
Returns
the result
Inherited from
getNamespace()
getNamespace():
string
Defined in: packages/core/src/application/application.ts:906
Return current namespace
Returns
string
the result string
Inherited from
getPackageDescription()
getPackageDescription():
PackageDescriptor
Defined in: packages/core/src/application/application.ts:378
Retrieve content of package.json
Returns
the result
Inherited from
Application.getPackageDescription
getPackageWebda()
getPackageWebda():
WebdaPackageDescriptor
Defined in: packages/core/src/application/application.ts:367
Retrieve specific webda conf from package.json
In case of workspaces the object is combined
Returns
the result
Inherited from
getPath()
getPath(
subpath?):string
Defined in: packages/core/src/application/application.ts:406
Return the current app path
Parameters
subpath?
string = undefined
to append to
Returns
string
the result string
Inherited from
getProjectInfo()
getProjectInfo():
ProjectInformation
Defined in: packages/core/src/application/application.ts:690
Retrieve the project information
Returns
the result
Inherited from
getSchema()
getSchema(
type):JSONSchema7
Defined in: packages/core/src/application/application.ts:326
Get a schema from a type
Schema should be precomputed in the default app
Parameters
type
string
the type to look up
Returns
JSONSchema7
the result
Inherited from
getSchemas()
getSchemas():
object
Defined in: packages/core/src/application/application.ts:345
Get schemas
Returns
object
the result
Inherited from
getWebdaObject()
getWebdaObject(
section,name):any
Defined in: packages/core/src/application/application.ts:476
Parameters
section
the section name
name
string
the name to use
Returns
any
the result
Inherited from
getWebdaVersion()
getWebdaVersion():
string
Defined in: packages/core/src/application/application.ts:669
Return webda current version
Returns
string
package version
Since
0.4.0
Inherited from
getWorkerOutput()
getWorkerOutput():
WorkerOutput
Defined in: packages/core/src/application/application.ts:396
Get current logger
Returns
WorkerOutput
the result
Inherited from
hasWebdaObject()
hasWebdaObject(
section,name):boolean
Defined in: packages/core/src/application/application.ts:436
Parameters
section
the section name
name
string
the name to use
Returns
boolean
true if the condition is met
Inherited from
importFile()
protectedimportFile(info,withExport?):Promise<any>
Defined in: packages/core/src/application/application.ts:744
Import a file
If the default is set take this or use old format
Parameters
info
string
the information object
withExport?
boolean = true
whether to include exports
Returns
Promise<any>
the result
Inherited from
isCached()
isCached():
boolean
Defined in: packages/core/src/application/application.ts:357
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
true if the condition is met
Inherited from
isFinalModel()
isFinalModel(
model):boolean
Defined in: packages/core/src/application/application.ts:458
Return true if model is the one that wins when consumers look up the
short name in the current namespace. Used by transports (REST, GraphQL,
gRPC) so only one model gets exposed at a given URL / type when the app
overrides a framework-provided class — e.g. WebdaSample/User shadowing
Webda/User at /users.
A model is "final" when either:
- it is the one resolved by
completeNamespace(shortName), or - no other model exists with the same short name in the current namespace.
Parameters
model
string
the fully-qualified model identifier (e.g. "Webda/User")
Returns
boolean
true when model should be treated as the canonical version
Inherited from
load()
load():
Promise<UnpackedApplication>
Defined in: packages/core/src/application/unpackedapplication.ts:64
Ensure default configuration after load
Returns
Promise<UnpackedApplication>
the result
Overrides
loadConfiguration()
loadConfiguration(
file):Promise<void>
Defined in: packages/core/src/application/unpackedapplication.ts:150
Load full configuration
webda.config.json and complete the cachedModule
Parameters
file
string
the file path
Returns
Promise<void>
the result
Overrides
loadLocalModule()
loadLocalModule():
Promise<void>
Defined in: packages/core/src/application/application.ts:772
Load local module
Returns
Promise<void>
Inherited from
loadProjectInformation()
loadProjectInformation():
ProjectInformation
Defined in: packages/core/src/application/unpackedapplication.ts:244
Check package.json
Returns
the result
loadWebdaModule()
loadWebdaModule(
moduleFile):CachedModule
Defined in: packages/core/src/application/unpackedapplication.ts:414
Load a webda.module.json file Resolve the linked file to current application
Parameters
moduleFile
string
to load
Returns
the result
log()
log(
level, ...args):void
Defined in: packages/core/src/application/application.ts:388
Log information
Parameters
level
WorkerLogLevel
to log for
args
...any[]
anything to display same as console.log
Returns
void
Inherited from
mergeModules()
mergeModules(
configuration):Promise<CachedModule>
Defined in: packages/core/src/application/unpackedapplication.ts:453
Merge all modules into one cached module
Parameters
configuration
the configuration
Returns
Promise<CachedModule>
the result
run()
run():
Promise<void>
Defined in: packages/core/src/application/application.ts:224
Run the application
Returns
Promise<void>
the result
Inherited from
setCurrentDeployment()
setCurrentDeployment(
name):this
Defined in: packages/core/src/application/application.ts:255
Select the deployment to apply on the configuration
Must be called before load
Parameters
name
string
deployment name, a deployments/<name> file of the application
Returns
this
this
Inherited from
Application.setCurrentDeployment
setModelMetadata()
protectedsetModelMetadata(info):void
Defined in: packages/core/src/application/application.ts:864
Set object Metadata Need to be done after all models are loaded to resolve Ancestors and Subclasses
Parameters
info
the information object
Returns
void
Inherited from
toJSON()
toJSON():
object
Defined in: packages/core/src/application/application.ts:655
Serialize the application state to a plain object
Returns
object
the result
appModule
appModule:
WebdaModule
baseConfiguration
baseConfiguration:
Configuration
currentDeployment
currentDeployment:
string
Inherited from
upgradeConfigToV4()
upgradeConfigToV4():
void
Defined in: packages/core/src/application/unpackedapplication.ts:218
Upgrade a v3 configuration to v4 format
Returns
void
deserialize()
staticdeserialize<T>(this,json):T
Defined in: packages/core/src/application/application.ts:643
Type Parameters
T
T extends Application
Parameters
this
(...args) => T
the constructor
json
any
the JSON data
Returns
T
the result
Inherited from
findModulesFiles()
staticfindModulesFiles<T>(this,path):Promise<string[]>
Defined in: packages/core/src/application/unpackedapplication.ts:298
Search the node_modules structure for webda.module.json files
Type Parameters
T
T
Parameters
this
T
path
string
the path
Returns
Promise<string[]>
the result