Example #1
0
function Project(root) {
    this.root = root;
    var project_json_path = path.join (root, project_json);
    var project_json_contents;

    try {
        project_json_contents = fs.readFileSync (project_json_path, "utf-8");
    }
    catch (e) {
        console.warn("Error loading '" + project_json_path + "': " + e);
        process.exit(-1);
    }

    try {
        this.config = JSON.parse (project_json_contents);
    }
    catch (e) {
        try {
            jsonlint.parse(project_json_contents);
            console.warn("shouldn't have gotten here..");
        }
        catch (linte) {
            console.log(linte);
        }
        process.exit(-1);
    }
}
    var translations = function (locale, sourceFile, destFile, success) {
      var contents = JSON.stringify(grunt.file.readJSON(sourceFile));

      if (options.lint || options.lintinput) {
        jsonlint.parse(contents);
      }

      request.post({
        url: options.endpoint,
        form: {
          locale: locale,
          json: contents
        }
      }, function(err, res, body) {
        if (err) grunt.fail.fatal(err);

        if (+res.statusCode === 200) {
          grunt.log.ok('got data for '+options.locale);

          if (options.lint || options.lintoutput) {
            jsonlint.parse(body);
          }

          grunt.file.write(destFile, body);
          grunt.log.ok('wrote contents to destination', destFile);
          return success();
        }

        console.log(res.statusCode);
        grunt.fail.fatal('Request to language portal failed');
      });
    };
Example #3
0
var CosmosManager = function(opts) {
    this.opts = opts || {resources: {}};
    if (!this.opts.resources) {
        this.opts.resources = {};
    }

    // opts.dirs is only supported in node.js
    if (this.opts.dirs) {
        var jsonlint = require('jsonlint');
        var fs = require('fs');
        var dirs = this.opts.dirs;
        for (var i = 0; i < dirs.length; i++) {
            var dir = fs.realpathSync(dirs[i]),
                execSync = require('exec-sync'),
                stdout =  execSync('find ' + dir + ' | grep .json$'),
                fileList = stdout.split('\n');
            for (var j = 0; j < fileList.length; j++) {
                var fileName = fileList[j].substring(dir.length + 1),
                    fileContents = fs.readFileSync(dir + '/' + fileName, "utf8");
                try {
                    this.opts.resources[fileName] = jsonlint.parse(fileContents);
                } catch (e) {
                    console.log('failed parsing ' + fileName + ' : ' + e);
                }
            }
        }
    }

    this.thingPlanHelper = new ThingPlanHelper({
        cosmosManager: this
    });

};
	 	fs.readFile(bundleListPath, 'utf8', function (err, data) {
	 		if (err) {
	 			log.info('error reading _bundleList:', err,
	 				'; clientID:', wsConnect.connectionID,
	 				'; clientIP:', wsConnect._socket.remoteAddress);

				// handle wrong user name
				deferred.reject();
				return;
			} else {
				log.info('found _bndlList.json for user: ', username, ' in: ', wsConnect.upgradeReq.url,
					'; clientID:', wsConnect.connectionID,
					'; clientIP:', wsConnect._socket.remoteAddress);

				var parsedData;
				// safely parse data:
				try {
					parsedData = jsonlint.parse(data);
				} catch (e) {
					log.info('failed to parse bundle list for user: ', username, ' in: ', wsConnect.upgradeReq.url,
						'; clientID:', wsConnect.connectionID,
						'; clientIP:', wsConnect._socket.remoteAddress);
					deferred.reject();
					return;
				}

				deferred.resolve({
					parsedData: parsedData,
					path: bundleListPath
				});
			}
		});
    checkAgreement: function (modelId, syntax, res, data) {

        if (data.content === "") {

            // Nothing to do
            res.json(new responseModel('OK', null, null, null));

        } else {

            switch (syntax) {

                case 'json':

                    try {

                        let agreement = jsonlint.parse(data.content);
                        var model = new AgreementModel(agreement);
                        let isValid = model.validate();

                        if (isValid) {
                            res.json(new responseModel('OK', null, null, null));
                        } else {
                            let annotations = [new annotation('error', 0, 0, agreementValidationErrorToString(model.validationErrors[0]))];
                            res.json(new responseModel('OK_PROBLEMS', null, null, annotations));
                        }

                    } catch (e) {
                        var row = e.toString().split("line ")[1].split(":")[0];
                        var annotations = [new annotation('error', parseInt(row) - 1 + '', '1', e.toString())]
                        res.json(new responseModel('OK_PROBLEMS', null, null, annotations));
                    }

                    break;

                case 'yaml':

                    try {

                        let agreement = yaml.safeLoad(data.content, 'utf8');
                        var model = new AgreementModel(agreement);
                        let isValid = model.validate();

                        if (isValid) {
                            res.json(new responseModel('OK', null, null, null));
                        } else {
                            let annotations = [new annotation('error', 0, 0, agreementValidationErrorToString(model.validationErrors[0]))];
                            res.json(new responseModel('OK_PROBLEMS', null, null, annotations));
                        }

                    } catch (e) {
                        var annotations = [new annotation('error', e.mark.line, e.mark.column, e.reason)];
                        res.json(new responseModel('OK_PROBLEMS', null, null, annotations));
                    }

                    break;

            }
        }
    },
