Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openmrs/angularjs-openmrs-api

Package Overview
Dependencies
Maintainers
4
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openmrs/angularjs-openmrs-api - npm Package Compare versions

Comparing version 0.6.2 to 0.7.0

238

lib/index.js

@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

root["angularjs-openmrs-api"] = factory(root["angular"], root["angular-resource"], root["angular-translate"], root["angular-translate-loader-url"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_6__) {
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_6__) {
return /******/ (function(modules) { // webpackBootstrap

@@ -82,8 +82,2 @@ /******/ // The module cache

/* 0 */
/***/ (function(module, exports) {
module.exports = require("angular");
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

@@ -98,3 +92,3 @@

var _angular = __webpack_require__(0);
var _angular = __webpack_require__(1);

@@ -121,39 +115,70 @@ var _angular2 = _interopRequireDefault(_angular);

*/
exports.default = _angular2.default.module('angularjs-openmrs-api-rest', ['ngResource']).factory("openmrsContext", openmrsContext).factory('openmrsApi', openmrsApi).factory('authInterceptor', authInterceptor).config(httpProviderConfig).provider('openmrsRest', openmrsRest).name;
exports.default = _angular2.default.module('angularjs-openmrs-api-rest', ['ngResource']).value('openmrsContextConfig', {}).factory('openmrsContext', openmrsContext).factory('openmrsApi', openmrsApi).factory('authInterceptor', authInterceptor).config(httpProviderConfig).provider('openmrsRest', openmrsRest).name;
openmrsContext.$inject = ['$window'];
function openmrsContext($window) {
var config = {};
openmrsContext.$inject = ['$http', '$q', '$window', 'openmrsContextConfig'];
function openmrsContext($http, $q, $window, openmrsContextConfig) {
function handleNoConfig() {
setBaseAppPath('/owa/');
}
function setBaseAppPath(url) {
var path = $window.location.pathname;
path = path.substring(0, path.indexOf(url));
if (path.endsWith("/")) {
path = path.substring(0, path.length - 1);
}
openmrsContextConfig.href = path;
}
function getConfig() {
return config;
var deferred = $q.defer();
if (_angular2.default.isDefined(openmrsContextConfig.href)) {
deferred.resolve(openmrsContextConfig);
} else if (typeof OPENMRS_CONTEXT_PATH !== 'undefined') {
openmrsContextConfig.href = OPENMRS_CONTEXT_PATH;
deferred.resolve(openmrsContextConfig);
} else {
$http.get('manifest.webapp').then(function (response) {
if (response.data.activities.openmrs.testConfig) {
openmrsContextConfig.href = response.data.activities.openmrs.testConfig.href;
openmrsContextConfig.test = true;
$http.defaults.headers.common['Disable-WWW-Authenticate'] = false;
$http.defaults.withCredentials = true;
deferred.resolve(openmrsContextConfig);
} else {
handleNoConfig();
deferred.resolve(openmrsContextConfig);
}
}, function (error) {
handleNoConfig();
deferred.resolve(openmrsContextConfig);
});
}
return deferred.promise;
}
return {
getConfig: getConfig
getConfig: getConfig,
setBaseAppPath: setBaseAppPath
};
}
authInterceptor.$inject = ['$q', '$window', 'openmrsContext'];
function authInterceptor($q, $window, openmrsContext) {
authInterceptor.$inject = ['$q', '$window', 'openmrsContextConfig'];
function authInterceptor($q, $window, openmrsContextConfig) {
return {
responseError: function responseError(response) {
if (!openmrsContext.getConfig.test && (response.status === 401 || response.status === 403)) {
var redirectUrl = $window.location.href;
redirectUrl = redirectUrl.replace('#', '_HASHTAG_');
if (!openmrsContextConfig.test && (response.status === 401 || response.status === 403)) {
if ($window.confirm("The operation cannot be completed, because you are no longer logged in. Do you want to go to login page?")) {
var url = $window.location.href;
url = url.replace('#', '_HASHTAG_');
url = url.slice(url.indexOf("/openmrs"));
var loginUrl;
if (_angular2.default.isDefined(openmrsContext.getConfig().href)) {
loginUrl = openmrsContext.getConfig().href;
} else {
var pathname = $window.location.pathname;
pathname = getBasePath(pathname);
loginUrl = pathname;
}
var loginUrl = loginUrl + '/login.htm?redirect_url=' + url;
var loginUrl = openmrsContextConfig.href + '/login.htm?redirect_url=' + redirectUrl;
$window.location.href = loginUrl;
}
}
return $q.reject(response);

@@ -165,3 +190,2 @@ }

httpProviderConfig.$inject = ['$httpProvider'];
function httpProviderConfig($httpProvider) {

@@ -176,50 +200,4 @@ $httpProvider.interceptors.push('authInterceptor');

openmrsApi.$inject = ['$resource', '$window', '$http', '$q', 'openmrsContext'];
function openmrsApi($resource, $window, $http, $q, openmrsContext) {
function getOpenmrsContextConfig() {
var openmrsContextConfig = openmrsContext.getConfig();
var deferred = $q.defer();
function handleNoTestConfig() {
var pathname = $window.location.pathname;
openmrsContextConfig.href = getBasePath(pathname);
deferred.resolve(openmrsContextConfig);
}
/**
* if server adress is undefined yet, try to get test server href.
* If manifest.webapp doesn't exist, or it doesn't include testConfig,
* then invoke handleNoTestConfig, to get adress from current location.
*/
if (_angular2.default.isUndefined(openmrsContextConfig.href)) {
$http.get('manifest.webapp').then(function successCallback(response) {
if (response.data.activities.openmrs.testConfig) {
openmrsContextConfig.href = response.data.activities.openmrs.testConfig.href;
openmrsContextConfig.test = true;
$http.defaults.headers.common['Disable-WWW-Authenticate'] = false;
$http.defaults.withCredentials = true;
deferred.resolve(openmrsContextConfig);
} else {
handleNoTestConfig();
}
}, handleNoTestConfig);
} else {
deferred.resolve(openmrsContextConfig);
}
return deferred.promise;
}
function setBaseAppPath(url) {
var path = url;
path = $window.location.pathname;
path = path.substring(0, path.indexOf(url));
if (path.endsWith("/")) {
path = path.substring(0, path.length - 1);
}
var openmrsContextConfig = openmrsContext.getConfig();
openmrsContextConfig.href = path;
}
openmrsApi.$inject = ['$resource', '$q', 'openmrsContext'];
function openmrsApi($resource, $q, openmrsContext) {
var openmrsApi = {

@@ -229,5 +207,3 @@ defaultConfig: {

},
add: add,
getOpenmrsContextConfig: getOpenmrsContextConfig,
setBaseAppPath: setBaseAppPath
add: add
};

@@ -239,3 +215,3 @@

var deferred = $q.defer();
getOpenmrsContextConfig().then(function (openmrsContextConfig) {
openmrsContext.getConfig().then(function (openmrsContextConfig) {
var params, url;

@@ -279,4 +255,4 @@

get: provideGet,
$get: ['openmrsApi', '$document', '$q', function (openmrsApi, $document, $q) {
return provideOpenmrsRest(openmrsApi, $document, $q);
$get: ['openmrsApi', '$document', '$q', 'openmrsContext', function (openmrsApi, $document, $q, openmrsContext) {
return provideOpenmrsRest(openmrsApi, $document, $q, openmrsContext);
}]

@@ -297,3 +273,3 @@ };

function provideOpenmrsRest(openmrsApi, $document, $q) {
function provideOpenmrsRest(openmrsApi, $document, $q, openmrsContext) {
var openmrsRest = {

@@ -320,3 +296,3 @@ list: list,

var deferred = $q.defer();
openmrsApi.getOpenmrsContextConfig().then(function (openmrsContextConfig) {
openmrsContext.getConfig().then(function (openmrsContextConfig) {
deferred.resolve(openmrsContextConfig.href);

@@ -328,3 +304,3 @@ });

function setBaseAppPath(url) {
openmrsApi.setBaseAppPath(url);
openmrsContext.setBaseAppPath(url);
}

@@ -477,2 +453,8 @@

/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = require("angular");
/***/ }),
/* 2 */

@@ -496,4 +478,13 @@ /***/ (function(module, exports, __webpack_require__) {

var _openmrsRest = __webpack_require__(0);
var _openmrsRest2 = _interopRequireDefault(_openmrsRest);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = angular.module('angularjs-openmrs-api-translate', ['pascalprecht.translate', _openmrsRest2.default]).factory('openmrsTranslateLoader', openmrsTranslateLoader).provider('openmrsTranslate', openmrsTranslateProvider).name;
/**
* Loads translations from a file using translateUrlLoader. It fetches server url from openmrsRest.
*/
/*

@@ -508,4 +499,15 @@ * This Source Code Form is subject to the terms of the Mozilla Public License,

*/
exports.default = angular.module('angularjs-openmrs-api-translate', ['pascalprecht.translate']).provider('openmrsTranslate', openmrsTranslateProvider).name;
openmrsTranslateLoader.$inject = ['$translateUrlLoader', 'openmrsRest'];
function openmrsTranslateLoader($translateUrlLoader, openmrsRest) {
return function (options) {
var serverUrl = openmrsRest.getServerUrl();
serverUrl.then(function (serverUrl) {
options.url = serverUrl + '/module/uicommons/messages/messages.json';
options.queryParameter = 'localeKey';
return $translateUrlLoader(options);
});
return serverUrl;
};
}

@@ -516,7 +518,3 @@ openmrsTranslateProvider.$inject = ['$translateProvider'];

function init() {
var contextPath = getContextPath();
$translateProvider.fallbackLanguage('en').preferredLanguage('en').useUrlLoader('/' + contextPath + '/module/uicommons/messages/messages.json', {
queryParameter: 'localeKey'
}).useSanitizeValueStrategy('escape') // see http://angular-translate.github.io/docs/#/guide/19_security
$translateProvider.fallbackLanguage('en').preferredLanguage('en').useLoader('openmrsTranslateLoader').useSanitizeValueStrategy('escape') // see http://angular-translate.github.io/docs/#/guide/19_security
.forceAsyncReload(true); // this line is what allows use to merge the list of statistically-defined locations with those loaded via URL, see https://angular-translate.github.io/docs/#/guide/12_asynchronous-loading

@@ -535,17 +533,7 @@ }

function getContextPath() {
if (typeof OPENMRS_CONTEXT_PATH === 'undefined') {
return 'openmrs';
} else {
return OPENMRS_CONTEXT_PATH;
}
}
function provideOpenmrsTranslate($translate, $http, $q, openmrsRest) {
var language;
function provideOpenmrsTranslate($translate, $http) {
function init() {
$http.get('/' + getContextPath() + '/ws/rest/v1/session').then(function (response) {
if (response.data['locale'] != null && response.data['locale']['language'] != null) {
$translate.use(response.data['locale']['language']);
}
});
getLanguage();
}

@@ -555,5 +543,6 @@

function changeLanguage(key) {
function setLanguage(key) {
$translate.use(key);
$http.post('/' + getContextPath() + '/ws/rest/v1/session', { 'locale': key }).then(function (response) {
//using create and not update since session is a singleton without a uuid
openmrsRest.create('session', { 'locale': key }).then(function () {
console.log("Locale changed to " + key);

@@ -563,4 +552,27 @@ });

function getLanguage() {
var deferred = $q.defer();
if (angular.isDefined(language)) {
deferred.resolve(language);
} else {
openmrsRest.get('session').then(function (response) {
if (response['locale'] != null && response['locale']['language'] != null) {
language = response['locale']['language'];
$translate.use(language);
} else {
language = $translate.use();
}
deferred.resolve(language);
}, function (error) {
language = $translate.use();
deferred.resolve(language);
});
}
return deferred.promise;
}
return {
changeLanguage: changeLanguage
changeLanguage: setLanguage,
setLanguage: setLanguage,
getLanguage: getLanguage
};

@@ -571,3 +583,3 @@ }

addTranslations: addTranslations,
$get: ['$translate', '$http', provideOpenmrsTranslate]
$get: ['$translate', '$http', '$q', 'openmrsRest', provideOpenmrsTranslate]
};

@@ -587,7 +599,7 @@ }

var _angular = __webpack_require__(0);
var _angular = __webpack_require__(1);
var _angular2 = _interopRequireDefault(_angular);
var _openmrsRest = __webpack_require__(1);
var _openmrsRest = __webpack_require__(0);

@@ -594,0 +606,0 @@ var _openmrsRest2 = _interopRequireDefault(_openmrsRest);

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("angular"),require("angular-resource"),require("angular-translate"),require("angular-translate-loader-url")):"function"==typeof define&&define.amd?define("angularjs-openmrs-api",["angular","angular-resource","angular-translate","angular-translate-loader-url"],n):"object"==typeof exports?exports["angularjs-openmrs-api"]=n(require("angular"),require("angular-resource"),require("angular-translate"),require("angular-translate-loader-url")):e["angularjs-openmrs-api"]=n(e.angular,e["angular-resource"],e["angular-translate"],e["angular-translate-loader-url"])}(this,function(e,n,r,t){return function(e){function n(t){if(r[t])return r[t].exports;var u=r[t]={i:t,l:!1,exports:{}};return e[t].call(u.exports,u,u.exports,n),u.l=!0,u.exports}var r={};return n.m=e,n.c=r,n.i=function(e){return e},n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=3)}([function(e,n){e.exports=require("angular")},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function u(e){function n(){return r}var r={};return{getConfig:n}}function a(e,n,r){return{responseError:function(t){if(!r.getConfig.test&&(401===t.status||403===t.status)&&n.confirm("The operation cannot be completed, because you are no longer logged in. Do you want to go to login page?")){var u=n.location.href;u=u.replace("#","_HASHTAG_"),u=u.slice(u.indexOf("/openmrs"));var a;if(d.default.isDefined(r.getConfig().href))a=r.getConfig().href;else{var o=n.location.pathname;o=i(o),a=o}var a=a+"/login.htm?redirect_url="+u;n.location.href=a}return e.reject(t)}}}function o(e){e.interceptors.push("authInterceptor"),e.defaults.headers.common["Disable-WWW-Authenticate"]="true"}function i(e){return e.substring(0,e.indexOf("/owa/"))}function s(e,n,r,t,u){function a(){function e(){var e=n.location.pathname;a.href=i(e),o.resolve(a)}var a=u.getConfig(),o=t.defer();return d.default.isUndefined(a.href)?r.get("manifest.webapp").then(function(n){n.data.activities.openmrs.testConfig?(a.href=n.data.activities.openmrs.testConfig.href,a.test=!0,r.defaults.headers.common["Disable-WWW-Authenticate"]=!1,r.defaults.withCredentials=!0,o.resolve(a)):e()},e):o.resolve(a),o.promise}function o(e){var r=e;r=n.location.pathname,r=r.substring(0,r.indexOf(e)),r.endsWith("/")&&(r=r.substring(0,r.length-1)),u.getConfig().href=r}function s(n){var r=t.defer();return a().then(function(t){var u,a;if(d.default.isString(n)){n={resource:n,url:"/"+n}}if(n.unnatural)u=n.params,a=t.href+"/ws/rest/v1"+n.url+"/:uuid";else{var o=d.default.copy(l.defaultConfig);u=d.default.extend(o,n.params),a=t.href+"/ws/rest/v1"+n.url+"/:uuid"}var i=n.actions||l.extraActions;l[n.resource]=e(a,u,i),r.resolve(l[n.resource])}),r.promise}var l={defaultConfig:{uuid:"@uuid"},add:s,getOpenmrsContextConfig:a,setBaseAppPath:o};return l}function l(){function e(e,n){return["openmrsRest",function(r){return r.list(e,n)}]}function n(e,n){return["openmrsRest",function(r){return r.get(e,n)}]}function r(e,n,r){function t(){var n=r.defer();return e.getOpenmrsContextConfig().then(function(e){n.resolve(e.href)}),n.promise}function u(n){e.setBaseAppPath(n)}function a(r,t){return e.add(r).then(function(e){return e.get(t).$promise.then(function(e){return new f(e,n)})})}function o(e,n){return n=x(n,"full"),a(e,n)}function i(e,n){return n=x(n,"ref"),a(e,n)}function s(n,r){return e.add(n).then(function(e){return e.get(r).$promise.then(function(e){return e})})}function l(e,n){return n=x(n,"full"),s(e,n)}function c(e,n){return n=x(n,"ref"),s(e,n)}function p(n,r){return e.add(n).then(function(e){return e.save(r).$promise.then(function(e){return e})})}function g(n,r){return e.add(n).then(function(e){return e.save({uuid:r.uuid},r).$promise.then(function(e){return e})})}function m(n,r,t){return e.add(n).then(function(e){return e.remove({uuid:r.uuid,reason:t}).$promise.then(function(e){return e})})}function h(n,r){return e.add(n).then(function(e){return e.save({uuid:r.uuid},{retired:!1}).$promise.then(function(e){return e})})}function v(n,r){var t={uuid:r.uuid};return null==t?t={purge:!0}:d.default.extend(t,{purge:!0}),e.add(n).then(function(e){return e.remove(t).$promise.then(function(e){return e})})}function x(e,n){return null==e?{v:n}:d.default.extend(e,{v:n})}return{list:a,listFull:o,listRef:i,get:s,getFull:l,getRef:c,create:p,update:g,remove:m,retire:m,unretire:h,purge:v,getServerUrl:t,setBaseAppPath:u}}return{list:e,get:n,$get:["openmrsApi","$document","$q",function(e,n,t){return r(e,n,t)}]}}function f(e,n){function r(){return null!=o}function t(){return null!=i}function u(e){var r=n[0].createElement("a");r.href=e;var t=r.search.slice(1).split("&"),u={};return t.forEach(function(e){""!==e&&(e=e.split("="),u[e[0]]=decodeURIComponent(e[1]||""))}),u}var a=e.results,o=null,i=null;return function(){if(null!=e.links)for(var n=0;n<e.links.length;n++){var r=e.links[n];"next"===r.rel?o=u(r.uri):"prev"===r.rel&&(i=u(r.uri))}}(),{results:a,hasNext:r,nextQuery:o,hasPrevious:t,previousQuery:i}}Object.defineProperty(n,"__esModule",{value:!0});var c=r(0),d=t(c),p=r(4);t(p);n.default=d.default.module("angularjs-openmrs-api-rest",["ngResource"]).factory("openmrsContext",u).factory("openmrsApi",s).factory("authInterceptor",a).config(o).provider("openmrsRest",l).name,u.$inject=["$window"],a.$inject=["$q","$window","openmrsContext"],o.$inject=["$httpProvider"],s.$inject=["$resource","$window","$http","$q","openmrsContext"]},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function u(e){function n(n,r){var t=e.translations(n);angular.isDefined(t)||(t={}),e.translations(n,angular.extend(t,r))}function r(){return"undefined"==typeof OPENMRS_CONTEXT_PATH?"openmrs":OPENMRS_CONTEXT_PATH}function t(e,n){function t(t){e.use(t),n.post("/"+r()+"/ws/rest/v1/session",{locale:t}).then(function(e){console.log("Locale changed to "+t)})}return function(){n.get("/"+r()+"/ws/rest/v1/session").then(function(n){null!=n.data.locale&&null!=n.data.locale.language&&e.use(n.data.locale.language)})}(),{changeLanguage:t}}return function(){var n=r();e.fallbackLanguage("en").preferredLanguage("en").useUrlLoader("/"+n+"/module/uicommons/messages/messages.json",{queryParameter:"localeKey"}).useSanitizeValueStrategy("escape").forceAsyncReload(!0)}(),{addTranslations:n,$get:["$translate","$http",t]}}Object.defineProperty(n,"__esModule",{value:!0});var a=r(5),o=(t(a),r(6));t(o);n.default=angular.module("angularjs-openmrs-api-translate",["pascalprecht.translate"]).provider("openmrsTranslate",u).name,u.$inject=["$translateProvider"]},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var u=r(0),a=t(u),o=r(1),i=t(o),s=r(2),l=t(s);n.default=a.default.module("angularjs-openmrs-api",[i.default,l.default]).name},function(e,n){e.exports=require("angular-resource")},function(e,n){e.exports=require("angular-translate")},function(e,n){e.exports=require("angular-translate-loader-url")}])});
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("angular"),require("angular-resource"),require("angular-translate"),require("angular-translate-loader-url")):"function"==typeof define&&define.amd?define("angularjs-openmrs-api",["angular","angular-resource","angular-translate","angular-translate-loader-url"],n):"object"==typeof exports?exports["angularjs-openmrs-api"]=n(require("angular"),require("angular-resource"),require("angular-translate"),require("angular-translate-loader-url")):e["angularjs-openmrs-api"]=n(e.angular,e["angular-resource"],e["angular-translate"],e["angular-translate-loader-url"])}(this,function(e,n,r,t){return function(e){function n(t){if(r[t])return r[t].exports;var u=r[t]={i:t,l:!1,exports:{}};return e[t].call(u.exports,u,u.exports,n),u.l=!0,u.exports}var r={};return n.m=e,n.c=r,n.i=function(e){return e},n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=3)}([function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function u(e,n,r,t){function u(){o("/owa/")}function o(e){var n=r.location.pathname;n=n.substring(0,n.indexOf(e)),n.endsWith("/")&&(n=n.substring(0,n.length-1)),t.href=n}function a(){var r=n.defer();return c.default.isDefined(t.href)?r.resolve(t):"undefined"!=typeof OPENMRS_CONTEXT_PATH?(t.href=OPENMRS_CONTEXT_PATH,r.resolve(t)):e.get("manifest.webapp").then(function(n){n.data.activities.openmrs.testConfig?(t.href=n.data.activities.openmrs.testConfig.href,t.test=!0,e.defaults.headers.common["Disable-WWW-Authenticate"]=!1,e.defaults.withCredentials=!0,r.resolve(t)):(u(),r.resolve(t))},function(e){u(),r.resolve(t)}),r.promise}return{getConfig:a,setBaseAppPath:o}}function o(e,n,r){return{responseError:function(t){var u=n.location.href;if(u=u.replace("#","_HASHTAG_"),!r.test&&(401===t.status||403===t.status)&&n.confirm("The operation cannot be completed, because you are no longer logged in. Do you want to go to login page?")){var o=r.href+"/login.htm?redirect_url="+u;n.location.href=o}return e.reject(t)}}}function a(e){e.interceptors.push("authInterceptor"),e.defaults.headers.common["Disable-WWW-Authenticate"]="true"}function i(e,n,r){function t(t){var o=n.defer();return r.getConfig().then(function(n){var r,a;if(c.default.isString(t)){t={resource:t,url:"/"+t}}if(t.unnatural)r=t.params,a=n.href+"/ws/rest/v1"+t.url+"/:uuid";else{var i=c.default.copy(u.defaultConfig);r=c.default.extend(i,t.params),a=n.href+"/ws/rest/v1"+t.url+"/:uuid"}var s=t.actions||u.extraActions;u[t.resource]=e(a,r,s),o.resolve(u[t.resource])}),o.promise}var u={defaultConfig:{uuid:"@uuid"},add:t};return u}function s(){function e(e,n){return["openmrsRest",function(r){return r.list(e,n)}]}function n(e,n){return["openmrsRest",function(r){return r.get(e,n)}]}function r(e,n,r,t){function u(){var e=r.defer();return t.getConfig().then(function(n){e.resolve(n.href)}),e.promise}function o(e){t.setBaseAppPath(e)}function a(r,t){return e.add(r).then(function(e){return e.get(t).$promise.then(function(e){return new l(e,n)})})}function i(e,n){return n=x(n,"full"),a(e,n)}function s(e,n){return n=x(n,"ref"),a(e,n)}function f(n,r){return e.add(n).then(function(e){return e.get(r).$promise.then(function(e){return e})})}function d(e,n){return n=x(n,"full"),f(e,n)}function p(e,n){return n=x(n,"ref"),f(e,n)}function g(n,r){return e.add(n).then(function(e){return e.save(r).$promise.then(function(e){return e})})}function m(n,r){return e.add(n).then(function(e){return e.save({uuid:r.uuid},r).$promise.then(function(e){return e})})}function h(n,r,t){return e.add(n).then(function(e){return e.remove({uuid:r.uuid,reason:t}).$promise.then(function(e){return e})})}function v(n,r){return e.add(n).then(function(e){return e.save({uuid:r.uuid},{retired:!1}).$promise.then(function(e){return e})})}function $(n,r){var t={uuid:r.uuid};return null==t?t={purge:!0}:c.default.extend(t,{purge:!0}),e.add(n).then(function(e){return e.remove(t).$promise.then(function(e){return e})})}function x(e,n){return null==e?{v:n}:c.default.extend(e,{v:n})}return{list:a,listFull:i,listRef:s,get:f,getFull:d,getRef:p,create:g,update:m,remove:h,retire:h,unretire:v,purge:$,getServerUrl:u,setBaseAppPath:o}}return{list:e,get:n,$get:["openmrsApi","$document","$q","openmrsContext",function(e,n,t,u){return r(e,n,t,u)}]}}function l(e,n){function r(){return null!=a}function t(){return null!=i}function u(e){var r=n[0].createElement("a");r.href=e;var t=r.search.slice(1).split("&"),u={};return t.forEach(function(e){""!==e&&(e=e.split("="),u[e[0]]=decodeURIComponent(e[1]||""))}),u}var o=e.results,a=null,i=null;return function(){if(null!=e.links)for(var n=0;n<e.links.length;n++){var r=e.links[n];"next"===r.rel?a=u(r.uri):"prev"===r.rel&&(i=u(r.uri))}}(),{results:o,hasNext:r,nextQuery:a,hasPrevious:t,previousQuery:i}}Object.defineProperty(n,"__esModule",{value:!0});var f=r(1),c=t(f),d=r(4);t(d);n.default=c.default.module("angularjs-openmrs-api-rest",["ngResource"]).value("openmrsContextConfig",{}).factory("openmrsContext",u).factory("openmrsApi",i).factory("authInterceptor",o).config(a).provider("openmrsRest",s).name,u.$inject=["$http","$q","$window","openmrsContextConfig"],o.$inject=["$q","$window","openmrsContextConfig"],a.$inject=["$httpProvider"],i.$inject=["$resource","$q","openmrsContext"]},function(e,n){e.exports=require("angular")},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function u(e,n){return function(r){var t=n.getServerUrl();return t.then(function(n){return r.url=n+"/module/uicommons/messages/messages.json",r.queryParameter="localeKey",e(r)}),t}}function o(e){function n(n,r){var t=e.translations(n);angular.isDefined(t)||(t={}),e.translations(n,angular.extend(t,r))}function r(e,n,r,t){function u(n){e.use(n),t.create("session",{locale:n}).then(function(){console.log("Locale changed to "+n)})}function o(){var n=r.defer();return angular.isDefined(a)?n.resolve(a):t.get("session").then(function(r){null!=r.locale&&null!=r.locale.language?(a=r.locale.language,e.use(a)):a=e.use(),n.resolve(a)},function(r){a=e.use(),n.resolve(a)}),n.promise}var a;return function(){o()}(),{changeLanguage:u,setLanguage:u,getLanguage:o}}return function(){e.fallbackLanguage("en").preferredLanguage("en").useLoader("openmrsTranslateLoader").useSanitizeValueStrategy("escape").forceAsyncReload(!0)}(),{addTranslations:n,$get:["$translate","$http","$q","openmrsRest",r]}}Object.defineProperty(n,"__esModule",{value:!0});var a=r(5),i=(t(a),r(6)),s=(t(i),r(0)),l=t(s);n.default=angular.module("angularjs-openmrs-api-translate",["pascalprecht.translate",l.default]).factory("openmrsTranslateLoader",u).provider("openmrsTranslate",o).name,u.$inject=["$translateUrlLoader","openmrsRest"],o.$inject=["$translateProvider"]},function(e,n,r){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var u=r(1),o=t(u),a=r(0),i=t(a),s=r(2),l=t(s);n.default=o.default.module("angularjs-openmrs-api",[i.default,l.default]).name},function(e,n){e.exports=require("angular-resource")},function(e,n){e.exports=require("angular-translate")},function(e,n){e.exports=require("angular-translate-loader-url")}])});
//# sourceMappingURL=index.min.js.map
{
"name": "@openmrs/angularjs-openmrs-api",
"version": "0.6.2",
"version": "0.7.0",
"description": "AngularJS (1.x) library for OpenMRS API",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc