@commercetools/sdk-middleware-user-agent
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -1,3 +0,3 @@ | ||
<a name="1.0.0"></a> | ||
# 1.0.0 (2017-01-10) | ||
<a name="1.1.0"></a> | ||
# 1.1.0 (2017-01-12) | ||
@@ -8,4 +8,5 @@ | ||
* **middleware-user-agent:** add middleware to define the user-agent for http requests (#15) ([a89de57](https://github.com/commercetools/nodejs/commit/a89de57)) | ||
* **middleware-user-agent:** use dep from http-user-agent ([bc877ff](https://github.com/commercetools/nodejs/commit/bc877ff)) | ||
@@ -63,3 +63,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var _userAgent = __webpack_require__(2); | ||
var _userAgent = __webpack_require__(3); | ||
@@ -88,20 +88,24 @@ Object.defineProperty(exports, 'createUserAgentMiddleware', { | ||
var sdkInfo = 'commercetools-node-sdk'; // version is not necessary | ||
// TODO: should this be configurable? | ||
function createUserAgent(options) { | ||
var windowObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window; | ||
var helpdesk = 'helpdesk@commercetools.com'; | ||
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`'); | ||
function createUserAgent() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var windowObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window; | ||
// Main info | ||
var baseInfo = options.version ? options.name + '/' + options.version : options.name; | ||
// Library info | ||
var libraryInfo = void 0; | ||
if (options.name && !options.version) libraryInfo = options.name;else if (options.name && options.version) libraryInfo = options.name + '/' + options.version; | ||
var libraryUrl = options.url; | ||
if (options.libraryName && !options.libraryVersion) libraryInfo = options.libraryName;else if (options.libraryName && options.libraryVersion) libraryInfo = options.libraryName + '/' + options.libraryVersion; | ||
var solutionContactInfo = libraryUrl ? '+' + libraryUrl + '; +' + helpdesk : '+' + helpdesk; | ||
var solutionInfo = libraryInfo ? libraryInfo + ' (' + solutionContactInfo + ')' : '(' + solutionContactInfo + ')'; | ||
// Contact info | ||
var contactInfo = void 0; | ||
if (options.contactUrl && !options.contactEmail) contactInfo = '(+' + options.contactUrl + ')';else if (!options.contactUrl && options.contactEmail) contactInfo = '(+' + options.contactEmail + ')';else if (options.contactUrl && options.contactEmail) contactInfo = '(+' + options.contactUrl + '; +' + options.contactEmail + ')'; | ||
// System info | ||
var systemInfo = getSystemInfo(windowObject); | ||
return sdkInfo + ' ' + systemInfo + ' ' + solutionInfo; | ||
return [baseInfo, systemInfo, libraryInfo, contactInfo].filter(function (x) { | ||
return Boolean(x); | ||
}).join(' '); | ||
} | ||
@@ -116,3 +120,3 @@ | ||
} | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) | ||
@@ -128,3 +132,24 @@ /***/ }, | ||
}); | ||
exports.default = undefined; | ||
var _createUserAgent = __webpack_require__(1); | ||
var _createUserAgent2 = _interopRequireDefault(_createUserAgent); | ||
function _interopRequireDefault(obj) { | ||
return obj && obj.__esModule ? obj : { default: obj }; | ||
} | ||
exports.default = _createUserAgent2.default; | ||
/***/ }, | ||
/* 3 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
@@ -134,5 +159,5 @@ | ||
var _createUserAgent = __webpack_require__(1); | ||
var _httpUserAgent = __webpack_require__(2); | ||
var _createUserAgent2 = _interopRequireDefault(_createUserAgent); | ||
var _httpUserAgent2 = _interopRequireDefault(_httpUserAgent); | ||
@@ -142,3 +167,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function createUserAgentMiddleware(options) { | ||
var userAgent = (0, _createUserAgent2.default)(options); | ||
var userAgent = (0, _httpUserAgent2.default)(_extends({ | ||
name: 'commercetools-js-sdk' | ||
}, options)); | ||
@@ -158,3 +185,3 @@ return function (next) { | ||
/***/ }, | ||
/* 3 */ | ||
/* 4 */ | ||
/***/ function(module, exports) { | ||
@@ -161,0 +188,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CommercetoolsSdkMiddlewareUserAgent=t():e.CommercetoolsSdkMiddlewareUserAgent=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(2);Object.defineProperty(t,"createUserAgentMiddleware",{enumerable:!0,get:function(){return n(o).default}})},function(e,t,r){(function(e){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window,r=void 0;e.name&&!e.version?r=e.name:e.name&&e.version&&(r=e.name+"/"+e.version);var u=e.url,c=u?"+"+u+"; +"+i:"+"+i,a=r?r+" ("+c+")":"("+c+")",s=n(t);return o+" "+s+" "+a}function n(t){if(t&&t.navigator)return t.navigator.userAgent;var r=e.version.slice(1),n="("+e.platform+"; "+e.arch+")";return"Node.js/"+r+" "+n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o="commercetools-node-sdk",i="helpdesk@commercetools.com"}).call(t,r(3))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=(0,c.default)(e);return function(e){return function(r,n){var o=i({},r,{headers:i({},r.headers,{"User-Agent":t})});e(o,n)}}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=o;var u=r(1),c=n(u)},function(e,t){function r(){throw Error("setTimeout has not been defined")}function n(){throw Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function u(){v&&m&&(v=!1,m.length?h=m.concat(h):p=-1,h.length&&c())}function c(){if(!v){var e=o(u);v=!0;for(var t=h.length;t;){for(m=h,h=[];++p<t;)m&&m[p].run();p=-1,t=h.length}m=null,v=!1,i(e)}}function a(e,t){this.fun=e,this.array=t}function s(){}var f,l,d=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:r}catch(e){f=r}try{l="function"==typeof clearTimeout?clearTimeout:n}catch(e){l=n}}();var m,h=[],v=!1,p=-1;d.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;arguments.length>r;r++)t[r-1]=arguments[r];h.push(new a(e,t)),1!==h.length||v||o(c)},a.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=s,d.addListener=s,d.once=s,d.off=s,d.removeListener=s,d.removeAllListeners=s,d.emit=s,d.binding=function(e){throw Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw Error("process.chdir is not supported")},d.umask=function(){return 0}}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CommercetoolsSdkMiddlewareUserAgent=t():e.CommercetoolsSdkMiddlewareUserAgent=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(3);Object.defineProperty(t,"createUserAgentMiddleware",{enumerable:!0,get:function(){return n(o).default}})},function(e,t,r){(function(e){"use strict";function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;if(!e||0===Object.keys(e).length||!{}.hasOwnProperty.call(e,"name"))throw Error("Missing required option `name`");var r=e.version?e.name+"/"+e.version:e.name,o=void 0;e.libraryName&&!e.libraryVersion?o=e.libraryName:e.libraryName&&e.libraryVersion&&(o=e.libraryName+"/"+e.libraryVersion);var i=void 0;e.contactUrl&&!e.contactEmail?i="(+"+e.contactUrl+")":!e.contactUrl&&e.contactEmail?i="(+"+e.contactEmail+")":e.contactUrl&&e.contactEmail&&(i="(+"+e.contactUrl+"; +"+e.contactEmail+")");var u=n(t);return[r,u,o,i].filter(function(e){return!!e}).join(" ")}function n(t){if(t&&t.navigator)return t.navigator.userAgent;var r=e.version.slice(1),n="("+e.platform+"; "+e.arch+")";return"Node.js/"+r+" "+n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r}).call(t,r(4))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(1),i=n(o);t.default=i.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=(0,a.default)(i({name:"commercetools-js-sdk"},e));return function(e){return function(r,n){var o=i({},r,{headers:i({},r.headers,{"User-Agent":t})});e(o,n)}}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=o;var u=r(2),a=n(u)},function(e,t){function r(){throw Error("setTimeout has not been defined")}function n(){throw Error("clearTimeout has not been defined")}function o(e){if(s===setTimeout)return setTimeout(e,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===n||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function u(){h&&m&&(h=!1,m.length?v=m.concat(v):p=-1,v.length&&a())}function a(){if(!h){var e=o(u);h=!0;for(var t=v.length;t;){for(m=v,v=[];++p<t;)m&&m[p].run();p=-1,t=v.length}m=null,h=!1,i(e)}}function c(e,t){this.fun=e,this.array=t}function l(){}var s,f,d=e.exports={};!function(){try{s="function"==typeof setTimeout?setTimeout:r}catch(e){s=r}try{f="function"==typeof clearTimeout?clearTimeout:n}catch(e){f=n}}();var m,v=[],h=!1,p=-1;d.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;arguments.length>r;r++)t[r-1]=arguments[r];v.push(new c(e,t)),1!==v.length||h||o(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=l,d.addListener=l,d.once=l,d.off=l,d.removeListener=l,d.removeAllListeners=l,d.emit=l,d.binding=function(e){throw Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw Error("process.chdir is not supported")},d.umask=function(){return 0}}])}); |
@@ -11,5 +11,5 @@ 'use strict'; | ||
var _createUserAgent = require('./create-user-agent'); | ||
var _httpUserAgent = require('@commercetools/http-user-agent'); | ||
var _createUserAgent2 = _interopRequireDefault(_createUserAgent); | ||
var _httpUserAgent2 = _interopRequireDefault(_httpUserAgent); | ||
@@ -19,3 +19,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function createUserAgentMiddleware(options) { | ||
var userAgent = (0, _createUserAgent2.default)(options); | ||
var userAgent = (0, _httpUserAgent2.default)(_extends({ | ||
name: 'commercetools-js-sdk' | ||
}, options)); | ||
@@ -22,0 +24,0 @@ return function (next) { |
@@ -7,3 +7,3 @@ { | ||
"name": "@commercetools/sdk-middleware-user-agent", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Middleware for setting the User-Agent on the HTTP request, to use with @commercetools/sdk-client", | ||
@@ -33,3 +33,6 @@ "keywords": [ | ||
"build:umd:min": "cross-env cross-env NODE_ENV=production webpack --config ../../webpack.config.js --output-library CommercetoolsSdkMiddlewareUserAgent --output-library-target umd src/index.js dist/commercetools-sdk-middleware-user-agent.min.js" | ||
}, | ||
"dependencies": { | ||
"@commercetools/http-user-agent": "1.0.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18598
1
7
334
+ Added@commercetools/http-user-agent@1.0.0(transitive)