Example #6
0
		grunt.file.expand({}, ["files/data/artists/*.json", "files/data/sites/"+grunt.config.get('site_name')+"/posts.json"]).forEach(function(f) {
			try {
				if (!grunt.file.exists(f)) {
					throw "JSON source file "+f+" not found.";
				} else {
					var fragment;

					try {
						var withComments = grunt.file.read(f),
						    without = stripJsonComments(withComments),
						    linted = jsonlint.parse(without);

						fragment = {
							dir: '',
							// Attach comment-less JSON
							json: linted
						};

						// Start a top level
						var currentDir = json;

						// Remove the path to the container, and the .json extension
						var path = f.replace(f.base + '/', '').replace('.json', '');

						var test = true;
						while (test) {
							var _path = path,
							    _currentDir = currentDir;

							if(!_currentDir['artists']) _currentDir['artists'] = {};
							if(!_currentDir['posts'])   _currentDir['posts'] = {};

							// If the is a slash, we have a parent folder
							var firstSlash = _path.lastIndexOf('/');
							if (firstSlash > -1) {
								path = _path.slice(firstSlash + 1);
								test = true;
								continue;
							}

							if(f.indexOf('artists') === -1) {
								//posts

								_currentDir[path] = fragment.json;
							} else {
								//artists
								_currentDir['artists'][path] = fragment.json;
							}
							test = false;
						}
					} catch (e)	{
						grunt.fail.warn(e);
					}
				}
			} catch (e)	{
				grunt.fail.warn(e);
			}
		});
Example #7
0
 fs.readFile(jsonFileName, 'utf8', function (err, data) {
   if (err) return appError(err, res);   
   try {
     options = jsonlint.parse(data);
     renderJade(options);
   } catch (err) {
       err.file = jsonFileName;
       return appError(err, res);   
   }
   console.log('res: ' + jsonFileName);
 });
Example #8
0
function checkJSON(file) {
	try {
		var content = fs.readFileSync(file, "utf8");
		
		jsonlint.parse(content);
		
		return false;
	} catch (e) {
		return e;
	}
}
 .forEach(function (filename) {
     try {
         var data = fs.readFileSync(filename).toString();
         jsonlint.parse(data);
         ajv.addSchema(JSON.parse(data), path.basename(filename));
     }
     catch(err) {
         console.error('fail to add schema: ' + filename);
         throw err;
     }
 })
Example #10
0
/**
 * We convert all configuration file configs to an object with configuration per
 * type. This makes configs universal.
 */
