lib/services/models.js
function put(model, uri, data, locals) {
  const startTime = process.hrtime(),
    timeoutLimit = TIMEOUT_CONSTANT * TIMEOUT_PUT_COEFFICIENT;

  return bluebird.try(() => {
    return bluebird.resolve(model.save(uri, data, locals))
      .then(resolvedData => {
        if (!_.isObject(resolvedData)) {
          throw new Error(`Unable to save ${uri}: Data from model.save must be an object!`);
        }

        return {
          key: uri,
          type: 'put',
          value: JSON.stringify(resolvedData)
        };
      });
  }).tap(() => {
    const ms = timer.getMillisecondsSince(startTime);

    if (ms > timeoutLimit * 0.5) {
      log('warn', `slow put ${uri} ${ms}ms`);
    }
  }).timeout(timeoutLimit, `Module PUT exceeded ${timeoutLimit}ms: ${uri}`);
}
function put(model, uri, data, locals) {
  const startTime = process.hrtime(),
    timeoutLimit = TIMEOUT_CONSTANT * TIMEOUT_PUT_COEFFICIENT;

  return bluebird.try(() => {
    return bluebird.resolve(model.save(uri, data, locals))
      .then(resolvedData => {
        if (!_.isObject(resolvedData)) {
          throw new Error(`Unable to save ${uri}: Data from model.save must be an object!`);
        }

        return {
          key: uri,
          type: 'put',
          value: JSON.stringify(resolvedData)
        };
      });
  }).tap(() => {
    const ms = timer.getMillisecondsSince(startTime);

    if (ms > timeoutLimit * 0.5) {
      log('warn', `slow put ${uri} ${ms}ms`);
    }
  }).timeout(timeoutLimit, `Module PUT exceeded ${timeoutLimit}ms: ${uri}`);
}
function put ( model , uri , data , locals ) { const startTime = process . hrtime ( ) , timeoutLimit = TIMEOUT_CONSTANT * TIMEOUT_PUT_COEFFICIENT ; return bluebird . try ( ( ) => { return bluebird . resolve ( model . save ( uri , data , locals ) ) . then ( resolvedData => { if ( ! _ . isObject ( resolvedData ) ) { throw new Error ( ` ${ uri } ` ) ; } return { key : uri , type : 'put' , value : JSON . stringify ( resolvedData ) } ; } ) ; } ) . tap ( ( ) => { const ms = timer . getMillisecondsSince ( startTime ) ; if ( ms > timeoutLimit * 0.5 ) { log ( 'warn' , ` ${ uri } ${ ms } ` ) ; } } ) . timeout ( timeoutLimit , ` ${ timeoutLimit } ${ uri } ` ) ; }
Execute the save function of a model.js file
for either a component or a layout

@param {Object} model
@param {String} uri
@param {Object} data
@param {Object} locals
@returns {Object}
Execute the save function of a model . js file for either a component or a layout