API Docs for:
Show:

Facade Class

Facade class of DDD pattern.

  • create instance of factories
  • create instance of repositories

Methods

addClass

(
  • modFullName
  • klass
)
Function private

add class to facade. the class is acquired by @require(modFullName)

Parameters:

  • modFullName String
  • klass Function

Returns:

Function:

create

(
  • Class
)
Base

Create instance of given Class.

Parameters:

  • Class Function | Class

Returns:

Base:

createFactory

(
  • modFirstName
)
BaseFactory

create a factory instance 2nd, 3rd, 4th ... arguments are the params to pass to the constructor of the factory

Parameters:

  • modFirstName String

Returns:

createInstance

(
  • [options]
)
Facade static

create instance of Facade

Parameters:

  • [options] Object optional

Returns:

createModel

(
  • modFirstName
  • obj
  • [options]
  • [root]
)
BaseModel

create an instance of the given modFirstName using obj if obj is null or undefined, empty object will be created.

Parameters:

  • modFirstName String
  • obj Object
  • [options] Object optional
  • [root] RootInterface optional

Returns:

createPreferred

(
  • modFirstName
  • type
  • [options]
  • [params]
  • root
)
BaseFactory private

create a preferred factory|repository|service instance

Parameters:

  • modFirstName String
  • type String

    factory|repository|service

  • [options] Object optional
  • [params] Object optional

    params pass to constructor of Repository, Factory or Service

  • root RootInterface

Returns:

createPreferredFactory

(
  • firstName
  • [options]
)
BaseFactory

create a preferred factory instance 3rd, 4th ... arguments are the params to pass to the constructor of the factory

Parameters:

  • firstName String
  • [options] Object optional
    • [noParent=true] Object optional

      if true, stop requiring parent class

Returns:

createPreferredRepository

(
  • firstName
  • [options]
)
BaseRepository

create a preferred repository instance 3rd, 4th ... arguments are the params to pass to the constructor of the repository

Parameters:

  • firstName String
  • [options] Object optional
    • [noParent] Object optional

      if true, stop requiring parent class

Returns:

createPreferredService

(
  • firstName
  • [options]
)
BaseService

create a preferred service instance 2nd, 3rd, 4th ... arguments are the params to pass to the constructor of the factory

Parameters:

  • firstName String
  • [options] Object optional
    • [noParent=true] Object optional

      if true, stop requiring parent class

Returns:

createRepository

(
  • modFirstName
)
BaseRepository

create a repository instance 2nd, 3rd, 4th ... arguments are the params to pass to the constructor of the repository

Parameters:

  • modFirstName String

Returns:

createService

(
  • modFirstName
)
BaseService

create a service instance 2nd, 3rd, 4th ... arguments are the params to pass to the constructor of the service

Parameters:

  • modFirstName String

Returns:

deserialize

(
  • str
)
Any

Deserializes serialized string

Parameters:

  • str String

Returns:

Any:

error

(
  • reason
  • [message]
)
Error

create instance of DomainError

Parameters:

  • reason String

    reason of the error

  • [message] String optional

Returns:

Error:

fullName

(
  • modFullName
)
String private

get fullName from modFullName

Parameters:

  • modFullName String

Returns:

String:

getFacade

() Facade deprecated chainable

Defined in /home/ubuntu/base-domain/src/lib/facade.coffee:32

Deprecated: just use this.facade

Get facade

Returns:

getModel

(
  • firstName
)
Function

get a model class

Parameters:

  • firstName String

Returns:

Function:

getModelProps

(
  • modFullName
)
ModelProps

Get ModelProps by firstName. ModelProps summarizes properties of this class

Parameters:

  • modFullName String

Returns:

getModule

(
  • moduleName
)
BaseModule

Parameters:

  • moduleName String

Returns:

getPreferredNames

(
  • modFirstName
  • type
)
String private

Parameters:

  • modFirstName String
  • type String

    repository|factory|service

Returns:

String:

modFullName

hasClass

(
  • modFullName
)
Function

check existence of the class of the given name

Parameters:

  • modFullName String

Returns:

Function:

insertFixtures

(
  • [options]
)
Promise(EntityPool)

insert fixture data (Node.js only)

Parameters:

  • [options] Object optional
    • [dataDir='./data'] String optional

      directory to have fixture data files

    • [tsvDir='./tsv'] String optional

      directory to have TSV files

    • [models=null] Array(String) optional

      model firstNames to insert. default: all models

Returns:

Promise(EntityPool):

inserted data

isDomainError

(
  • e
)
Boolean

check if given object is instance of DomainError

Parameters:

  • e Error

Returns:

Boolean:

moduleName

(
  • modFullName
)
String private

get moduleName from modFullName

Parameters:

  • modFullName String

Returns:

String:

require

(
  • modFullName
)
Function private

read a file and returns class

Parameters:

  • modFullName String

Returns:

Function:

serialize

(
  • val
)
String

Serialize the given object containing model information

Parameters:

  • val Any

Returns:

String:

Properties

isRoot

Boolean static

is root (to identify RootInterface)

latestInstance

Facade static

Latest instance created via @createInstance() This instance will be attached base instances with no @root property.

master

MasterDataResource

instance of MasterDataResource Exist only when "master" property is given to Facade's option