export default function parseConfigurations(
  template: string,
  configurationFiles: ConfigurationFiles,
  resolveModule: (path: string) => ?{ code: string },
  sandbox?: Sandbox
) {
  const configurations = {};

  const paths = Object.keys(configurationFiles);

  for (let i = 0; i < paths.length; i++) {
    const path = paths[i];
    const module = resolveModule(path);
    const configurationFile = configurationFiles[path];

    let baseObject = {
      path,
    };
    let code = null;

    if (module) {
      code = module.code;
    } else if (configurationFile.getDefaultCode) {
      code = configurationFile.getDefaultCode(template, resolveModule);
      baseObject = { ...baseObject, generated: true };
    } else if (sandbox && configurationFile.generateFileFromSandbox) {
      code = configurationFile.generateFileFromSandbox(sandbox);
      baseObject = { ...baseObject, generated: true };
    }

    baseObject = {
      ...baseObject,
      code,
    };

    if (code) {
      try {
        const parsed = parse(code);

        configurations[configurationFile.type] = {
          ...baseObject,
          parsed,
        };
      } catch (e) {
        configurations[configurationFile.type] = {
          ...baseObject,
          error: e,
        };
      }
    }
  }

  return configurations;
}
Example #11
0
                  return cli.interaction.promptIfNotGiven((param + ": "), paramKeys[param], __cb(_, __frame, 3, 43, function ___(__0, __1) { paramKeys[param] = __1;
                    switch (templateContent.parameters[param].type.toLowerCase()) {
                    case "int": paramKeys[param] = utils.parseInt(paramKeys[param]);
                      break;
                    case "object":

                    
                    case "bool": 
                    case "array": paramKeys[param] = jsonlint.parse(paramKeys[param]);
                      break;
                    }; __then(); }, true)); } else { __then(); } ; })(_); }); }); } else { __then(); } ; })(function __$getTemplateParams() {
Example #12
0
		cj.clean(text, function(err, output) {
			if (!err)	{
				recipe.replaceTextInRange(sel, output);
			} else {
  			try {
          var jsonlint = require("jsonlint");          
          jsonlint.parse(text);
        } catch(exception) {
          Alert.show('Malformed JSON. Please fix and try again: \n ' + exception);
        }				
			}
		});		
Example #13
0
  fs.readFile(filepath, 'utf8', (err, json) => {
    if (err) console.log(err);
    const basename = path.basename(filepath).replace('json', 'js');

    if (jsonlint.parse(json)) {
      const outpath = path.join(dist, basename);
      fs.writeFile(outpath, jsonminify(json, 'utf8'), writeErr => {
        if (writeErr) console.log(writeErr);
        if (cb) cb();
      });
    } else throw new Error(`${basename} is not valid JSON.`);
  });
Example #14
0
    return mapStream(function (file, cb) {
        var errorMessage = '';

        try {
            jsonlint.parse(String(file.contents));
        }
        catch (err) {
            errorMessage = err.message;
        }
        file.jsonlint = formatOutput(errorMessage);

        cb(null, file);
    });
Example #15
0
          deploymentParameters = deploymentParameters.parameters; } ; __then(); } else { return (function __$createDeploymentParameters(__then) {

          if (options.parameters) {
            deploymentParameters = jsonlint.parse(options.parameters); __then(); } else {

            log = cli.output;
            log.info("Supply values for the following parameters");
            return getTemplateParams(cli, subscription, options, __cb(_, __frame, 26, 25, function ___(__0, __3) { paramsRequired = __3;
              deploymentParameters = { };

              return Object.keys(paramsRequired).forEach_(__cb(_, __frame, 29, 32, __then, true), 1, function __1(_, key) { var val; var __frame = { name: "__1", line: 264 }; return __func(_, this, arguments, __1, 0, __frame, function __$__1() {
                  val = { };
                  val["value"] = paramsRequired[key];
                  deploymentParameters[key] = val; _(); }); }); }, true)); } ; })(__then); } ; })(function __$createDeploymentParameters() {
      }, function(err, res, body) {
        if (err) grunt.fail.fatal(err);

        if (+res.statusCode === 200) {
          grunt.log.ok('got data for '+options.locale);

          if (options.lint || options.lintoutput) {
            jsonlint.parse(body);
          }

          grunt.file.write(destFile, body);
          grunt.log.ok('wrote contents to destination', destFile);
          return success();
        }

        console.log(res.statusCode);
        grunt.fail.fatal('Request to language portal failed');
      });
Example #17
0
 }).catch(function(e) {
   if (e instanceof SyntaxError && repoConfig.actions.indexOf(data.action) !== -1) {
     // Syntax error while reading custom configuration file
     var errorLog = '';
     try {
       jsonlint.parse(e.repoConfig)
     } catch(err) {
       errorLog = err;
     }
     var message =
       'Unable to parse mention-bot custom configuration file due to a syntax error.\n' +
       'Please check the potential root causes below:\n\n' +
       '1. Having comments\n' +
       '2. Invalid JSON type\n' +
       '3. Having extra "," in the last JSON attribute\n\n' +
       'Error message:\n' +
       '```\n' + errorLog + '\n```';
     createComment(data, message);
   }
 });
