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()
Parameters:
NameTypeAttributesDescription
cwdstring<optional>

Current working directory

Returns:
Type: 
App

Type Definitions

TAppConfigHandler

Type:
  • Object
Properties
NameTypeAttributesDescription
extstring

File extension

readHandlerfunction<optional>

Function to call for reading

writeHandlerfunction<optional>

Function to call for writing

TAppEnv

Type:
  • Object
Properties
NameTypeDefaultDescription
devstringdevelopment
prodstringproduction
See

TAppLib

Type:
  • Object
Properties
NameTypeDescription
_Object

Access to lodash

fsObject

Access to fs-extra

fastGlobObject

Access to fast-glob

sprintfObject

Access to sprintf

anekaObject

Access to aneka

outmatchObject

Access to outmatch

dayjsObject

Access to dayjs with utc & customParseFormat plugin already applied

See

TBajoDataType

Supported data types

Type:
  • Object
Properties
NameTypeDescription
0string

string

1string

float

2string

double

3string

integer

4string

smallint

5string

date

6string

time

7string

datetime

8string

array

9string

object

10string

auto

TBajoFormatResult

Object returned by bajo:getUnitFormat

Type:
  • Object
Properties
NameTypeDescription
unitSysstring

Unit system

formatObject

Format object

TBajoFormatType

General format types

Type:
  • Object
Properties
NameTypeDescription
0string

speed

1string

distance

3string

area

4string

degree

TLogJson

Log output in stringified JSON format. Returned when app run in prod environment

Properties
NameTypeAttributesDescription
prefixstring

Message prefix

messagestring

The message itself

levelstring

Log level

timenumber

Time in millisecond

pidnumber

Process ID

hostnamestring

Hostname

dataObject<optional>

Payload data, if any

TLogLevels

Type:
  • Object
Properties
NameTypeDescription
traceObject
Properties
NameTypeAttributesDefaultDescription
numbernumber<optional>
10
colorstring<optional>
gray
debugObject
Properties
NameTypeAttributesDefaultDescription
numbernumber<optional>
20
colorstring<optional>
greenBright
infoObject
Properties
NameTypeAttributesDefaultDescription
numbernumber<optional>
30
colorstring<optional>
blueBright
warnObject
Properties
NameTypeAttributesDefaultDescription
numbernumber<optional>
40
colorstring<optional>
yellowBright
errorObject
Properties
NameTypeAttributesDefaultDescription
numbernumber<optional>
50
colorstring<optional>
redBright
fatalObject
Properties
NameTypeAttributesDefaultDescription
numbernumber<optional>
60
colorstring<optional>
magentaBright
silentObject
Properties
NameTypeAttributesDefaultDescription
numbernumber<optional>
99
colorstring<optional>
white

TNsPathPairs

Name based {ns}:{path} format

Type:
  • string

TNsPathResult

Object returned by bajo:breakNsPath

Type:
  • Object
Properties
NameTypeAttributesDescription
nsstring

Namespace

subNsstring<optional>

Sub namespace

subSubNsstring<optional>

Sub of sub namespace

pathstring

Path without query string or hash

fullPathstring

Full path, including query string and hash

TPrintOptions

Properties
NameTypeAttributesDefaultDescription
showDatetimeboolean<optional>
false

Show actual date & time

showCounterboolean<optional>
false

Show as counter

silentboolean<optional>

Suppress any messages. Defaults to the one set in config

oraObject<optional>

Ora's options object

Events

bajo:afterAll{method}

Run after all {method} executed. Accepted {method}: Init or Start

bajo:afterBootComplete

Run after boot process is completed

See

bajo:afterBuildCollection

Run after collection is built

Parameters:
NameTypeDescription
containerstring
itemsArray.<Object>

bajo:afterCollectHooks

Run after hooks are collected

Parameters:
NameTypeDescription
hooksArray.<Object>

Array of hook objects

bajo:beforeAll{method}

Run before all {method} executed. Accepted {method}: Init or Start

Parameters:
NameTypeDescription
methodstring

Accepted methods: Init, Start

bajo:beforeBuildCollection

Run before collection is built

Parameters:
NameTypeDescription
containerstring

{ns}:afterAppletRun

Run after applet is run. [ns] is applet's namespace

Parameters:
NameTypeAttributesDescription
paramsany<repeatable>

{ns}:after{method}

Run after {method} is executed within {ns} context

  • {ns} - namespace
  • {method} - Accepted methods: Init or Start

{ns}:beforeAppletRun

Run before applet is run. [ns] is applet's namespace

Parameters:
NameTypeAttributesDescription
paramsany<repeatable>

{ns}:before{method}

Run before {method} is executed within {ns} context

  • {ns} - namespace
  • {method} - Accepted methods: Init or Start