models/meta.js
function getModelInfo (modelName) {
    debug('getModelInfo: ' + modelName)

    // Get the model
    const model = Meta.app.models[ modelName ]

    // Create the base return object
    const result = {
      id: model.definition.name,
      name: model.definition.name,
      properties: formatProperties(model.definition.properties)
    }

    // Get the following keys from the settings object, if they are set
    const keys = {
      'acls': [],
      'base': '',
      'description': '',
      'hidden': [],
      'idInjection': true,
      'methods': {},
      'mixins': {},
      'persistUndefinedAsNull': false,
      'plural': '',
      'relations': {},
      'strict': false,
      'validations': [],
    }

    // Loop through the keys and add them to the result with their value
    Object.keys(keys).forEach(key => {
      result[ key ] = _.get(model.definition.settings, key, keys[ key ])
    })
    return result
  }
function getModelInfo (modelName) {
    debug('getModelInfo: ' + modelName)

    // Get the model
    const model = Meta.app.models[ modelName ]

    // Create the base return object
    const result = {
      id: model.definition.name,
      name: model.definition.name,
      properties: formatProperties(model.definition.properties)
    }

    // Get the following keys from the settings object, if they are set
    const keys = {
      'acls': [],
      'base': '',
      'description': '',
      'hidden': [],
      'idInjection': true,
      'methods': {},
      'mixins': {},
      'persistUndefinedAsNull': false,
      'plural': '',
      'relations': {},
      'strict': false,
      'validations': [],
    }

    // Loop through the keys and add them to the result with their value
    Object.keys(keys).forEach(key => {
      result[ key ] = _.get(model.definition.settings, key, keys[ key ])
    })
    return result
  }
function getModelInfo ( modelName ) { debug ( 'getModelInfo: ' + modelName ) // Get the model const model = Meta . app . models [ modelName ] // Create the base return object const result = { id : model . definition . name , name : model . definition . name , properties : formatProperties ( model . definition . properties ) } // Get the following keys from the settings object, if they are set const keys = { 'acls' : [ ] , 'base' : '' , 'description' : '' , 'hidden' : [ ] , 'idInjection' : true , 'methods' : { } , 'mixins' : { } , 'persistUndefinedAsNull' : false , 'plural' : '' , 'relations' : { } , 'strict' : false , 'validations' : [ ] , } // Loop through the keys and add them to the result with their value Object . keys ( keys ) . forEach ( key => { result [ key ] = _ . get ( model . definition . settings , key , keys [ key ] ) } ) return result }
Get the definition of a model and format the result in a way that's similar to a LoopBack model definition file
Get the definition of a model and format the result in a way that s similar to a LoopBack model definition file