Example #18
0
 fs.readFile('./models/_config.json', 'utf8', function (err, configFile) {
   if (err) return appError(err, res);   
   try {
     var modelConfig = jsonlint.parse(configFile);
     jade.renderFile(jadeFileName, { content:options, config:modelConfig, pretty: config.jade.pretty }, function (err, html) {
       if (err) return appError(err, res);   
       res.setHeader('Content-Type', 'text/html; charset=utf-8');
       res.end(html);
       console.log('res: ' + jadeFileName);
       console.log('res: ' + localFolder + fileName);
       fs.writeFile(localFolder + fileName, html, function (err) {
         if (err) throw err;
         console.log(localFolder + fileName + ' saved!');
       });
     });
   } catch (err) {
       err.file = 'models/_config.json';
       return appError(err, res);   
   }
 });
Example #19
0
        fs.readFile('./resume.json', function(resumeJsonDoesNotExist, data) {
            if (resumeJsonDoesNotExist) {
                if (['export', 'publish', 'test'].indexOf(process.argv[2]) !== -1) { // removed serve. test this later
                    console.log('There is no resume.json file located in this directory');
                    console.log('Type: `resume init` to initialize a new resume');
                    return;
                }

                var resumeJson = false;
                callback(null, results);
            } else {
                try {
                    jsonlint.parse(String(data));
                    var resumeJson = JSON.parse(data);
                    results.resumeJson = resumeJson;
                    callback(null, results);
                } catch (error) {
                    console.log(error);
                }
            }
        });
Example #20
0
      lint: editor => {
        const path = editor.getPath();
        const text = editor.getText();

        try {
          jsonlint.parse(text);
        } catch (error) {
          const message = error.message;
          const line = Number(message.match(this.regex)[1]);
          const column = 0;

          return Promise.resolve([{
            type: 'Error',
            text: error.message,
            filePath: path,
            range: new Range([line, column], [line, column + 1])
          }]);
        }

        return Promise.resolve([]);
      }
    check: function (modelId, syntax, res, data) {

        if (modelId === "agreement") {

            this.checkAgreement(modelId, syntax, res, data);

        } else {

            switch (syntax) {

                case 'json':

                    try {
                        jsonlint.parse(data.content);
                        res.json(new responseModel('OK', null, null, null));
                    } catch (e) {
                        var row = e.toString().split("line ")[1].split(":")[0];
                        var annotations = [new annotation('error', parseInt(row) - 1 + '', '1', e.toString())]
                        res.json(new responseModel('OK_PROBLEMS', null, null, annotations));
                    }

                    break;

                case 'yaml':

                    try {
                        yaml.safeLoad(data.content, 'utf8');
                        res.json(new responseModel('OK', null, null, null));
                    } catch (e) {
                        var annotations = [new annotation('error', e.mark.line, e.mark.column, e.reason)];
                        res.json(new responseModel('OK_PROBLEMS', null, null, annotations));
                    }

                    break;

            }
        }

    },
