Methods
(async) boot(cwdopt) → {App}
Main entry point of a Bajo app. Returned value is the app instance itself.
While you can code directly around it, you typically write your code the main plugin ({mainNs}
) or writing your own custom plugin.
I recommend the second method for its portability.
Example:
// index.js file. Your main package entry point
import bajo from 'bajo'
await bajo()
Name | Type | Attributes | Description |
---|---|---|---|
cwd | string | <optional> | Current working directory |
- Type:
- App
Type Definitions
TAppConfigHandler
- Object
Name | Type | Attributes | Description |
---|---|---|---|
ext | string | File extension | |
readHandler | function | <optional> | Function to call for reading |
writeHandler | function | <optional> | Function to call for writing |
- Source
TAppEnv
- Object
Name | Type | Default | Description |
---|---|---|---|
dev | string | development | |
prod | string | production |
- Source
- See
TAppLib
- Object
Name | Type | Description |
---|---|---|
_ | Object | Access to lodash |
fs | Object | Access to fs-extra |
fastGlob | Object | Access to fast-glob |
sprintf | Object | Access to sprintf |
aneka | Object | Access to aneka |
outmatch | Object | Access to outmatch |
dayjs | Object | Access to dayjs with utc & customParseFormat plugin already applied |
- Source
- See
TBajoDataType
Supported data types
- Object
Name | Type | Description |
---|---|---|
0 | string | string |
1 | string | float |
2 | string | double |
3 | string | integer |
4 | string | smallint |
5 | string | date |
6 | string | time |
7 | string | datetime |
8 | string | array |
9 | string | object |
10 | string | auto |
- Source
TBajoFormatResult
Object returned by bajo:getUnitFormat
- Object
Name | Type | Description |
---|---|---|
unitSys | string | Unit system |
format | Object | Format object |
- Source
TBajoFormatType
General format types
- Object
Name | Type | Description |
---|---|---|
0 | string | speed |
1 | string | distance |
3 | string | area |
4 | string | degree |
- Source
TLogJson
Log output in stringified JSON format. Returned when app run in prod
environment
Name | Type | Attributes | Description |
---|---|---|---|
prefix | string | Message prefix | |
message | string | The message itself | |
level | string | Log level | |
time | number | Time in millisecond | |
pid | number | Process ID | |
hostname | string | Hostname | |
data | Object | <optional> | Payload data, if any |
- Source
TLogLevels
- Object
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
trace | Object | Properties
| |||||||||||||||
debug | Object | Properties
| |||||||||||||||
info | Object | Properties
| |||||||||||||||
warn | Object | Properties
| |||||||||||||||
error | Object | Properties
| |||||||||||||||
fatal | Object | Properties
| |||||||||||||||
silent | Object | Properties
|
- Source
TNsPathPairs
Name based {ns}:{path}
format
- string
- Source
TNsPathResult
Object returned by bajo:breakNsPath
- Object
Name | Type | Attributes | Description |
---|---|---|---|
ns | string | Namespace | |
subNs | string | <optional> | Sub namespace |
subSubNs | string | <optional> | Sub of sub namespace |
path | string | Path without query string or hash | |
fullPath | string | Full path, including query string and hash |
- Source
TPrintOptions
PropertiesName | Type | Attributes | Default | Description |
---|---|---|---|---|
showDatetime | boolean | <optional> | false | Show actual date & time |
showCounter | boolean | <optional> | false | Show as counter |
silent | boolean | <optional> | Suppress any messages. Defaults to the one set in config | |
ora | Object | <optional> | Ora's options object |
- Source
- See
Events
bajo:afterAll{method}
Run after all {method}
executed. Accepted {method}
: Init
or Start
- Source
bajo:afterBootComplete
Run after boot process is completed
- Source
- See
- hook
- App#boot
bajo:afterBuildCollection
Run after collection is built
Name | Type | Description |
---|---|---|
container | string | |
items | Array.<Object> |
- Source
- See
bajo:afterCollectHooks
Run after hooks are collected
Name | Type | Description |
---|---|---|
hooks | Array.<Object> | Array of hook objects |
- Source
bajo:beforeAll{method}
Run before all {method}
executed. Accepted {method}
: Init
or Start
Name | Type | Description |
---|---|---|
method | string | Accepted methods: |
- Source
bajo:beforeBuildCollection
Run before collection is built
Name | Type | Description |
---|---|---|
container | string |
- Source
- See
{ns}:afterAppletRun
Run after applet is run. [ns]
is applet's namespace
Name | Type | Attributes | Description |
---|---|---|---|
params | any | <repeatable> |
- Source
{ns}:after{method}
Run after {method}
is executed within {ns}
context
{ns}
- namespace{method}
- Accepted methods:Init
orStart
- Source
{ns}:beforeAppletRun
Run before applet is run. [ns]
is applet's namespace
Name | Type | Attributes | Description |
---|---|---|---|
params | any | <repeatable> |
- Source
{ns}:before{method}
Run before {method}
is executed within {ns}
context
{ns}
- namespace{method}
- Accepted methods:Init
orStart
- Source