lib/tgi-store-host.source.js
function (args) {
    //console.log('PutModel messageContents: json  ' + JSON.stringify(messageContents));
    Model.call(this, args);
    this.modelType = messageContents.modelType;
    this.attributes = [];
    var a, attrib, v;
    for (a in messageContents.attributes) {
      //console.log('PutModel Attribute: json  ' + JSON.stringify(messageContents.attributes[a]));
      if (messageContents.attributes[a].type == 'Model') {
        v = new Attribute.ModelID(createModelFromModelType(messageContents.attributes[a].modelType));
        v.value = messageContents.attributes[a].value.value;
        if (messageContents.attributes[a].value.name)
          v.name = messageContents.attributes[a].value.name;
        attrib = new Attribute({name: messageContents.attributes[a].name, type: 'Model', value: v});
      } else if (messageContents.attributes[a].type == 'Date') {
        attrib = new Attribute(messageContents.attributes[a].name, messageContents.attributes[a].type);
        try {
          attrib.value = messageContents.attributes[a].value === null ? null : new Date(messageContents.attributes[a].value);
        } catch (e) {
          attrib.value = null;
        }
      } else {
        attrib = new Attribute(messageContents.attributes[a].name, messageContents.attributes[a].type);
        if (attrib.name == 'id') { // TODO only If mongo! or refactor mongo to normalize IDs
          if (attrib.value != messageContents.attributes[a].value)
            attrib.value = messageContents.attributes[a].value;
        } else {
          attrib.value = messageContents.attributes[a].value;
        }
      }
      this.attributes.push(attrib);
    }
  }
function (args) {
    //console.log('PutModel messageContents: json  ' + JSON.stringify(messageContents));
    Model.call(this, args);
    this.modelType = messageContents.modelType;
    this.attributes = [];
    var a, attrib, v;
    for (a in messageContents.attributes) {
      //console.log('PutModel Attribute: json  ' + JSON.stringify(messageContents.attributes[a]));
      if (messageContents.attributes[a].type == 'Model') {
        v = new Attribute.ModelID(createModelFromModelType(messageContents.attributes[a].modelType));
        v.value = messageContents.attributes[a].value.value;
        if (messageContents.attributes[a].value.name)
          v.name = messageContents.attributes[a].value.name;
        attrib = new Attribute({name: messageContents.attributes[a].name, type: 'Model', value: v});
      } else if (messageContents.attributes[a].type == 'Date') {
        attrib = new Attribute(messageContents.attributes[a].name, messageContents.attributes[a].type);
        try {
          attrib.value = messageContents.attributes[a].value === null ? null : new Date(messageContents.attributes[a].value);
        } catch (e) {
          attrib.value = null;
        }
      } else {
        attrib = new Attribute(messageContents.attributes[a].name, messageContents.attributes[a].type);
        if (attrib.name == 'id') { // TODO only If mongo! or refactor mongo to normalize IDs
          if (attrib.value != messageContents.attributes[a].value)
            attrib.value = messageContents.attributes[a].value;
        } else {
          attrib.value = messageContents.attributes[a].value;
        }
      }
      this.attributes.push(attrib);
    }
  }
function ( args ) { //console.log('PutModel messageContents: json  ' + JSON.stringify(messageContents)); Model . call ( this , args ) ; this . modelType = messageContents . modelType ; this . attributes = [ ] ; var a , attrib , v ; for ( a in messageContents . attributes ) { //console.log('PutModel Attribute: json  ' + JSON.stringify(messageContents.attributes[a])); if ( messageContents . attributes [ a ] . type == 'Model' ) { v = new Attribute . ModelID ( createModelFromModelType ( messageContents . attributes [ a ] . modelType ) ) ; v . value = messageContents . attributes [ a ] . value . value ; if ( messageContents . attributes [ a ] . value . name ) v . name = messageContents . attributes [ a ] . value . name ; attrib = new Attribute ( { name : messageContents . attributes [ a ] . name , type : 'Model' , value : v } ) ; } else if ( messageContents . attributes [ a ] . type == 'Date' ) { attrib = new Attribute ( messageContents . attributes [ a ] . name , messageContents . attributes [ a ] . type ) ; try { attrib . value = messageContents . attributes [ a ] . value === null ? null : new Date ( messageContents . attributes [ a ] . value ) ; } catch ( e ) { attrib . value = null ; } } else { attrib = new Attribute ( messageContents . attributes [ a ] . name , messageContents . attributes [ a ] . type ) ; if ( attrib . name == 'id' ) { // TODO only If mongo! or refactor mongo to normalize IDs if ( attrib . value != messageContents . attributes [ a ] . value ) attrib . value = messageContents . attributes [ a ] . value ; } else { attrib . value = messageContents . attributes [ a ] . value ; } } this . attributes . push ( attrib ) ; } }
create proxy for client model
create proxy for client model