Update jsdocs

This commit is contained in:
Raymond Feng 2013-08-13 09:37:09 -07:00
parent 74460316b8
commit 6c0f2483b3
2 changed files with 297 additions and 128 deletions

View File

@ -1,4 +1,4 @@
/**
/*!
* Module dependencies
*/
var ModelBuilder = require('./model-builder.js').ModelBuilder;
@ -19,7 +19,7 @@ var existsSync = fs.existsSync || path.existsSync;
*/
exports.DataSource = DataSource;
/**
/*!
* Helpers
*/
var slice = Array.prototype.slice;
@ -30,8 +30,8 @@ var slice = Array.prototype.slice;
* All classes in single dataSource shares same connector type and
* one database connection
*
* @param name - type of dataSource connector (mysql, mongoose, sequelize, redis)
* @param settings - any database-specific settings which we need to
* @param {String} name - type of dataSource connector (mysql, mongoose, sequelize, redis)
* @param {Object} settings - any database-specific settings which we need to
* establish connection (of course it depends on specific connector)
*
* - host
@ -106,7 +106,7 @@ function DataSource(name, settings) {
});
}
}.bind(this));
};
}
util.inherits(DataSource, ModelBuilder);
@ -145,8 +145,15 @@ DataSource.prototype._setupConnector = function () {
};
};
}
}
};
/**
* Set up the data source
* @param {String} name The name
* @param {Object} settings The settings
* @returns {*}
* @private
*/
DataSource.prototype.setup = function(name, settings) {
var dataSource = this;
var connector;
@ -253,10 +260,10 @@ DataSource.prototype.setup = function(name, settings) {
});
}
};
}
};
/**
* Define class
* Define a model class
*
* @param {String} className
* @param {Object} properties - hash of class properties in format
@ -286,13 +293,21 @@ DataSource.prototype.setup = function(name, settings) {
* });
* ```
*/
DataSource.prototype.define = function defineClass(className, properties, settings) {
DataSource.prototype.createModel = DataSource.prototype.define = function defineClass(className, properties, settings) {
var args = slice.call(arguments);
if (!className) throw new Error('Class name required');
if (args.length == 1) properties = {}, args.push(properties);
if (args.length == 2) settings = {}, args.push(settings);
if (!className) {
throw new Error('Class name required');
}
if (args.length === 1) {
properties = {};
args.push(properties);
}
if (args.length === 2) {
settings = {};
args.push(settings);
}
properties = properties || {};
settings = settings || {};
@ -314,11 +329,11 @@ DataSource.prototype.define = function defineClass(className, properties, settin
return NewClass;
};
// alias createModel
DataSource.prototype.createModel = DataSource.prototype.define;
/**
* Mixin DataAccessObject methods.
*
* @param {Function} ModelCtor The model constructor
*/
DataSource.prototype.mixin = function (ModelCtor) {
@ -360,6 +375,8 @@ DataSource.prototype.mixin = function (ModelCtor) {
/**
* Attach an existing model to a data source.
*
* @param {Function} ModelCtor The model constructor
*/
DataSource.prototype.attach = function (ModelCtor) {
@ -391,7 +408,7 @@ DataSource.prototype.attach = function (ModelCtor) {
this.models[className] = ModelCtor;
return this;
}
};
/**
* Define single property named `prop` on `model`
@ -413,6 +430,7 @@ DataSource.prototype.defineProperty = function (model, prop, params) {
* This method make sense only for sql connectors.
*
* @param {String} or {[String]} Models to be migrated, if not present, apply to all models
* @param {Function} [cb] The callback function
*
* @warning All data will be lost! Use autoupdate if you need your data.
*/
@ -434,6 +452,7 @@ DataSource.prototype.automigrate = function (models, cb) {
* This method make sense only for sql connectors.
*
* @param {String} or {[String]} Models to be migrated, if not present, apply to all models
* @param {Function} [cb] The callback function
*/
DataSource.prototype.autoupdate = function (models, cb) {
this.freeze();
@ -451,12 +470,17 @@ DataSource.prototype.autoupdate = function (models, cb) {
/**
* Discover existing database tables.
* This method returns an array of model objects, including {type, name, onwer}
*
* @param options An object that contains the following settings:
* all: true - Discovering all models, false - Discovering the models owned by the current user
* views: true - Including views, false - only tables
* limit: The page size
* offset: The starting index
*
* `options`
*
* all: true - Discovering all models, false - Discovering the models owned by the current user
* views: true - Including views, false - only tables
* limit: The page size
* offset: The starting index
*
* @param {Object} options The options
* @param {Function} [cb] The callback function
*
*/
DataSource.prototype.discoverModelDefinitions = function (options, cb) {
this.freeze();
@ -468,6 +492,11 @@ DataSource.prototype.discoverModelDefinitions = function (options, cb) {
};
/**
* The synchronous version of discoverModelDefinitions
* @param {Object} options The options
* @returns {*}
*/
DataSource.prototype.discoverModelDefinitionsSync = function (options) {
this.freeze();
if (this.connector.discoverModelDefinitionsSync) {
@ -478,20 +507,42 @@ DataSource.prototype.discoverModelDefinitionsSync = function (options) {
/**
* Discover properties for a given model.
* The owner
* @param table The table/view name
* @param cb Callback
* The method return an array of properties, including {owner, tableName, columnName, dataType, dataLength, nullable}
*
* `property description`
*
* owner {String} The database owner or schema
* tableName {String} The table/view name
* columnName {String} The column name
* dataType {String} The data type
* dataLength {Number} The data length
* dataPrecision {Number} The numeric data precision
* dataScale {Number} The numeric data scale
* nullable {Boolean} If the data can be null
*
* `options`
*
* owner/schema The database owner/schema
*
* @param {String} modelName The table/view name
* @param {Object} options The options
* @param {Function} [cb] The callback function
*
*/
DataSource.prototype.discoverModelProperties = function (table, options, cb) {
DataSource.prototype.discoverModelProperties = function (modelName, options, cb) {
this.freeze();
if (this.connector.discoverModelProperties) {
this.connector.discoverModelProperties(table, options, cb);
this.connector.discoverModelProperties(modelName, options, cb);
} else if (cb) {
cb();
}
};
/**
* The synchronous version of discoverModelProperties
* @param {String} modelName The table/view name
* @param {Object} options The options
* @returns {*}
*/
DataSource.prototype.discoverModelPropertiesSync = function (modelName, options) {
this.freeze();
if (this.connector.discoverModelPropertiesSync) {
@ -504,15 +555,22 @@ DataSource.prototype.discoverModelPropertiesSync = function (modelName, options)
* Discover primary keys for a given owner/modelName
*
* Each primary key column description has the following columns:
* owner String => table schema (may be null)
* tableName String => table name
* columnName String => column name
* keySeq Number => sequence number within primary key( a value of 1 represents the first column of the primary key, a value of 2 would represent the second column within the primary key).
* pkName String => primary key name (may be null)
*
* The owner, default to current user
* @param modelName The table name
* @param cb Callback
* owner {String} => table schema (may be null)
* tableName {String} => table name
* columnName {String} => column name
* keySeq {Number} => sequence number within primary key( a value of 1 represents the first column of the primary key, a value of 2 would represent the second column within the primary key).
* pkName {String} => primary key name (may be null)
*
* The owner, default to current user
*
* `options`
*
* owner/schema The database owner/schema
*
* @param {String} modelName The model name
* @param {Object} options The options
* @param {Function} [cb] The callback function
*/
DataSource.prototype.discoverPrimaryKeys= function(modelName, options, cb) {
this.freeze();
@ -521,33 +579,45 @@ DataSource.prototype.discoverPrimaryKeys= function(modelName, options, cb) {
} else if (cb) {
cb();
}
}
};
/**
* The synchronous version of discoverPrimaryKeys
* @param {String} modelName The model name
* @param {Object} options The options
* @returns {*}
*/
DataSource.prototype.discoverPrimaryKeysSync= function(modelName, options) {
this.freeze();
if (this.connector.discoverPrimaryKeysSync) {
return this.connector.discoverPrimaryKeysSync(modelName, options);
}
return null;
}
};
/**
* Discover foreign keys for a given owner/modelName
*
* fkOwner String => foreign key table schema (may be null)
* fkName String => foreign key name (may be null)
* fkTableName String => foreign key table name
* fkColumnName String => foreign key column name
* keySeq short => sequence number within a foreign key( a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key).
* pkOwner String => primary key table schema being imported (may be null)
* pkName String => primary key name (may be null)
* pkTableName String => primary key table name being imported
* pkColumnName String => primary key column name being imported
* `foreign key description`
*
* fkOwner String => foreign key table schema (may be null)
* fkName String => foreign key name (may be null)
* fkTableName String => foreign key table name
* fkColumnName String => foreign key column name
* keySeq Number => sequence number within a foreign key( a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key).
* pkOwner String => primary key table schema being imported (may be null)
* pkName String => primary key name (may be null)
* pkTableName String => primary key table name being imported
* pkColumnName String => primary key column name being imported
*
* `options`
*
* owner/schema The database owner/schema
*
* @param {String} modelName The model name
* @param {Object} options The options
* @param {Function} [cb] The callback function
*
* @param modelName
* @param cb
*/
DataSource.prototype.discoverForeignKeys= function(modelName, options, cb) {
this.freeze();
@ -556,8 +626,15 @@ DataSource.prototype.discoverForeignKeys= function(modelName, options, cb) {
} else if (cb) {
cb();
}
}
};
/**
* The synchronous version of discoverForeignKeys
*
* @param {String} modelName The model name
* @param {Object} options The options
* @returns {*}
*/
DataSource.prototype.discoverForeignKeysSync= function(modelName, options) {
this.freeze();
if (this.connector.discoverForeignKeysSync) {
@ -570,19 +647,25 @@ DataSource.prototype.discoverForeignKeysSync= function(modelName, options) {
* Retrieves a description of the foreign key columns that reference the given table's primary key columns (the foreign keys exported by a table).
* They are ordered by fkTableOwner, fkTableName, and keySeq.
*
* fkOwner String => foreign key table schema (may be null)
* fkName String => foreign key name (may be null)
* fkTableName String => foreign key table name
* fkColumnName String => foreign key column name
* keySeq short => sequence number within a foreign key( a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key).
* pkOwner String => primary key table schema being imported (may be null)
* pkName String => primary key name (may be null)
* pkTableName String => primary key table name being imported
* pkColumnName String => primary key column name being imported
* `foreign key description`
*
* fkOwner {String} => foreign key table schema (may be null)
* fkName {String} => foreign key name (may be null)
* fkTableName {String} => foreign key table name
* fkColumnName {String} => foreign key column name
* keySeq {Number} => sequence number within a foreign key( a value of 1 represents the first column of the foreign key, a value of 2 would represent the second column within the foreign key).
* pkOwner {String} => primary key table schema being imported (may be null)
* pkName {String} => primary key name (may be null)
* pkTableName {String} => primary key table name being imported
* pkColumnName {String} => primary key column name being imported
*
* @param modelName
* @param cb
* `options`
*
* owner/schema The database owner/schema
*
* @param {String} modelName The model name
* @param {Object} options The options
* @param {Function} [cb] The callback function
*/
DataSource.prototype.discoverExportedForeignKeys= function(modelName, options, cb) {
this.freeze();
@ -591,8 +674,14 @@ DataSource.prototype.discoverExportedForeignKeys= function(modelName, options, c
} else if (cb) {
cb();
}
}
};
/**
* The synchronous version of discoverExportedForeignKeys
* @param {String} modelName The model name
* @param {Object} options The options
* @returns {*}
*/
DataSource.prototype.discoverExportedForeignKeysSync= function(modelName, options) {
this.freeze();
if (this.connector.discoverExportedForeignKeysSync) {
@ -621,6 +710,13 @@ function fromDBName(dbName, camelCase) {
return parts.join('');
}
/**
* Discover one schema from the given model without following the associations
*
* @param {String} modelName The model name
* @param {Object} [options] The options
* @param {Function} [cb] The callback function
*/
DataSource.prototype.discoverSchema = function (modelName, options, cb) {
options = options || {};
@ -646,8 +742,16 @@ DataSource.prototype.discoverSchema = function (modelName, options, cb) {
/**
* Discover schema from a given modelName/view
*
* @param modelName
* @param cb
* `options`
*
* {String} owner/schema - The database owner/schema name
* {Boolean} associations - If relations (primary key/foreign key) are navigated
* {Boolean} all - If all owners are included
* {Boolean} views - If views are included
*
* @param {String} modelName The model name
* @param {Object} [options] The options
* @param {Function} [cb] The callback function
*/
DataSource.prototype.discoverSchemas = function (modelName, options, cb) {
options = options || {};
@ -803,14 +907,21 @@ DataSource.prototype.discoverSchemas = function (modelName, options, cb) {
});
}
});
}
};
/**
* Discover schema from a given table/view
* Discover schema from a given table/view synchronously
*
* @param modelName
* @param cb
* `options`
*
* {String} owner/schema - The database owner/schema name
* {Boolean} associations - If relations (primary key/foreign key) are navigated
* {Boolean} all - If all owners are included
* {Boolean} views - If views are included
*
* @param {String} modelName The model name
* @param {Object} [options] The options
*/
DataSource.prototype.discoverSchemasSync = function (modelName, options) {
var self = this;
@ -939,14 +1050,21 @@ DataSource.prototype.discoverSchemasSync = function (modelName, options) {
return options.visited;
}
}
};
/**
* Discover and build models from the given owner/modelName
*
* @param modelName
* @param options
* @param cb
* `options`
*
* {String} owner/schema - The database owner/schema name
* {Boolean} associations - If relations (primary key/foreign key) are navigated
* {Boolean} all - If all owners are included
* {Boolean} views - If views are included
*
* @param {String} modelName The model name
* @param {Object} [options] The options
* @param {Function} [cb] The callback function
*/
DataSource.prototype.discoverAndBuildModels = function (modelName, options, cb) {
var self = this;
@ -965,13 +1083,20 @@ DataSource.prototype.discoverAndBuildModels = function (modelName, options, cb)
var models = self.buildModels(schemaList);
cb && cb(err, models);
});
}
};
/**
* Discover and build models from the given owner/modelName synchronously
*
* @param modelName
* @param options
* `options`
*
* {String} owner/schema - The database owner/schema name
* {Boolean} associations - If relations (primary key/foreign key) are navigated
* {Boolean} all - If all owners are included
* {Boolean} views - If views are included
*
* @param {String} modelName The model name
* @param {Object} [options] The options
*/
DataSource.prototype.discoverAndBuildModelsSync = function (modelName, options) {
var schemas = this.discoverSchemasSync(modelName, options);
@ -984,18 +1109,27 @@ DataSource.prototype.discoverAndBuildModelsSync = function (modelName, options)
var models = this.buildModels(schemaList);
return models;
}
};
/**
* Check whether migrations needed
* This method make sense only for sql connectors.
* @param {String[]} [models] A model name or an array of model names. If not present, apply to all models
*/
DataSource.prototype.isActual = function (cb) {
DataSource.prototype.isActual = function (models, cb) {
this.freeze();
if (this.connector.isActual) {
this.connector.isActual(cb);
} else if (cb) {
cb(null, true);
this.connector.isActual(models, cb);
} else {
if ((!cb) && ('function' === typeof models)) {
cb = models;
models = undefined;
}
if (cb) {
process.nextTick(function() {
cb(null, true);
});
}
}
};
@ -1023,7 +1157,7 @@ DataSource.prototype.freeze = function freeze() {
/**
* Return table name for specified `modelName`
* @param {String} modelName
* @param {String} modelName The model name
*/
DataSource.prototype.tableName = function (modelName) {
var settings = this.definitions[modelName].settings;
@ -1036,8 +1170,8 @@ DataSource.prototype.tableName = function (modelName) {
/**
* Return column name for specified modelName and propertyName
* @param modelName
* @param propertyName
* @param {String} modelName The model name
* @param propertyName The property name
* @returns {String} columnName
*/
DataSource.prototype.columnName = function (modelName, propertyName) {
@ -1054,8 +1188,8 @@ DataSource.prototype.columnName = function (modelName, propertyName) {
/**
* Return column metadata for specified modelName and propertyName
* @param modelName
* @param propertyName
* @param {String} modelName The model name
* @param propertyName The property name
* @returns {Object} column metadata
*/
DataSource.prototype.columnMetadata = function (modelName, propertyName) {
@ -1072,8 +1206,8 @@ DataSource.prototype.columnMetadata = function (modelName, propertyName) {
/**
* Return column names for specified modelName
* @param modelName
* @returns {[String]} column names
* @param {String} modelName The model name
* @returns {String[]} column names
*/
DataSource.prototype.columnNames = function (modelName) {
var props = this.definitions[modelName].properties;
@ -1090,17 +1224,17 @@ DataSource.prototype.columnNames = function (modelName) {
/**
* Find the ID column name
* @param modelName
* @param {String} modelName The model name
* @returns {String} columnName for ID
*/
DataSource.prototype.idColumnName = function(modelName) {
return this.columnName(modelName, this.idName(modelName));
}
};
/**
* Find the ID property name
* @param modelName
* @returns {String} property for ID
* @param {String} modelName The model name
* @returns {String} property name for ID
*/
DataSource.prototype.idName = function(modelName) {
var props = this.definitions[modelName].properties;
@ -1110,12 +1244,12 @@ DataSource.prototype.idName = function(modelName) {
}
}
return null;
}
};
/**
* Find the ID property names sorted by the index
* @param modelName
* @returns {[String]} property names for IDs
* @param {String} modelName The model name
* @returns {String[]} property names for IDs
*/
DataSource.prototype.idNames = function (modelName) {
var ids = [];
@ -1132,13 +1266,14 @@ DataSource.prototype.idNames = function (modelName) {
return id.name;
});
return names;
}
};
/**
* Define foreign key
* @param {String} className
* Define foreign key to another model
* @param {String} className The model name that owns the key
* @param {String} key - name of key field
* @param {String} foreignClassName The foreign model name
*/
DataSource.prototype.defineForeignKey = function defineForeignKey(className, key, foreignClassName) {
// quit if key already defined
@ -1167,6 +1302,7 @@ DataSource.prototype.defineForeignKey = function defineForeignKey(className, key
/**
* Close database connection
* @param {Fucntion} [cb] The callback function
*/
DataSource.prototype.disconnect = function disconnect(cb) {
var self = this;
@ -1182,6 +1318,13 @@ DataSource.prototype.disconnect = function disconnect(cb) {
}
};
/**
* Copy the model from Master
* @param {Function} Master The model constructor
* @returns {Function} The copy of the model constructor
*
* @private
*/
DataSource.prototype.copyModel = function copyModel(Master) {
var dataSource = this;
var className = Master.modelName;
@ -1221,6 +1364,11 @@ DataSource.prototype.copyModel = function copyModel(Master) {
return Slave;
};
/**
*
* @returns {EventEmitter}
* @private
*/
DataSource.prototype.transaction = function() {
var dataSource = this;
var transaction = new EventEmitter;
@ -1250,7 +1398,8 @@ DataSource.prototype.transaction = function() {
};
/**
* Enable a data source operation remotely.
* Enable a data source operation to be remote.
* @param {String} operation The operation name
*/
DataSource.prototype.enableRemote = function (operation) {
@ -1263,7 +1412,8 @@ DataSource.prototype.enableRemote = function (operation) {
}
/**
* Disable a data source operation remotely.
* Disable a data source operation to be remote.
* @param {String} operation The operation name
*/
DataSource.prototype.disableRemote = function (operation) {
@ -1277,6 +1427,7 @@ DataSource.prototype.disableRemote = function (operation) {
/**
* Get an operation's metadata.
* @param {String} operation The operation name
*/
DataSource.prototype.getOperation = function (operation) {
@ -1295,30 +1446,38 @@ DataSource.prototype.getOperation = function (operation) {
/**
* Get all operations.
*/
DataSource.prototype.operations = function () {
return this._operations;
}
/**
* Define an operation.
* Define an operation to the data source
* @param {String} name The operation name
* @param {Object} options The options
* @param [Function} fn The function
*/
DataSource.prototype.defineOperation = function (name, options, fn) {
options.fn = fn;
options.name = name;
this._operations[name] = options;
}
/**
* Check if the backend is a relational DB
* @returns {Boolean}
*/
DataSource.prototype.isRelational = function() {
return this.connector && this.connector.relational;
}
/**
* Define hidden property
* Define a hidden property
* @param {Object} obj The property owner
* @param {String} key The property name
* @param {Mixed} value The default value
*/
function hiddenProperty(where, property, value) {
Object.defineProperty(where, property, {
function hiddenProperty(obj, key, value) {
Object.defineProperty(obj, key, {
writable: false,
enumerable: false,
configurable: false,
@ -1329,9 +1488,9 @@ function hiddenProperty(where, property, value) {
/**
* Define readonly property on object
*
* @param {Object} obj
* @param {String} key
* @param {Mixed} value
* @param {Object} obj The property owner
* @param {String} key The property name
* @param {Mixed} value The default value
*/
function defineReadonlyProp(obj, key, value) {
Object.defineProperty(obj, key, {

View File

@ -1,4 +1,4 @@
/**
/*!
* Module dependencies
*/
@ -16,26 +16,34 @@ var introspect = require('./introspection')(ModelBuilder);
/**
* Export public API
*/
exports.Schema = exports.ModelBuilder = ModelBuilder;
exports.ModelBuilder = exports.Schema = ModelBuilder;
/**
/*!
* Helpers
*/
var slice = Array.prototype.slice;
/**
* ModelBuilder - Data Model Definition
* ModelBuilder - A builder to define data models
*
* @constructor
*/
function ModelBuilder() {
// create blank models pool
/**
* @property {Object} models Model constructors
*/
this.models = {};
/**
* @property {Object} definitions Definitions of the models
*/
this.definitions = {};
}
util.inherits(ModelBuilder, EventEmitter);
/**
* Define class
* Define a model class
*
* @param {String} className
* @param {Object} properties - hash of class properties in format
@ -292,7 +300,7 @@ function standartize(properties, settings) {
* Define single property named `prop` on `model`
*
* @param {String} model - name of model
* @param {String} prop - name of propery
* @param {String} prop - name of property
* @param {Object} params - property settings
*/
ModelBuilder.prototype.defineProperty = function (model, prop, params) {
@ -333,7 +341,6 @@ ModelBuilder.prototype.extendModel = function (model, props) {
};
ModelBuilder.prototype.copyModel = function copyModel(Master) {
var dataSource = this;
var className = Master.modelName;
@ -365,8 +372,7 @@ ModelBuilder.prototype.copyModel = function copyModel(Master) {
};
/**
/*!
* Define hidden property
*/
function hiddenProperty(where, property, value) {
@ -378,7 +384,7 @@ function hiddenProperty(where, property, value) {
});
}
/**
/*!
* Define readonly property on object
*
* @param {Object} obj
@ -396,7 +402,7 @@ function defineReadonlyProp(obj, key, value) {
/**
* Resolve the type string to be a function, for example, 'String' to String
* @param type The type string, such as 'number', 'Number', 'boolean', or 'String'. It's case insensitive
* @param {String} type The type string, such as 'number', 'Number', 'boolean', or 'String'. It's case insensitive
* @returns {Function} if the type is resolved
*/
ModelBuilder.prototype.getSchemaType = function(type) {
@ -441,9 +447,9 @@ ModelBuilder.prototype.getSchemaType = function(type) {
/**
* Build a dataSource
* @param name The name of the dataSource
* @param properties The properties of the dataSource
* @param associations An array of associations between models
* @param {String} name The name of the dataSource
* @param {Object} properties The properties of the dataSource
* @param {Object[]} associations An array of associations between models
* @returns {*}
*/
ModelBuilder.prototype.buildSchema = function(name, properties, associations) {
@ -478,10 +484,14 @@ ModelBuilder.prototype.buildSchema = function(name, properties, associations) {
/**
* Build models from dataSource definitions
* @param schemas The schemas can be one of the following three formats:
*
* `schemas` can be one of the following:
*
* 1. An array of named dataSource definition JSON objects
* 2. A dataSource definition JSON object
* 3. A list of property definitions (anonymous)
*
* @param {*} schemas The schemas
* @returns {Object} A map of model constructors keyed by model name
*/
ModelBuilder.prototype.buildModels = function (schemas) {
@ -526,9 +536,9 @@ ModelBuilder.prototype.buildModels = function (schemas) {
/**
* Introspect the json document to build a corresponding model
* @param {String} name
* @param {Object} json
* @param [Object} options
* @param {String} name The model name
* @param {Object} json The json object
* @param [Object} options The options
* @returns {}
*/
ModelBuilder.prototype.buildModelFromInstance = function(name, json, options) {
@ -538,7 +548,7 @@ ModelBuilder.prototype.buildModelFromInstance = function(name, json, options) {
// Create a model for the generated schema
return this.define(name, schema, options);
}
};