Generates a definition for a single model input type
@param {*} model
546750
function mapInputType(model) {
    const modelName = `${model.modelName}Input`;

    types[modelName] = {
        generated: false,
        name: modelName,
        meta: {
            category: 'TYPE',
            input: true,
            fields: {}
        }
    };

    _.forEach(model.definition.properties, (property, key) => {
        mapProperty(model, property, modelName, key, true);
    });
}
347555
private void prepareModel(DescriptorRepository model)
    {
        TreeMap result = new TreeMap();

        for (Iterator it = model.getDescriptorTable().values().iterator(); it.hasNext();)
        {
            ClassDescriptor classDesc = (ClassDescriptor)it.next();

            if (classDesc.getFullTableName() == null)
            {
                // not mapped to a database table
                continue;
            }

            String elementName        = getElementName(classDesc);
            Table  mappedTable        = getTableFor(elementName);
            Map    columnsMap         = getColumnsFor(elementName);
            Map    requiredAttributes = getRequiredAttributes(elementName);
            List   classDescs         = getClassDescriptorsMappingTo(elementName);

            if (mappedTable == null)
            {
                mappedTable = _schema.findTable(classDesc.getFullTableName());
                if (mappedTable == null)
                {
                    continue;
                }
                columnsMap         = new TreeMap();
                requiredAttributes = new HashMap();
                classDescs         = new ArrayList();
                _elementToTable.put(elementName, mappedTable);
                _elementToClassDescriptors.put(elementName, classDescs);
                _elementToColumnMap.put(elementName, columnsMap);
                _elementToRequiredAttributesMap.put(elementName, requiredAttributes);
            }
            classDescs.add(classDesc);
            extractAttributes(classDesc, mappedTable, columnsMap, requiredAttributes);
        }
        extractIndirectionTables(model, _schema);
    }
547826
function (model, property) {
  // TODO the reference to model.api is not available
  if (model.api && model.api.modelPropertyMacro) {
    return model.api.modelPropertyMacro(model, property);
  } else {
    return property.default;
  }
}
615355
function Model(defaults){

    // Make sure "new" is always used,
    // so we can use "instanceof" to check if something is a Model.
    if (!(this instanceof Model)) {
      return new Model(defaults);
    }

    // `model` is the public API object returned from invoking `new Model()`.
    var model = this,

        // The internal stored values for tracked properties. { property -> value }
        values = {},

        // The callback functions for each tracked property. { property -> [callback] }
        listeners = {},

        // The set of tracked properties. { property -> true }
        trackedProperties = {};

    // The functional reactive "when" operator.
    //
    //  * `properties` An array of property names (can also be a single property string).
    //  * `callback` A callback function that is called:
    //    * with property values as arguments, ordered corresponding to the properties array,
    //    * only if all specified properties have values,
    //    * once for initialization,
    //    * whenever one or more specified properties change,
    //    * on the next tick of the JavaScript event loop after properties change,
    //    * only once as a result of one or more synchronous changes to dependency properties.
    function when(properties, callback, thisArg){
      
      // Make sure the default `this` becomes 
      // the object you called `.on` on.
      thisArg = thisArg || this;

      // Handle either an array or a single string.
      properties = (properties instanceof Array) ? properties : [properties];

      // This function will trigger the callback to be invoked.
      var listener = debounce(function (){
        var args = properties.map(function(property){
          return values[property];
        });
        if(allAreDefined(args)){
          callback.apply(thisArg, args);
        }
      });

      // Trigger the callback once for initialization.
      listener();
      
      // Trigger the callback whenever specified properties change.
      properties.forEach(function(property){
        on(property, listener);
      });

      // Return this function so it can be removed later with `model.cancel(listener)`.
      return listener;
    }

    // Adds a change listener for a given property with Backbone-like behavior.
    // Similar to http://backbonejs.org/#Events-on
    function on(property, callback, thisArg){
      thisArg = thisArg || this;
      getListeners(property).push(callback);
      track(property, thisArg);
    }
    
    // Gets or creates the array of listener functions for a given property.
    function getListeners(property){
      return listeners[property] || (listeners[property] = []);
    }

    // Tracks a property if it is not already tracked.
    function track(property, thisArg){
      if(!(property in trackedProperties)){
        trackedProperties[property] = true;
        values[property] = model[property];
        Object.defineProperty(model, property, {
          get: function () { return values[property]; },
          set: function(newValue) {
            var oldValue = values[property];
            values[property] = newValue;
            getListeners(property).forEach(function(callback){
              callback.call(thisArg, newValue, oldValue);
            });
          }
        });
      }
    }

    // Cancels a listener returned by a call to `model.when(...)`.
    function cancel(listener){
      for(var property in listeners){
        off(property, listener);
      }
    }

    // Removes a change listener added using `on`.
    function off(property, callback){
      listeners[property] = listeners[property].filter(function (listener) {
        return listener !== callback;
      });
    }

    // Sets all of the given values on the model.
    // `newValues` is an object { property -> value }.
    function set(newValues){
      for(var property in newValues){
        model[property] = newValues[property];
      }
    }

    // Transfer defaults passed into the constructor to the model.
    set(defaults);

    // Public API.
    model.when = when;
    model.cancel = cancel;
    model.on = on;
    model.off = off;
    model.set = set;
  }
