forked from LuvDaSun/angular-hal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular-hal.min.js
23 lines (23 loc) · 9.17 KB
/
angular-hal.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
!function(u){"use strict";u.module("angular-hal.utility",[])}(angular);
!function(r){"use strict";function e(){function r(r,e){for(var n="",t=/^((?:\w+\:)?)((?:\/\/)?)([^\/]*)((?:\/.*)?)$/,u=t.exec(r),c=t.exec(e),a=1;5>a;a++)n+=c[a]?c[a]:u[a];return n}return r}r.factory("$resolveUrl",e),e.$inject=[]}(angular.module("angular-hal.utility"));
!function(r,n){"use strict";function e(r){function e(t,a){return Array.isArray(a)?a.map(function(r){return e(t,r)}):"string"==typeof a?{href:r(t,a)}:"string"==typeof a.href?(a.href=r(t,a.href),a):Array.isArray(a.href)?a.href.map(function(r){var f=n({},a,{href:r});return e(t,f)}):{href:t}}return e}r.factory("$normalizeLink",e),e.$inject=["$resolveUrl"]}(angular.module("angular-hal.utility"),angular.extend);
!function(e){"use strict";function n(){function e(e,n){for(var t in n)Object.defineProperty(e,t,{configurable:!1,enumerable:!1,value:n[t]})}return e}e.factory("$extendReadOnly",n),n.$inject=[]}(angular.module("angular-hal.utility"));
!function(e){"use strict";function n(){function e(e,n,t){Object.defineProperty(e,n,{configurable:!1,enumerable:!0,value:t,writable:!0})}return e}e.factory("$defineReadOnly",n),n.$inject=[]}(angular.module("angular-hal.utility"));
!function(a){"use strict";a.module("angular-hal.url-generator",[])}(angular);
!function(r){"use strict";function n(r){function n(){if("undefined"!=typeof r.rfc6570)return r.rfc6570;if(!t&&"undefined"!=typeof require)return require("rfc6570/src/main");throw new Error("Could not find rfc6570 library.")}function e(r,n){return new t.UriTemplate(r).stringify(n)}var t;return function(){t=n()}(),e}r.factory("$generateUrl",n),n.$inject=["$window"]}(angular.module("angular-hal.url-generator"));
!function(a){"use strict";a.module("angular-hal.resource",["angular-hal.utility","angular-hal.configuration"])}(angular);
!function(e){"use strict";function r(e,r,t,n,i,u){function f(o,a){function d(){for(var e in o)o.hasOwnProperty(e)&&(h(e)||n(j,e,o[e]))}function c(){"object"==typeof o[u.linksAttribute]&&Object.keys(o[u.linksAttribute]).forEach(function(e){var r=o[u.linksAttribute][e];E[e]=i(a.config.url,r)})}function s(){"object"==typeof o[u.embeddedAttribute]&&Object.keys(o[u.embeddedAttribute]).forEach(function(e){b(e,o[u.embeddedAttribute][e])})}function l(){w=new e(j,x)}function b(e,r){return Array.isArray(r)?(x[e]=[],void r.forEach(function(r){x[e].push(new f(r,a))})):void(x[e]=new f(r,a))}function h(e){for(var r=0;r<u.ignoreAttributePrefixes.length;r++){if(e.substr(0,1)===u.ignoreAttributePrefixes[r])return!0;if(e===u.linksAttribute||e===u.embeddedAttribute)return!0}return!1}function y(e){return"undefined"!=typeof E[e]}function A(e){return"undefined"!=typeof x[e]}function p(e){return y(e)||A(e)}function m(e,t){if(!y(e))throw new Error('link "'+e+'" is undefined');var n=E[e],i=n.href;if(Array.isArray(n)){i=[];for(var f=0;f<n.length;f++){var o=n[f],a=o.href;"undefined"!=typeof o.templated&&o.templated&&(a=r(o.href,t)),a=u.urlTransformer(a),i.push(a)}}else"undefined"!=typeof n.templated&&n.templated&&(i=r(n.href,t)),i=u.urlTransformer(i);return i}function $(e){if(!y(e))throw new Error('link "'+e+'" is undefined');var r=E[e];return r}function g(e){for(var r=0;r<u.ignoreAttributePrefixes.length;r++){var t=u.ignoreAttributePrefixes[r]+e;return o[t]}}function v(){return a}function k(){return w}var w,j=this,E={},x={};!function(){"object"==typeof o&&null!==o||(o={}),d(),s(),c(),l(),t(j,{$hasLink:y,$hasEmbedded:A,$has:p,$href:m,$meta:g,$link:$,$request:k,$response:v})}()}return f}e.factory("Resource",r),r.$inject=["HalResourceClient","$generateUrl","$extendReadOnly","$defineReadOnly","$normalizeLink","$halConfiguration"]}(angular.module("angular-hal.resource"));
!function(e,r,n){"use strict";function t(e,t,u,i){function a(a,o){function l(t,u,l,s,f){var d;if(t=t||"GET",u=u||i.selfLink,l=l||{},s=s||null,f=f||{},"GET"===t&&u===i.selfLink)return e.resolve(a);if(a.$hasEmbedded(u)&&Array.isArray(o[u])){d=[];for(var $=0;$<o[u].length;$++)d.push(o[u][$].$request().$request(t,"self",l,s,f));return e.all(d)}if(a.$hasEmbedded(u))return o[u].$request().$request(t,"self",l,s,f);if(a.$hasLink(u)){var c=a.$href(u,l);if(n(f,{method:t,data:s}),Array.isArray(c)){d=[];for(var h=0;h<c.length;h++)d.push(k(r(f,{url:c[h]})));return e.all(d)}return k(r(f,{url:a.$href(u,l)}))}return e.reject(new Error('link "'+u+'" is undefined'))}function s(e,r,n){return l("GET",e,r,void 0,n)}function f(e,r,n,t){return l("POST",e,r,n,t)}function d(e,r,n,t){return l("PUT",e,r,n,t)}function $(e,r,n,t){return l("PATCH",e,r,n,t)}function c(e,r,n){return l("DELETE",e,r,void 0,n)}function h(e,r,n,t){return t=t||{},t.headers=t.headers||{},t.headers.Link=n.map(v),l("LINK",e,r,void 0,t)}function g(e,r,n,t){return t=t||{},t.headers=t.headers||{},t.headers.Link=n.map(v),l("UNLINK",e,r,void 0,t)}function v(e){return e.toString()}var E=this,k=u.get("$http");!function(){t(E,{$request:l,$get:s,$post:f,$put:d,$patch:$,$delete:c,$del:c,$link:h,$unlink:g})}()}return a}e.factory("HalResourceClient",t),t.$inject=["$q","$extendReadOnly","$injector","$halConfiguration"]}(angular.module("angular-hal.resource"),angular.merge,angular.extend);
!function(a){"use strict";a.module("angular-hal.http-interception",["angular-hal.resource","angular-hal.configuration"])}(angular);
!function(n){"use strict";function t(n){function t(t){return new n(t.data,t)}return t}n.factory("$transformResponseToResource",t),t.$inject=["Resource"]}(angular.module("angular-hal.http-interception"));
!function(e){"use strict";function n(e,n,t){function r(e){return"undefined"==typeof e.headers.Accept?e.headers.Accept=c:e.headers.Accept=[c,e.headers.Accept].join(", "),e}function o(r){return t.match(r.headers("Content-Type"),c)?e(r):r.config.forceHal?e(r):"application/json"!==r.headers("Content-Type")&&null!==r.headers("Content-Type")||!n.forceJSONResource?r:e(r)}var c="application/hal+json";return{request:r,response:o}}e.factory("ResourceHttpInterceptor",n),n.$inject=["$transformResponseToResource","$halConfiguration","$contentType"]}(angular.module("angular-hal.http-interception"));
!function(t){"use strict";function e(t){t.interceptors.push("ResourceHttpInterceptor")}t.config(e),e.$inject=["$httpProvider"]}(angular.module("angular-hal.http-interception"));
!function(n){"use strict";n.module("angular-hal.content-type",[])}(angular);
!function(n){"use strict";function t(n){function t(){if("undefined"!=typeof n.contentType)return n.contentType;if(!r&&"undefined"!=typeof require)return require("content-type");throw new Error("Could not find content-type library.")}function e(n,t){return n.parse(n).type===t}var r;return function(){r=t()}(),e}n.factory("$contentType",t),t.$inject=["$window"]}(angular.module("angular-hal.content-type"));
!function(a){"use strict";a.module("angular-hal.configuration",[])}(angular);
!function(e){"use strict";function t(){function e(e){c=e}function t(e){a=e}function r(e){d=e}function n(e){d.push(e)}function i(e){l=e}function o(e){b=e}function u(e){g=e}function f(e){return e}function s(e){return g!==f&&e.log("$halConfigurationProvider.setUrlTransformer is deprecated. Please write a http interceptor instead."),Object.freeze({linksAttribute:c,embeddedAttribute:a,ignoreAttributePrefixes:d,selfLink:l,forceJSONResource:b,urlTransformer:g})}var c="_links",a="_embedded",d=["_","$"],l="self",b=!1,g=f;return s.$inject=["$log"],{setLinksAttribute:e,setEmbeddedAttribute:t,setIgnoreAttributePrefixes:r,addIgnoreAttributePrefix:n,setSelfLink:i,setForceJSONResource:o,setUrlTransformer:u,$get:s}}e.provider("$halConfiguration",t),t.$inject=[]}(angular.module("angular-hal.configuration"));
!function(a){"use strict";a.module("angular-hal.client",["angular-hal.utility"])}(angular);
!function(n,r,e){"use strict";function l(){function n(n,l){var u=this;return function(){r(u,{uriReference:n,linkParams:angular.merge({rel:null,anchor:null,rev:null,hreflang:null,media:null,title:null,type:null},l)})}(),u.toString=function(){var n="<"+u.uriReference+">",r=[];return e(u.linkParams,function(n,e){n&&r.push(e+'="'+n+'"')}),r.length<1?n:n=n+";"+r.join(";")},this}return n}n.factory("LinkHeader",l),l.$inject=[]}(angular.module("angular-hal.client"),angular.merge,angular.forEach);
!function(e,n,t){"use strict";function r(e,r,i,u){function a(e,n){return f("GET",e,n)}function l(e,n,t){return f("POST",e,n,t)}function o(e,n,t){return f("PUT",e,n,t)}function c(e,n,t){return f("PATCH",e,n,t)}function d(e,n){return f("DELETE",e,n)}function s(e,n,t){return n=n||{},n.headers=n.headers||{},n.headers.Link=t.map(function(e){return e.toString()}),f("LINK",e,n)}function h(e,n,t){return n=n||{},n.headers=n.headers||{},n.headers.Link=t.map(function(e){return e.toString()}),f("UNLINK",e,n)}function f(n,i,a,l){return a=a||{},e.log("The halClient service is deprecated. Please use $http directly instead."),r(t(a,{method:n,url:u.urlTransformer(i),data:l}))}var $=this;!function(){n($,{$get:a,$post:l,$put:o,$patch:c,$delete:d,$del:d,$link:s,$unlink:h,LinkHeader:i})}()}e.service("halClient",r),e.service("$halClient",r),r.$inject=["$log","$http","LinkHeader","$halConfiguration"]}(angular.module("angular-hal.client"),angular.extend,angular.merge);
!function(a){"use strict";a.module("angular-hal",["angular-hal.url-generator","angular-hal.content-type","angular-hal.http-interception","angular-hal.client","ng"])}(angular);
//# sourceMappingURL=angular-hal.min.js.map