Example #22
0
var getApi = function(apiName) {
    console.log(apiName);

    var path = "./frontend/api/" + apiName + ".json";
    var ret = [];
    var apiData = fs.readFileSync(path, "utf8");


    try {
        ret = jsonlint.parse(apiData);
    } catch(e) {
        console.log(e);
    }
    if (ret.examples) {
        ret = ret.examples;
        return ret;
    }

//    console.log("ret", ret);

    return false;
};
Example #23
0
function checkPackConfig(content) {
	var config = [], out = [];
	var lines = content.split("\n");
	var inConfig = false;
	for (var i = 0; i < lines.length; i++) {
		if (lines[i].indexOf("//$ PackConfig") == 0) { inConfig = i; continue; }
		if (lines[i].indexOf("//$!") == 0) { inConfig = 0; continue; }
		
		if (inConfig) {
			config.push(lines[i]);
		} else {
			out.push(lines[i]);
		}
	}
	if (inConfig) throw new Error("PackConfig does not close properly!");
	
	if (config.length) { //the PackConfig may have been commented out
		jsonlint.parse(config.join("\n"));
	}
	
	return out.join("\n");
}
Example #24
0
      return _(new Error($("Either --parameters or --parameters-file need to be specified. Not both."))); } ; return (function __$createDeploymentParameters(__then) {



      if (options.parametersFile) {
        jsonFile = fs.readFileSync(options.parametersFile, "utf8");
        deploymentParameters = jsonlint.parse(utils.stripBOM(jsonFile));

        if (deploymentParameters.parameters) {
          deploymentParameters = deploymentParameters.parameters; } ; __then(); } else { return (function __$createDeploymentParameters(__then) {

          if (options.parameters) {
            deploymentParameters = jsonlint.parse(options.parameters); __then(); } else {

            log = cli.output;
            log.info("Supply values for the following parameters");
            return getTemplateParams(cli, subscription, options, __cb(_, __frame, 26, 25, function ___(__0, __3) { paramsRequired = __3;
              deploymentParameters = { };

              return Object.keys(paramsRequired).forEach_(__cb(_, __frame, 29, 32, __then, true), 1, function __1(_, key) { var val; var __frame = { name: "__1", line: 264 }; return __func(_, this, arguments, __1, 0, __frame, function __$__1() {
                  val = { };
                  val["value"] = paramsRequired[key];
                  deploymentParameters[key] = val; _(); }); }); }, true)); } ; })(__then); } ; })(function __$createDeploymentParameters() {
all_files_array.forEach(function (templateFile, index) {

    var	template_file_data = fs.readFileSync(templateFile, {encoding : 'utf8'});
	var generated_JSON_data = dummyjson.parse(template_file_data);

    // Checking if there is an error in the generated JSON.
    // If there is error that means the original template is having error.
    try {
        // Validating the generated J
        jsonlint.parse(generated_JSON_data);

        writeToFile(templateFile, generated_JSON_data);

        console.log('Converting %d/%d', index + 1, index + 1);
        if (all_files_array.length - 1 == index) {
            console.log("Completed Converting All Files To JSON");
        };

    } catch (err) {

        console.log("\n\nThere is an error in the template '" + templateFile + "'\nPlease correct the below error and re-run the converstion");
        console.log(err + "\n\n");  
    }    
});
	fs.readFile(bundleListPath, 'utf8', function (err, data) {
		if (err) {
			main.sendMessage(wsConnect, mJSO.callbackID, false, 'Invalid auth' +
				' token');
		} else {

			main.log.info('Accepting auth token:', authToken, 'in:', wsConnect.path2db,
				'; clientID:', wsConnect.connectionID,
				'; clientIP:', wsConnect._socket.remoteAddress);

			try {
				// safely parse data:
				var parsedData = jsonlint.parse(data);
				wsConnect.bndlList = parsedData;
				wsConnect.bndlListPath = bundleListPath;
				wsConnect.authorised = true;

				main.sendMessage(wsConnect, mJSO.callbackID, true, '', 'NO');
			} catch (error) {
				main.sendMessage(wsConnect, mJSO.callbackID, false, 'Error' +
					' parsing _bundleList.json: ' + error);
			}
		}
	});
Example #27
0
function processRequest(request, response, serverManifestFilename, subpath, data) {
    try {
        var manifest = JSON.parse(data);
    } catch (err) {
        try {
            manifest = jsonlint.parse(data);
        } catch (err) {
            console.error(err);
            return httpInternalError(response);
        }
    }

    // set defaults where needed
    if (manifest.dashManifest == undefined) {
        manifest.dashManifest = { file: 'stream.mpd'};
    }
    if (manifest.smoothManifest == undefined) {
        manifest.smoothManifest = { file: 'stream.ismc'};
    }

    // serve the DASH manifest
    if (manifest.dashManifest) {
        if (subpath == (manifest.dashManifest.url || "mpd")) {
            response.setHeader('Content-Type', 'application/dash+xml');
            send(request, manifest.dashManifest.file)
                .root(path.dirname(serverManifestFilename))
                .pipe(response);
            return;
        }
    }

    // serve the Smooth manifest
    if (manifest.smoothManifest) {
        if (subpath == (manifest.smoothManifest.url || "Manifest")) {
            response.setHeader('Content-Type', 'application/vnd.ms-sstr+xml');
            send(request, manifest.smoothManifest.file)
                .root(path.dirname(serverManifestFilename))
                .pipe(response);
            return;
        }
    }

    for (var i=0; i<manifest.media.length; i++) {
        for (var j=0; j<manifest.media[i].mediaSegments.urls.length; j++) {
            var match = subpath.match(manifest.media[i].mediaSegments.urls[j].pattern);
            if (match) {
                var fields = manifest.media[i].mediaSegments.urls[j].fields;
                var requestFields = {};
                if (fields && match.length-1 >= fields.length) {
                    for (var x=0; x<fields.length; x++) {
                        requestFields[fields[x]] = match[x+1];
                    }
                }

                // parse the MP4 file to get the index
                mp4.parse(path.join(path.dirname(serverManifestFilename), manifest.media[i].mediaSegments.file), function(err, mp4Index) {
                    if (err) {
                        console.error(err);
                        return httpNotFound(response);
                    }
                    if (mp4Index) {
                        // look for the requested track ID
                        for (var x=0; x<mp4Index.length; x++) {
                            if (mp4Index[x].trackId == manifest.media[i].trackId) {
                                // look for the entry by time
                                for (var z=0; z<mp4Index[x].entries.length; z++) {
                                    if (mp4Index[x].entries[z].time == requestFields.time) {
                                        // found it!
                                        var startOffset = mp4Index[x].entries[z].moofOffset;
                                        var endOffset;
                                        if (z < mp4Index[x].entries.length-1) {
                                            // not the last segment
                                            endOffset = mp4Index[x].entries[z+1].moofOffset;
                                        }
                                        var sendOptions = {start: startOffset, end: endOffset};
                                        send(request, manifest.media[i].mediaSegments.file, sendOptions)
                                            .root(path.dirname(serverManifestFilename))
                                            .pipe(response);
                                        return;
                                    }
                                }
                            }
                        }
                    }
                    return httpNotFound(response);
                });
                return;
            }
        }
        if (manifest.media[i].initSegment) {
            match = subpath.match(manifest.media[i].initSegment.url || manifest.media[i].initSegment.file);
            if (match) {
                response.setHeader('Content-Type', 'video/mp4');
                send(request, manifest.media[i].initSegment.file)
                    .root(path.dirname(serverManifestFilename))
                    .pipe(response);
                return;
            }
        }
    }

    return httpNotFound(response);
}
Example #28
0
var demoFile = './js/load.js';
var mdRend = new marked.Renderer();

rendCode = mdRend.code;
mdRend.code = function(code, lang){
  var button = '';

  if( lang === 'js' ){
    button = '<button class="run run-inline-code"><span class="icon-play"></span></button>';
  }

  return rendCode.call(this, code, lang) + button;
};

try {
  jsonlint.parse( fs.readFileSync(configFile, 'utf8') ); // validate first for convenience
  config = require( configFile );
} catch(e){
  console.error('\n`' + configFile + '` could not be read; check the JSON is formatted correctly via jsonlint');
  throw e;
}

// load the demo file
try {
  config.demojs = fs.readFileSync(demoFile, 'utf8');

  config.demojs = config.demojs.match(/\/\/\<demo\>\s*((?:\s|.)+?)\s*\/\/\<\/demo\>/)[1];

  config.demojs = hljs.highlight('js', config.demojs).value;
} catch(e){
  throw '`' + demoFile + '` could not be read and parsed: ' + e;
Example #29
0
          content = utils.stripBOM(fs.readFileSync(templateFile)); } ; __then(); } ; })(function __$getTemplateContent() {


      return _(null, jsonlint.parse(content)); }); });};
Example #30
0
var Words = require('elegant-words');
var fs = require('fs');
var jsonlint = require("jsonlint");

var words = new Words();

var jsontext = fs.readFileSync("./blurbs/blurbs.json");
var json = jsonlint.parse(jsontext.toString());
words.loadJSONModel( json );

var namestext = fs.readFileSync("./blurbs/names.txt");
var names = parseKeyValueText( namestext.toString() );
words.loadJSONModel( names );

var image = null;

var banList = ["macaroni and cheese","icky green","dark","barny"];

words.extendModel( 'COLOUR' , function(){
  var c = removeTerms(image.terms["color"],banList);
  if ( !c || c.length == 0){
    c = removeTerms(image.terms['set-color'],banList);
  }
  return c;
});
words.extendModel( 'POINTSET' , function(){
  return image.terms["pointset"];
});
words.extendModel( 'SHAPE' , function(){
  return image.terms["shape"];
});