DataConfiguration

DataConfiguration

Holds the configuration of data modeling infrastructure

Constructor

new DataConfiguration()

Properties:
Name Type Description
auth DataConfigurationAuth
Source:

Methods

getModelDefinition(name) → {DataModel|undefined}

Gets a native object which represents the definition of the model with the given name.
Parameters:
Name Type Description
name string
Source:
Returns:
Type
DataModel | undefined

getModelPath() → {string}

Gets a string which represents the path where schemas exist. The default location is the config/models folder.
Source:
Returns:
Type
string

hasDataType(name) → {boolean}

Gets a boolean which indicates whether the specified data type is defined in data types collection or not.
Parameters:
Name Type Description
name
Source:
Returns:
Type
boolean

model(name) → {*}

Parameters:
Name Type Description
name string
Source:
Returns:
Type
*

setModelDefinition(data) → {DataConfiguration}

Sets a data model definition in application storage. Use this method in order to override default model loading process.
Parameters:
Name Type Description
data * A generic object which represents a model definition
Source:
Returns:
Type
DataConfiguration
Example
var most = require("most-data");
     most.cfg.getCurrent().setModelDefinition({
        "name":"UserColor",
        "version":"1.1",
        "title":"User Colors",
        "fields":[
            { "name": "id", "title": "Id", "type": "Counter", "nullable": false, "primary": true },
            { "name": "user", "title": "User", "type": "User", "nullable": false },
            { "name": "color", "title": "Color", "type": "Text", "nullable": false, "size":12 },
            { "name": "tag", "title": "Tag", "type": "Text", "nullable": false, "size":24 }
            ],
        "constraints":[
            {"type":"unique", "fields": [ "user" ]}
        ],
        "privileges":[
            { "mask":15, "type":"self","filter":"id eq me()" }
            ]
    });

setModelPath(p) → {DataConfiguration}

Sets a string which represents the path where schemas exist.
Parameters:
Name Type Description
p
Source:
Returns:
Type
DataConfiguration