624197
function FieldType(model, fieldName, fieldProps) {
  this.model = model;
  this.name = fieldName;
  this.props = fieldProps;
}
154621
function(model, options) {
      if (!(model instanceof Parse.Object)) {
        var attrs = model;
        options.collection = this;
        model = new this.model(attrs, options);
        if (!model._validate(model.attributes, options)) {
          model = false;
        }
      } else if (!model.collection) {
        model.collection = this;
      }
      return model;
    }
1058960
function (model) {
            this._super(arguments);
            var ctiKey = this.__ctiKey = model.__ctiKey;
            this.__ctiTables = model.__ctiTables.slice();
            this.__ctiModels = model.__ctiModels.slice();
            this.__ctiModels.push(this);
            this.__ctiTables.push(this.tableName);
            this.__ctiColumns = comb.merge({}, model.__ctiColumns);
            this.__ctiColumns[this.tableName] = this.columns;
            this.__ctiBaseModel = model.__ctiBaseModel;
            //copy over our schema
            var newSchema = comb.merge({}, this.__schema);
            var schemas = model.__ctiModels.map(
                function (m) {
                    return m.schema;
                }).reverse();
            schemas.forEach(function (s) {
                for (var i in s) {
                    newSchema[i] = s[i];
                }
            }, this);
            this._setSchema(newSchema);
            this._setDataset(model.dataset.join(this.tableName, this.primaryKey));
            this._setPrimaryKey(this.__ctiBaseModel.primaryKey);
            this.pre("save", function (next) {
                if (ctiKey) {
                    this[ctiKey] = this.tableName.toString();
                }
                next();
            });
        }
441287
function isModel(object) {
    if (!object || typeof object !== 'object') {
        return false;
    }
    else if ('isModel' in object) {
        diag.debug.assert(function () { return object.isModel === Model.prototype.isPrototypeOf(object); });
        return object.isModel;
    }
    else {
        return Model.prototype.isPrototypeOf(object);
    }
}
879727
function model(spec) {
  var schema = lodash.cloneDeep(spec);

  delete schema.id;

  schema = transform(schema, {
    removeFormats: true,
  });

  return schema;
}
690898
function getModel(model) {
  const schemaPaths = model.schema.paths;
  const name = model.modelName;

  const fields = extractPaths(schemaPaths, { name });

  return {
    name,
    fields,
    model
  };
}
646972
function Model(restifier, model) {
  var thiz = this;

  this.restifier = restifier;
  this.model = model;

  // Special fields
  var id;
  var restricted = this.restricted = [];
  model.schema.eachPath(function(pathName, path) {
    if (path.options.restricted) {
      restricted.push(pathName);
    }
    if (path.options.id) {
      id = pathName;
    }
  });
  this.id = id || '_id';

  this.modifiers = [];
  this.filters = {};
  this.transformers = [];
  this.submodels = {};
  this.middlewares = {};
  this.errMiddlewares = {};
  this.customResponse = function(json,cb) {
    return cb(null,json);
  };

  // Remove restricted
  this.transform(function(req, doc) {
    _.forEach(restricted, function(path) {
      delete doc[path];
    });
  });

  // Add id field
  this.transform(function(req, doc) {
    doc.id = doc[thiz.id];
  });

  // Call setupPreston static if exists
  var setup = model.schema.statics.setupPreston;
  if (setup) {
    setup.call(model.schema, this);
  }
}
208284
private void buildDefinition(MarkupDocBuilder markupDocBuilder, String definitionName, Model model) {
        if (logger.isDebugEnabled()) {
            logger.debug("Definition processed : '{}'", definitionName);
        }
        if (config.isSeparatedDefinitionsEnabled()) {
            MarkupDocBuilder defDocBuilder = copyMarkupDocBuilder(markupDocBuilder);
            applyDefinitionComponent(defDocBuilder, definitionName, model);
            Path definitionFile = context.getOutputPath().resolve(definitionDocumentNameResolver.apply(definitionName));
            defDocBuilder.writeToFileWithoutExtension(definitionFile, StandardCharsets.UTF_8);
            if (logger.isDebugEnabled()) {
                logger.debug("Separate definition file produced : '{}'", definitionFile);
            }

            definitionRef(markupDocBuilder, definitionName);

        } else {
            applyDefinitionComponent(markupDocBuilder, definitionName, model);
        }
    }
1141717
function generateTypeDefs(models) {

    types = Object.assign({}, types, getCustomTypeDefs());

    _.forEach(models, (model) => {
        mapType(model);
        mapInputType(model);
    });

    return types;
}
112100
function Model(model) {
    this.child = window;
    this.model = model;
    this.parent = this.child.parent;
    return this.sendHandshakeReply();
  }
227497
function(model) {
        model.can = _.extend({create: true, read: true, update: true, delete: true}, model.can, feature.can);
    }
755065
function( model ) {
			var coll =  _.detect( this._collections, function( c ) {
					// Check if model is the type itself (a ref to the constructor), or is of type c.model
					return model === c.model || model instanceof c.model;
				});
			
			if ( !coll ) {
				coll = this._createCollection( model );
			}
			
			return coll;
		}
390102
function init(_models) {
  _.forEach(_models, (model) =>  {
    models[model.modelName] = model;
  });

  generateTypeDefs(models);
  generateNodeDefinitions(models);
}