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

@commercetools/sdk-middleware-user-agent

Package Overview
Dependencies
Maintainers
9
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools/sdk-middleware-user-agent - npm Package Compare versions

Comparing version 1.2.6 to 1.2.7

1

dist/commercetools-sdk-middleware-user-agent.cjs.js

@@ -67,2 +67,3 @@ 'use strict';

/* */
function createUserAgentMiddleware(options) {

@@ -69,0 +70,0 @@ var userAgent = createUserAgent(_extends({

@@ -63,2 +63,3 @@ /* */

/* */
function createUserAgentMiddleware(options) {

@@ -65,0 +66,0 @@ var userAgent = createUserAgent(_extends({

131

dist/commercetools-sdk-middleware-user-agent.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.CommercetoolsSdkMiddlewareUserAgent = {})));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.CommercetoolsSdkMiddlewareUserAgent = {})));
}(this, (function (exports) { 'use strict';
/* */
/* */
/* global window */
/* global window */
/*
This is the easiest way, for this use case, to detect if we're running in
Node.js or in a browser environment. In other cases, this won't be even a
problem as Rollup will provide the correct polyfill in the bundle.
The main advantage by doing it this way is that it allows to easily test
the code running in both environments, by overriding `global.window` in
the specific test.
*/
/*
This is the easiest way, for this use case, to detect if we're running in
Node.js or in a browser environment. In other cases, this won't be even a
problem as Rollup will provide the correct polyfill in the bundle.
The main advantage by doing it this way is that it allows to easily test
the code running in both environments, by overriding `global.window` in
the specific test.
*/
var isBrowser = function isBrowser() {
return typeof window !== 'undefined' && window.document && window.document.nodeType === 9;
};
var isBrowser = function isBrowser() {
return typeof window !== 'undefined' && window.document && window.document.nodeType === 9;
};
function getSystemInfo() {
if (isBrowser()) return window.navigator.userAgent;
function getSystemInfo() {
if (isBrowser()) return window.navigator.userAgent;
var nodeVersion = process.version.slice(1);
var platformInfo = '(' + process.platform + '; ' + process.arch + ')';
return 'Node.js/' + nodeVersion + ' ' + platformInfo;
}
var nodeVersion = process.version.slice(1);
var platformInfo = '(' + process.platform + '; ' + process.arch + ')';
return 'Node.js/' + nodeVersion + ' ' + platformInfo;
}
function createUserAgent(options) {
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`');
function createUserAgent(options) {
if (!options || Object.keys(options).length === 0 || !{}.hasOwnProperty.call(options, 'name')) throw new Error('Missing required option `name`');
// Main info
var baseInfo = options.version ? options.name + '/' + options.version : options.name;
// Main info
var baseInfo = options.version ? options.name + '/' + options.version : options.name;
// Library info
var libraryInfo = void 0;
if (options.libraryName && !options.libraryVersion) libraryInfo = options.libraryName;else if (options.libraryName && options.libraryVersion) libraryInfo = options.libraryName + '/' + options.libraryVersion;
// Library info
var libraryInfo = void 0;
if (options.libraryName && !options.libraryVersion) libraryInfo = options.libraryName;else if (options.libraryName && options.libraryVersion) libraryInfo = options.libraryName + '/' + options.libraryVersion;
// 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 + ')';
// 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();
// System info
var systemInfo = getSystemInfo();
return [baseInfo, systemInfo, libraryInfo, contactInfo].filter(function (x) {
return Boolean(x);
}).join(' ');
}
return [baseInfo, systemInfo, libraryInfo, contactInfo].filter(function (x) {
return Boolean(x);
}).join(' ');
}
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
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];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
};
return target;
};
/* */
function createUserAgentMiddleware(options) {
var userAgent = createUserAgent(_extends({
name: 'commercetools-js-sdk'
}, options));
/* */
return function (next) {
return function (request, response) {
var requestWithUserAgent = _extends({}, request, {
headers: _extends({}, request.headers, {
'User-Agent': userAgent
})
});
next(requestWithUserAgent, response);
function createUserAgentMiddleware(options) {
var userAgent = createUserAgent(_extends({
name: 'commercetools-js-sdk'
}, options));
return function (next) {
return function (request, response) {
var requestWithUserAgent = _extends({}, request, {
headers: _extends({}, request.headers, {
'User-Agent': userAgent
})
});
next(requestWithUserAgent, response);
};
};
};
}
}
// eslint-disable-next-line import/prefer-default-export
// eslint-disable-next-line import/prefer-default-export
exports.createUserAgentMiddleware = createUserAgentMiddleware;
exports.createUserAgentMiddleware = createUserAgentMiddleware;
Object.defineProperty(exports, '__esModule', { value: true });
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=commercetools-sdk-middleware-user-agent.umd.js.map

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

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.CommercetoolsSdkMiddlewareUserAgent={})}(this,function(e){"use strict";var r=function(){return"undefined"!=typeof window&&window.document&&9===window.document.nodeType};function n(e){if(!e||0===Object.keys(e).length||!{}.hasOwnProperty.call(e,"name"))throw new Error("Missing required option `name`");var n=e.version?e.name+"/"+e.version:e.name,t=void 0;e.libraryName&&!e.libraryVersion?t=e.libraryName:e.libraryName&&e.libraryVersion&&(t=e.libraryName+"/"+e.libraryVersion);var o=void 0;return e.contactUrl&&!e.contactEmail?o="(+"+e.contactUrl+")":!e.contactUrl&&e.contactEmail?o="(+"+e.contactEmail+")":e.contactUrl&&e.contactEmail&&(o="(+"+e.contactUrl+"; +"+e.contactEmail+")"),[n,r()?window.navigator.userAgent:"Node.js/"+process.version.slice(1)+" ("+process.platform+"; "+process.arch+")",t,o].filter(function(e){return Boolean(e)}).join(" ")}var t=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e};e.createUserAgentMiddleware=function(e){var r=n(t({name:"commercetools-js-sdk"},e));return function(e){return function(n,o){var a=t({},n,{headers:t({},n.headers,{"User-Agent":r})});e(a,o)}}},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.CommercetoolsSdkMiddlewareUserAgent={})}(this,function(e){"use strict";var o=function(){return"undefined"!=typeof window&&window.document&&9===window.document.nodeType};function r(e){if(!e||0===Object.keys(e).length||!{}.hasOwnProperty.call(e,"name"))throw new Error("Missing required option `name`");var r=e.version?e.name+"/"+e.version:e.name,n=void 0;e.libraryName&&!e.libraryVersion?n=e.libraryName:e.libraryName&&e.libraryVersion&&(n=e.libraryName+"/"+e.libraryVersion);var t=void 0;return e.contactUrl&&!e.contactEmail?t="(+"+e.contactUrl+")":!e.contactUrl&&e.contactEmail?t="(+"+e.contactEmail+")":e.contactUrl&&e.contactEmail&&(t="(+"+e.contactUrl+"; +"+e.contactEmail+")"),[r,o()?window.navigator.userAgent:"Node.js/"+process.version.slice(1)+" ("+process.platform+"; "+process.arch+")",n,t].filter(function(e){return Boolean(e)}).join(" ")}var a=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e};e.createUserAgentMiddleware=function(e){var o=r(a({name:"commercetools-js-sdk"},e));return function(t){return function(e,r){var n=a({},e,{headers:a({},e.headers,{"User-Agent":o})});t(n,r)}}},Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=commercetools-sdk-middleware-user-agent.umd.min.js.map

@@ -7,3 +7,3 @@ {

"name": "@commercetools/sdk-middleware-user-agent",
"version": "1.2.6",
"version": "1.2.7",
"description": "Middleware for setting the User-Agent on the HTTP request, to use with @commercetools/sdk-client",

@@ -39,4 +39,4 @@ "keywords": [

"dependencies": {
"@commercetools/http-user-agent": "^1.1.6"
"@commercetools/http-user-agent": "^1.1.7"
}
}

Sorry, the diff of this file is not supported yet

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