Linker

Linker

new Linker(app, options)

Properties:
Name Type Attributes Default Description
options.schemaPath string

Geml source files path

options.useJsonSource bool <optional>
false

Use .json intermediate source file instead of .ool

options.saveIntermediate bool <optional>
false

Save intermediate source file while linking

Source:
Parameters:
Name Type Description
app ServiceContainer
options object

Members

app :ServiceContainer

App

Source:
Type:
  • ServiceContainer

dependencies :object.<string, string>

Dependent packages

Source:
Type:
  • object.<string, string>

saveIntermediate :bool

Save intermediate files

Source:
Type:
  • bool

schemas :object.<string, Schema>

Linked schemas

Source:
Type:

sourcePath :string

Geml source files path

Source:
Type:
  • string

useJsonSource :bool

Use json or ols

Source:
Type:
  • bool

Methods

getElementUniqueId(refererModule, elementType, elementName) → {string}

Get the unique name of an element.

Source:
Parameters:
Name Type Description
refererModule object
elementType string
elementName string
Returns:
Type:
string
  • The unique name of an element.

getModuleById(moduleId) → {object}

Get a loaded oolone module

Source:
Parameters:
Name Type Description
moduleId string
Returns:
Type:
object

getModuleIdByPath(modulePath) → {string}

Get the unique module id by source file path.

Source:
Parameters:
Name Type Description
modulePath string

The path of an oolong source file.

Returns:
Type:
string
  • The module id.

isModuleLoaded(moduleId) → {boolean}

Check whether a module is loaded

Source:
Parameters:
Name Type Description
moduleId string
Returns:
Type:
boolean

Start linking oolong files

Source:
Parameters:
Name Type Description
entryFileName string

loadElement(refererModule, elementType, elementName, throwOnMissing) → {*}

Load an element based on the namespace chain.

Source:
Parameters:
Name Type Description
refererModule object

The module that refers to the element.

elementType string

The type of the element: entity, type, modifier, etc.

elementName string

The name of the element.

throwOnMissing boolean

Throw an error if the element is not found.

Returns:
Type:
*

loadModule(modulePath, packageNameopt) → {*}

Load a xeml module, return undefined if not exist

Source:
Parameters:
Name Type Attributes Description
modulePath string
packageName string <optional>
Returns:
Type:
*

log(level, message, dataopt)

Write log

Source:
Parameters:
Name Type Attributes Description
level string
message string
data object <optional>

trackBackType(xemlModule, info) → {Array}

Track back the type derived chain.

Source:
Parameters:
Name Type Description
xemlModule object
info object
Returns:
Type:
Array

[ derivedInfo, baseInfo ]

translateXemlValue(xemlModule, value) → {*}

Translate an value by inferring all the references.

Source:
Parameters:
Name Type Description
xemlModule object
value *
Returns:
Type:
*
  • Translated value.

(static) buildSchemaObjects(app, options) → {object}

Compile and link xeml files into schema objects

Source:
Parameters:
Name Type Description
app App
options object
Returns:
Type:
object

map of schema name to object

(static) getXemlFiles(sourceDir, useJsonSourceopt, recursiveopt) → {array}

Get xeml files

Source:
Parameters:
Name Type Attributes Description
sourceDir string
useJsonSource boolean <optional>
recursive boolean <optional>
Returns:
Type:
array

xeml files