{"size": 632, "ext": "js", "max_stars_repo_path": "static/js/services/xml-form.js", "max_stars_repo_name": "KailashUpadhyaya/systemedic", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "static/js/services/xml-form.js", "max_issues_repo_name": "KailashUpadhyaya/systemedic", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "static/js/services/xml-form.js", "max_forks_repo_name": "KailashUpadhyaya/systemedic", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.3076923077, "max_line_length": 81, "alphanum_fraction": 0.539556962}
angular.module('inboxServices').factory('XmlForm',
  function(
    DB
  ) {

    'use strict';
    'ngInject';

    return function(internalId, options) {
      options = options || {};
      options.key = internalId;
      return DB()
        .query('medic-client/forms', options)
        .then(function(result) {
          if (!result.rows.length) {
            throw new Error('No form found for internalId: ', internalId);
          }
          if (result.rows.length > 1) {
            throw new Error('Multiple forms found for internalId: ', internalId);
          }
          return result.rows[0];
        });
    };
  }
);
