forked from LuvDaSun/angular-hal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angular-hal.js.map
1 lines (1 loc) · 38.9 KB
/
angular-hal.js.map
1
{"version":3,"sources":["utility/utility.module.js","utility/resolve-url.factory.js","utility/normalize-link.factory.js","utility/extend-read-only.factory.js","utility/define-read-only.factory.js","url-generator/url-generator.module.js","url-generator/url-generator.service.js","resource/resource.module.js","resource/resource.factory.js","resource/hal-resource-client.factory.js","http-interception/http-interception.module.js","http-interception/response-transformer.service.js","http-interception/resource-http-interceptor.factory.js","http-interception/http-interception.config.js","content-type/content-type.module.js","content-type/content-type.service.js","configuration/configuration.module.js","configuration/hal-configuration.provider.js","client/client.module.js","client/link-header.factory.js","client/hal-client.service.js","angular-hal.module.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"angular-hal.js","sourcesContent":["(function(\n angular\n) {\n 'use strict';\n\n // Add new module for utilities\n angular.module('angular-hal.utility', []);\n\n})(\n angular\n);\n","(function(\n module\n) {\n 'use strict';\n\n // Regirster NormalizeLinkFactory\n module.factory('$resolveUrl', ResolveUrlFactory);\n\n // Inject Dependencies\n ResolveUrlFactory.$inject = [];\n\n /**\n * Factory for Url Resolver\n */\n function ResolveUrlFactory() {\n return resolveUrl;\n\n /**\n * Resolve whole URL\n * \n * @param {String} baseUrl\n * @param {String} path\n * @return {String}\n */\n function resolveUrl(baseUrl, path) {\n var resultHref = ''\n , reFullUrl = /^((?:\\w+\\:)?)((?:\\/\\/)?)([^\\/]*)((?:\\/.*)?)$/\n , baseHrefMatch = reFullUrl.exec(baseUrl)\n , hrefMatch = reFullUrl.exec(path);\n\n for (var partIndex = 1; partIndex < 5; partIndex++) {\n if (hrefMatch[partIndex]) {\n resultHref += hrefMatch[partIndex];\n } else {\n resultHref += baseHrefMatch[partIndex];\n }\n }\n\n return resultHref;\n }\n }\n})(\n angular.module('angular-hal.utility')\n);\n","(function(\n module,\n extend\n) {\n 'use strict';\n\n // Regirster NormalizeLinkFactory\n module.factory('$normalizeLink', NormalizeLinkFactory);\n\n // Inject Dependencies\n NormalizeLinkFactory.$inject = [\n '$resolveUrl',\n ];\n\n /**\n * Factory for Link Normalizer\n */\n function NormalizeLinkFactory($resolveUrl) {\n return normalizeLink;\n\n /**\n * @param {String} baseUrl\n * @param {mixed} link\n * @return {Object}\n */\n function normalizeLink(baseUrl, link) {\n if (Array.isArray(link)) {\n return link.map(function (item) {\n return normalizeLink(baseUrl, item);\n });\n }\n if(typeof link === 'string') {\n return {\n href: $resolveUrl(baseUrl, link),\n };\n }\n if(typeof link.href === 'string') {\n link.href = $resolveUrl(baseUrl, link.href);\n return link;\n }\n if(Array.isArray(link.href)) {\n return link.href.map(function (href) {\n var newLink = extend({}, link, {\n href: href,\n });\n return normalizeLink(baseUrl, newLink);\n });\n }\n return {\n href: baseUrl,\n };\n }\n }\n})(\n angular.module('angular-hal.utility'),\n angular.extend\n);\n","(function(\n module\n) {\n 'use strict';\n\n // Regirster ExtendReadOnlyFactory\n module.factory('$extendReadOnly', ExtendReadOnlyFactory);\n\n // Inject Dependencies\n ExtendReadOnlyFactory.$inject = [];\n\n /**\n * Factory for Extend Read Only\n */\n function ExtendReadOnlyFactory() {\n return extendReadOnly;\n\n /**\n * Extend properties from copy read-only to target\n * @param {Object} target\n * @param {Object} copy\n */\n function extendReadOnly(target, copy) {\n for(var key in copy) {\n Object.defineProperty(target, key, {\n configurable: false,\n enumerable: false,\n value: copy[key],\n });\n }\n }\n }\n})(\n angular.module('angular-hal.utility')\n);\n","(function(\n module\n) {\n 'use strict';\n\n // Regirster DefineReadOnlyFactory\n module.factory('$defineReadOnly', DefineReadOnlyFactory);\n\n // Inject Dependencies\n DefineReadOnlyFactory.$inject = [];\n\n /**\n * Factory for Define Read Only\n */\n function DefineReadOnlyFactory() {\n return defineReadOnly;\n\n /**\n * Define read-only property in target\n * @param {Object} target\n * @param {String} key\n * @param {mixed} value\n */\n function defineReadOnly(target, key, value) {\n Object.defineProperty(target, key, {\n configurable: false,\n enumerable: true,\n value: value,\n writable: true,\n });\n }\n }\n})(\n angular.module('angular-hal.utility')\n);\n","(function(\n angular\n) {\n 'use strict';\n\n // Add module for url generator\n angular.module('angular-hal.url-generator', []);\n\n})(\n angular\n);\n","(function(\n module\n) {\n 'use strict';\n\n // Regirster UrlGeneratorFactory\n module.factory('$generateUrl', UrlGeneratorFactory);\n\n // Inject Dependencies\n UrlGeneratorFactory.$inject = [\n '$window',\n ];\n\n /**\n * Factory for URL Generator\n */\n function UrlGeneratorFactory($window) {\n var rfc6570;\n\n /**\n * Initialize Everything\n */\n (function init() {\n rfc6570 = searchRfc6570();\n })();\n\n return generate;\n\n /**\n * Search for RFC6570\n */\n function searchRfc6570() {\n if(typeof $window.rfc6570 != 'undefined') {\n return $window.rfc6570;\n }\n \n if(!rfc6570 &&\n typeof require !== 'undefined') {\n return require('rfc6570/src/main');\n }\n\n throw new Error('Could not find rfc6570 library.');\n }\n\n /**\n * Generate url from template\n * \n * @param {String} template\n * @param {Object} parameters\n * @return {String}\n */\n function generate(template, parameters) {\n return new rfc6570.UriTemplate(template).stringify(parameters);\n }\n }\n})(\n angular.module('angular-hal.url-generator')\n);\n","(function(\n angular\n) {\n 'use strict';\n\n // Add module for resource\n angular.module('angular-hal.resource', [\n 'angular-hal.utility',\n 'angular-hal.configuration',\n\t]);\n\n})(\n angular\n);\n","(function(\n module\n) {\n 'use strict';\n\n // Add factory for Resource\n module.factory('Resource', ResourceFactory);\n\n // Inject Dependencies\n ResourceFactory.$inject = [\n 'HalResourceClient',\n '$generateUrl',\n '$extendReadOnly',\n '$defineReadOnly',\n '$normalizeLink',\n '$halConfiguration',\n ];\n\n /**\n * Factory for Resource\n * \n * @param {Function} HalResourceClient\n * @param {Function} $generateUrl\n * @param {Function} $extendReadOnly\n * @param {Function} $defineReadOnly\n * @param {Function} $normalizeLink\n * @param {Object} $halConfiguration\n */\n function ResourceFactory(\n HalResourceClient,\n $generateUrl,\n $extendReadOnly,\n $defineReadOnly,\n $normalizeLink,\n $halConfiguration\n ) {\n return Resource;\n\n /**\n * @param {Object} data\n * @param {Object} response\n */\n function Resource(data, response) {\n var self = this\n , links = {}\n , embedded = {}\n , client;\n\n /**\n * Initialize the Resource\n */\n (function init() {\n if(typeof data !== 'object' ||\n data === null) {\n data = {};\n }\n initializeData();\n initializeEmbedded();\n initializeLinks();\n inititalizeClient();\n\n $extendReadOnly(self, {\n $hasLink: $hasLink,\n $hasEmbedded: $hasEmbedded,\n $has: $has,\n $href: $href,\n $meta: $meta,\n $link: $link,\n $request: $request,\n $response: $response,\n });\n })();\n\n /**\n * Add all data from data to itself\n */\n function initializeData() {\n for(var propertyName in data) {\n if(!data.hasOwnProperty(propertyName)) {\n continue;\n }\n if(isMetaProperty(propertyName)) {\n continue;\n }\n $defineReadOnly(self, propertyName, data[propertyName]);\n }\n }\n\n /**\n * Normalize all Links\n */\n function initializeLinks() {\n if(typeof data[$halConfiguration.linksAttribute] !== 'object') {\n return;\n }\n\n Object\n .keys(data[$halConfiguration.linksAttribute])\n .forEach(function(rel) {\n var link = data[$halConfiguration.linksAttribute][rel];\n links[rel] = $normalizeLink(response.config.url, link);\n });\n }\n\n /**\n * Normalize Embedded Contents\n */\n function initializeEmbedded() {\n if(typeof data[$halConfiguration.embeddedAttribute] !== 'object') {\n return;\n }\n\n Object\n .keys(data[$halConfiguration.embeddedAttribute])\n .forEach(function(rel) {\n embedResource(rel, data[$halConfiguration.embeddedAttribute][rel]);\n });\n }\n\n /**\n * Initialize the HTTP CLIENT\n */\n function inititalizeClient() {\n client = new HalResourceClient(self, embedded);\n }\n\n /**\n * Embed a resource(s)\n * \n * @param {String} rel\n * @param {Object|Object[]} resources\n */\n function embedResource(rel, resources) {\n if (Array.isArray(resources)) {\n embedded[rel] = [];\n resources.forEach(function (resource) {\n embedded[rel].push(new Resource(resource, response));\n });\n return;\n }\n embedded[rel] = new Resource(resources, response);\n }\n\n /**\n * Determine if a property name is a meta property\n * @param {String} propertyName\n * @return {Boolean}\n */\n function isMetaProperty(propertyName) {\n for(var i = 0; i < $halConfiguration.ignoreAttributePrefixes.length; i++) {\n if(propertyName.substr(0, 1) === $halConfiguration.ignoreAttributePrefixes[i]) {\n return true;\n }\n if(propertyName === $halConfiguration.linksAttribute ||\n propertyName === $halConfiguration.embeddedAttribute) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * @param {String} rel\n * @return {Boolean}\n */\n function $hasLink(rel) {\n return typeof links[rel] !== 'undefined';\n }\n\n /**\n * @param {String} rel\n * @return {Boolean}\n */\n function $hasEmbedded(rel) {\n return typeof embedded[rel] !== 'undefined';\n }\n\n /**\n * @param {String} rel\n * @return {Boolean}\n */\n function $has(rel) {\n return $hasLink(rel) || $hasEmbedded(rel);\n }\n\n /**\n * Get the href of a Link\n * \n * @param {String} rel\n * @param {Object} parameters\n * @return {String}\n */\n function $href(rel, parameters) {\n if(!$hasLink(rel)) {\n throw new Error('link \"' + rel + '\" is undefined');\n }\n\n var link = links[rel]\n , href = link.href;\n\n if(Array.isArray(link)) {\n href = [];\n for(var i = 0; i < link.length; i++) {\n var subLink = link[i]\n , subHref = subLink.href;\n if(typeof subLink.templated !== 'undefined' &&\n subLink.templated) {\n subHref = $generateUrl(subLink.href, parameters);\n }\n subHref = $halConfiguration.urlTransformer(subHref);\n href.push(subHref);\n }\n } else {\n if(typeof link.templated !== 'undefined' &&\n link.templated) {\n href = $generateUrl(link.href, parameters);\n }\n\n href = $halConfiguration.urlTransformer(href);\n }\n\n return href;\n }\n\n /**\n * Get a link\n *\n * !! To get a href, use $href instead !!\n * \n * @param {String} rel\n * @return {Object}\n */\n function $link(rel) {\n if(!$hasLink(rel)) {\n throw new Error('link \"' + rel + '\" is undefined');\n }\n var link = links[rel];\n return link;\n }\n\n /**\n * Get meta properties\n *\n * !! To get a href, use $href instead !!\n * !! To get a link, use $link instead !!\n * !! To get an embedded resource, use $request().$get(rel) instead !!\n * \n * @param {String} rel\n * @return {Object}\n */\n function $meta(name) {\n for(var i = 0; i < $halConfiguration.ignoreAttributePrefixes.length; i++) {\n var fullName = $halConfiguration.ignoreAttributePrefixes[i] + name;\n return data[fullName];\n }\n }\n\n /**\n * Get the Original Response\n *\n * @return {Object)}\n */\n function $response() {\n return response;\n }\n\n /**\n * Get the client to perform requests\n *\n * @return {HalResourceClient)}\n */\n function $request() {\n return client;\n }\n }\n }\n})(\n angular.module('angular-hal.resource')\n);\n","(function(\n module,\n merge,\n extend\n) {\n 'use strict';\n\n // Add factory for HalResourceClient\n module.factory('HalResourceClient', HalResourceClientFactory);\n\n // Inject Dependencies\n HalResourceClientFactory.$inject = [\n '$q',\n '$extendReadOnly',\n '$injector',\n '$halConfiguration',\n ];\n\n /**\n * Factory for HalResourceClient\n * @param {Q} $q\n * @param {Function} $extendReadOnly\n * @param {Injector} $injector Prevent Circular Dependency by injecting $injector instead of $http\n * @param {Object} $halConfiguration\n */\n function HalResourceClientFactory($q, $extendReadOnly, $injector, $halConfiguration) {\n return HalResourceClient;\n\n /**\n * @param {Resource} resource\n * @param {Object} links\n * @param {Object} embedded\n */\n function HalResourceClient(resource, embedded) {\n var self = this\n , $http = $injector.get('$http');\n\n /**\n * Initialize the client\n */\n (function init() {\n $extendReadOnly(self, {\n $request: $request,\n $get: $get,\n $post: $post,\n $put: $put,\n $patch: $patch,\n $delete: $delete,\n $del: $delete,\n $link: $link,\n $unlink: $unlink,\n });\n })();\n\n /**\n * Execute a HTTP request against a link\n * \n * @param {String} method\n * @param {String} rel\n * @param {Object|null} urlParams\n * @param {mixed|null} body\n * @param {Object} options\n * @return {Promise}\n */\n function $request(method, rel, urlParams, body, options) {\n var promises;\n\n method = method || 'GET';\n rel = rel || $halConfiguration.selfLink;\n urlParams = urlParams || {};\n body = body || null;\n options = options || {};\n\n if(method === 'GET' &&\n rel === $halConfiguration.selfLink) {\n return $q.resolve(resource);\n }\n\n if(resource.$hasEmbedded(rel) &&\n Array.isArray(embedded[rel])) {\n promises = [];\n for(var i = 0; i < embedded[rel].length; i++) {\n promises.push(embedded[rel][i].$request().$request(method, 'self', urlParams, body, options));\n }\n return $q.all(promises);\n }\n\n if(resource.$hasEmbedded(rel)) {\n return embedded[rel].$request().$request(method, 'self', urlParams, body, options);\n }\n\n if(resource.$hasLink(rel)) {\n var url = resource.$href(rel, urlParams);\n\n extend(options, {\n method: method,\n data: body,\n });\n\n if(Array.isArray(url)) {\n promises = [];\n for(var j = 0; j < url.length; j++) {\n promises.push($http(merge(options, {url: url[j]})));\n }\n return $q.all(promises);\n }\n\n return $http(merge(options, {\n url: resource.$href(rel, urlParams),\n }));\n }\n\n return $q.reject(new Error('link \"' + rel + '\" is undefined'));\n }\n\n /**\n * Execute a HTTP GET request against a link or\n * load an embedded resource\n * \n * @param {String} rel\n * @param {Object|null} urlParams\n * @param {Object} options\n * @return {Promise}\n */\n function $get(rel, urlParams, options) {\n return $request('GET', rel, urlParams, undefined, options);\n }\n\n /**\n * Execute a HTTP POST request against a link\n * \n * @param {String} rel\n * @param {Object|null} urlParams\n * @param {mixed|null} body\n * @param {Object} options\n * @return {Promise}\n */\n function $post(rel, urlParams, body, options) {\n return $request('POST', rel, urlParams, body, options);\n }\n\n /**\n * Execute a HTTP PUT request against a link\n * \n * @param {String} rel\n * @param {Object|null} urlParams\n * @param {mixed|null} body\n * @param {Object} options\n * @return {Promise}\n */\n function $put(rel, urlParams, body, options) {\n return $request('PUT', rel, urlParams, body, options);\n }\n\n /**\n * Execute a HTTP PATCH request against a link\n * \n * @param {String} rel\n * @param {Object|null} urlParams\n * @param {mixed|null} body\n * @param {Object} options\n * @return {Promise}\n */\n function $patch(rel, urlParams, body, options) {\n return $request('PATCH', rel, urlParams, body, options);\n }\n\n /**\n * Execute a HTTP DELEET request against a link\n * \n * @param {String} rel\n * @param {Object|null} urlParams\n * @param {Object} options\n * @return {Promise}\n */\n function $delete(rel, urlParams, options) {\n return $request('DELETE', rel, urlParams, undefined, options);\n }\n\n /**\n * Execute a HTTP LINK request against a link\n * \n * @param {String} rel\n * @param {Object|null} urlParams\n * @param {LinkHeader[]} body\n * @param {Object} options\n * @return {Promise}\n */\n function $link(rel, urlParams, links, options) {\n options = options || {};\n options.headers = options.headers || {};\n options.headers.Link = links.map(toStringItem);\n return $request('LINK', rel, urlParams, undefined, options);\n }\n\n /**\n * Execute a HTTP UNLINK request against a link\n * \n * @param {String} rel\n * @param {Object|null} urlParams\n * @param {LinkHeader[]} body\n * @param {Object} options\n * @return {Promise}\n */\n function $unlink(rel, urlParams, links, options) {\n options = options || {};\n options.headers = options.headers || {};\n options.headers.Link = links.map(toStringItem);\n return $request('UNLINK', rel, urlParams, undefined, options);\n }\n\n /**\n * @param {mixed} item\n * @return {String}\n */\n function toStringItem(item) {\n return item.toString();\n }\n }\n }\n})(\n angular.module('angular-hal.resource'),\n angular.merge,\n angular.extend\n);\n","(function(\n angular\n) {\n 'use strict';\n\n // Add module for http interception\n angular.module('angular-hal.http-interception', [\n 'angular-hal.resource',\n 'angular-hal.configuration',\n ]);\n\n})(\n angular\n);\n","(function(\n module\n) {\n 'use strict';\n\n // Add factory for $transformResponseToResource\n module.factory('$transformResponseToResource', ResponseToResourceTransformerFactory);\n\n // Inject Dependencies\n ResponseToResourceTransformerFactory.$inject = [\n 'Resource',\n ];\n\n /**\n * @param {Function} Resource\n */\n function ResponseToResourceTransformerFactory(Resource) {\n return transform;\n\n /**\n * @param {Response}\n * @return {Resource}\n */\n function transform(response) {\n return new Resource(response.data, response);\n }\n }\n})(\n angular.module('angular-hal.http-interception')\n);\n","(function(\n module\n) {\n 'use strict';\n\n // Add Factory for ResourceHttpInterceptorFactory\n module.factory('ResourceHttpInterceptor', ResourceHttpInterceptorFactory);\n\n // Inject Dependencies\n ResourceHttpInterceptorFactory.$inject = [\n '$transformResponseToResource',\n '$halConfiguration',\n\t'$contentType'\n ];\n\n /**\n * @param {Function} $transformResponseToResource\n * @return {Object}\n */\n function ResourceHttpInterceptorFactory($transformResponseToResource, $halConfiguration, $contentType) {\n var CONTENT_TYPE = 'application/hal+json';\n\n return {\n request: transformRequest,\n response: transformResponse,\n };\n\n /**\n * Add Hal Json As an accepted format\n * @param {Request} request\n * @return {Request}\n */\n function transformRequest(request) {\n if(typeof request.headers.Accept === 'undefined') {\n request.headers.Accept = CONTENT_TYPE;\n } else {\n request.headers.Accept = [\n CONTENT_TYPE,\n request.headers.Accept\n ].join(', ');\n }\n\n return request;\n }\n\n /**\n * Transform Response\n * \n * @param {Response} response\n * @return {Response|Resource}\n */\n function transformResponse(response) {\n if($contentType.match(response.headers('Content-Type'), CONTENT_TYPE)) {\n return $transformResponseToResource(response);\n }\n if(response.config.forceHal) {\n return $transformResponseToResource(response);\n }\n if((\n response.headers('Content-Type') === 'application/json' ||\n response.headers('Content-Type') === null\n ) &&\n $halConfiguration.forceJSONResource) {\n return $transformResponseToResource(response);\n }\n \n return response;\n }\n }\n})(\n angular.module('angular-hal.http-interception')\n);\n","(function(\n module\n) {\n 'use strict';\n\n // Configure Http Interception\n module.config(HttpInterceptorConfiguration);\n\n // Inject Dependencies\n HttpInterceptorConfiguration.$inject = [\n '$httpProvider',\n ];\n\n /**\n * @param {HttpProvider} $httpProvider\n */\n function HttpInterceptorConfiguration($httpProvider) {\n $httpProvider.interceptors.push('ResourceHttpInterceptor');\n }\n\n})(\n angular.module('angular-hal.http-interception')\n);\n","(function(\n angular\n) {\n 'use strict';\n\n // Add module for content type checker\n angular.module('angular-hal.content-type', []);\n\n})(\n angular\n);\n","(function (module) {\n\t'use strict';\n\n\t// Regirster ContentType\n\tmodule.factory('$contentType', ContentType);\n\n\t// Inject Dependencies\n\tContentType.$inject = ['$window'];\n\n\t/**\n\t * Factory for Content-Type parser\n\t */\n\tfunction ContentType($window) {\n\t\tvar contentType;\n\n\t\t/**\n\t\t * Initialize Everything\n\t\t */\n\t\t(function init() {\n\t\t\tcontentType = searchContentType();\n\t\t})();\n\n\t\treturn match;\n\n\t\t/**\n\t\t * Search for content-type lib\n\t\t */\n\t\tfunction searchContentType() {\n\t\t\tif (typeof $window.contentType != 'undefined') {\n\t\t\t\treturn $window.contentType;\n\t\t\t}\n\n\t\t\tif (!contentType &&\n\t\t\t\ttypeof require !== 'undefined') {\n\t\t\t\treturn require('content-type');\n\t\t\t}\n\n\t\t\tthrow new Error('Could not find content-type library.');\n\t\t}\n\n\t\t/**\n\t\t * Check content-type matching\n\t\t *\n\t\t * @param {String} contentType\n\t\t * @param {String} type\n\t\t * @return {Boolean}\n\t\t */\n\t\tfunction match(contentType, type) {\n\t\t\treturn contentType.parse(contentType).type === type;\n\t\t}\n\n\t\t// @TODO: Add parse and format methods (?)\n\t}\n})(angular.module('angular-hal.content-type'));\n","(function(\n angular\n) {\n 'use strict';\n\n // Add module for configuration\n angular.module('angular-hal.configuration', []);\n\n})(\n angular\n);\n","(function(\n module\n) {\n 'use strict';\n\n // Add Factory for ResourceHttpInterceptorFactory\n module.provider('$halConfiguration', HalConfigurationProvider);\n\n // Inject Dependencies\n HalConfigurationProvider.$inject = [];\n\n /**\n * @return {Object}\n */\n function HalConfigurationProvider() {\n var linksAttribute = '_links'\n , embeddedAttribute = '_embedded'\n , ignoreAttributePrefixes = [\n '_',\n '$',\n ]\n , selfLink = 'self'\n , forceJSONResource = false\n , urlTransformer = noopUrlTransformer;\n\n // Inject Dependencies\n $get.$inject = [\n '$log',\n ];\n\n return {\n setLinksAttribute: setLinksAttribute,\n setEmbeddedAttribute: setEmbeddedAttribute,\n setIgnoreAttributePrefixes: setIgnoreAttributePrefixes,\n addIgnoreAttributePrefix: addIgnoreAttributePrefix,\n setSelfLink: setSelfLink,\n setForceJSONResource: setForceJSONResource,\n setUrlTransformer: setUrlTransformer,\n $get: $get,\n };\n\n /**\n * @param {String} newLinksAttribute\n */\n function setLinksAttribute(newLinksAttribute) {\n linksAttribute = newLinksAttribute;\n }\n\n /**\n * @param {String} newEmbeddedAttribute\n */\n function setEmbeddedAttribute(newEmbeddedAttribute) {\n embeddedAttribute = newEmbeddedAttribute;\n }\n\n /**\n * @param {String[]} newIgnoreAttributePrefixes\n */\n function setIgnoreAttributePrefixes(newIgnoreAttributePrefixes) {\n ignoreAttributePrefixes = newIgnoreAttributePrefixes;\n }\n\n /**\n * @param {String} ignoreAttributePrefix\n */\n function addIgnoreAttributePrefix(ignoreAttributePrefix) {\n ignoreAttributePrefixes.push(ignoreAttributePrefix);\n }\n\n /**\n * @param {String} newSelfLink\n */\n function setSelfLink(newSelfLink) {\n selfLink = newSelfLink;\n }\n\n /**\n * @param {Boolean} newForceJSONResource\n */\n function setForceJSONResource(newForceJSONResource) {\n forceJSONResource = newForceJSONResource;\n }\n\n /**\n * @param {Function}\n * @deprecated $halConfigurationProvider.setUrlTransformer is deprecated. Please write a http interceptor instead.\n * @see https://docs.angularjs.org/api/ng/service/$http#interceptors\n */\n function setUrlTransformer(newUrlTransformer) {\n urlTransformer = newUrlTransformer;\n }\n\n /**\n * @param {String}\n * @return {String}\n */\n function noopUrlTransformer(url) {\n return url;\n }\n\n /**\n * @return {Object}\n */\n function $get($log) {\n if(urlTransformer !== noopUrlTransformer) {\n $log.log('$halConfigurationProvider.setUrlTransformer is deprecated. Please write a http interceptor instead.');\n }\n\n return Object.freeze({\n linksAttribute: linksAttribute,\n embeddedAttribute: embeddedAttribute,\n ignoreAttributePrefixes: ignoreAttributePrefixes,\n selfLink: selfLink,\n forceJSONResource: forceJSONResource,\n urlTransformer: urlTransformer,\n });\n }\n }\n})(\n angular.module('angular-hal.configuration')\n);\n","(function(\n angular\n) {\n 'use strict';\n\n // Add module for client\n angular.module('angular-hal.client', [\n 'angular-hal.utility',\n ]);\n\n})(\n angular\n);\n","(function(\n module,\n merge,\n forEach\n) {\n 'use strict';\n\n // Add factory for LinkHeader\n module.factory('LinkHeader', LinkHeaderFactory);\n\n // Inject Dependencies\n LinkHeaderFactory.$inject = [];\n\n /**\n * Factory for LinkHeader\n */\n function LinkHeaderFactory() {\n return LinkHeader;\n\n /**\n * Link Header\n *\n * @param {String} uriReference The Link Value\n * @param {Object} linkParams The Link Params\n * @constructor\n */\n function LinkHeader(uriReference, linkParams) {\n var self = this;\n\n /**\n * Initialize the LinkHeader\n *\n * @return void\n */\n (function init() {\n merge(self, {\n uriReference: uriReference,\n linkParams: angular.merge(\n {\n rel: null,\n anchor: null,\n rev: null,\n hreflang: null,\n media: null,\n title: null,\n type: null,\n },\n linkParams\n ),\n });\n })();\n\n /**\n * Convert LinkHeader to String\n *\n * @return {String}\n */\n self.toString = function toString() {\n var result = '<' + self.uriReference + '>'\n , params = [];\n\n forEach(\n self.linkParams,\n function(paramValue, paramName) {\n if(paramValue) {\n params.push(paramName + '=\"' + paramValue + '\"');\n }\n }\n );\n\n if(params.length < 1) {\n return result;\n }\n\n result = result + ';' + params.join(';');\n\n return result;\n };\n\n return this;\n }\n }\n})(\n angular.module('angular-hal.client'),\n angular.merge,\n angular.forEach\n);\n","(function(\n module,\n extend,\n merge\n) {\n 'use strict';\n\n // Add halCLient service\n module.service('halClient', HalClientService);\n module.service('$halClient', HalClientService);\n\n // Inject Dependencies\n HalClientService.$inject = [\n '$log',\n '$http',\n 'LinkHeader',\n '$halConfiguration',\n ];\n\n /**\n * @param {Log} $log\n * @param {Http} $http\n * @param {Function} LinkHeader\n * @param {Object} $halConfiguration\n * @deprecated The halClient service is deprecated. Please use $http directly instead.\n */\n function HalClientService($log, $http, LinkHeader, $halConfiguration) {\n var self = this;\n\n /**\n * @return Initialize halClient\n */\n (function init() {\n extend(self, {\n $get: $get,\n $post: $post,\n $put: $put,\n $patch: $patch,\n $delete: $delete,\n $del: $delete,\n $link: $link,\n $unlink: $unlink,\n LinkHeader: LinkHeader,\n });\n })();\n\n /* @ngNoInject */\n function $get(href, options) {\n return $request('GET', href, options);\n }\n\n function $post(href, options, data) {\n return $request('POST', href, options, data);\n }\n\n function $put(href, options, data) {\n return $request('PUT', href, options, data);\n }\n\n function $patch(href, options, data) {\n return $request('PATCH', href, options, data);\n }\n\n function $delete(href, options) {\n return $request('DELETE', href, options);\n }\n\n function $link(href, options, linkHeaders) {\n options = options || {};\n options.headers = options.headers || {};\n options.headers.Link = linkHeaders.map(function(link) { return link.toString(); });\n return $request('LINK', href, options);\n }\n\n function $unlink(href, options, linkHeaders) {\n options = options || {};\n options.headers = options.headers || {};\n options.headers.Link = linkHeaders.map(function(link) { return link.toString(); });\n return $request('UNLINK', href, options);\n }\n\n function $request(method, href, options, data) {\n options = options || {};\n $log.log('The halClient service is deprecated. Please use $http directly instead.');\n return $http(merge(options, {\n method: method,\n url: $halConfiguration.urlTransformer(href),\n data: data,\n }));\n }\n }\n})(\n angular.module('angular-hal.client'),\n angular.extend,\n angular.merge\n);\n","(function(\n angular\n) {\n 'use strict';\n\n // Combine needed Modules\n angular.module('angular-hal', [\n 'angular-hal.url-generator',\n 'angular-hal.content-type',\n 'angular-hal.http-interception',\n 'angular-hal.client',\n 'ng',\n ]);\n\n})(\n angular\n);\n"],"sourceRoot":"/source/"}