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

@gocommerce/utils

Package Overview
Dependencies
Maintainers
5
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gocommerce/utils - npm Package Compare versions

Comparing version 0.6.7 to 0.6.8

yarn-error.log

23

dist/buildGraphQLError.js

@@ -6,18 +6,27 @@ 'use strict';

});
exports.default = buildGraphQLError;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
exports.default = buildGraphQLError;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function buildGraphQLError(message, code, customFields) {
var CustomError = function (_Error) {
_inherits(CustomError, _Error);
(0, _inherits3.default)(CustomError, _Error);
function CustomError() {
_classCallCheck(this, CustomError);
(0, _classCallCheck3.default)(this, CustomError);
var _this = _possibleConstructorReturn(this, (CustomError.__proto__ || Object.getPrototypeOf(CustomError)).apply(this, arguments));
var _this = (0, _possibleConstructorReturn3.default)(this, (CustomError.__proto__ || Object.getPrototypeOf(CustomError)).apply(this, arguments));

@@ -24,0 +33,0 @@ _this.code = code;

@@ -6,7 +6,20 @@ 'use strict';

});
exports.getStaticUrl = exports.isGoCommerceAcc = exports.objectToQueryString = exports.removeValueInArray = exports.swapValueInArray = exports.objectToLogger = exports.flatter = exports.getSubset = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof2 = require('babel-runtime/helpers/typeof');
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; };
var _typeof3 = _interopRequireDefault(_typeof2);
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends4 = require('babel-runtime/helpers/extends');
var _extends5 = _interopRequireDefault(_extends4);
exports.isObject = isObject;

@@ -16,6 +29,4 @@ exports.isObjectEmpty = isObjectEmpty;

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**

@@ -26,3 +37,3 @@ * receive a object and a array of string, returns all keys of the first level that match in the array

return keys.reduce(function (a, c) {
return !obj[c] ? a : _extends({}, a, _defineProperty({}, c, obj[c]));
return !obj[c] ? a : (0, _extends5.default)({}, a, (0, _defineProperty3.default)({}, c, obj[c]));
}, {});

@@ -38,3 +49,3 @@ };

return object != null && Object.keys(object).reduce(function (prev, element) {
return object[element] != null && isObject(object[element]) ? _extends({}, prev, flatter(object[element], '' + prefix + element + '-')) : _extends({}, prev, _defineProperty({}, '' + prefix + element, object[element]));
return object[element] != null && isObject(object[element]) ? (0, _extends5.default)({}, prev, flatter(object[element], '' + prefix + element + '-')) : (0, _extends5.default)({}, prev, (0, _defineProperty3.default)({}, '' + prefix + element, object[element]));
}, {});

@@ -47,3 +58,3 @@ };

var objectToLogger = exports.objectToLogger = function objectToLogger(apiData) {
var sendObject = _extends({
var sendObject = (0, _extends5.default)({
time: +new Date(),

@@ -62,3 +73,3 @@ type: 'Error',

var swapValueInArray = exports.swapValueInArray = function swapValueInArray(newValue, index, array) {
return [].concat(_toConsumableArray(array.slice(0, index)), [newValue], _toConsumableArray(array.slice(index + 1, array.length)));
return [].concat((0, _toConsumableArray3.default)(array.slice(0, index)), [newValue], (0, _toConsumableArray3.default)(array.slice(index + 1, array.length)));
};

@@ -70,3 +81,3 @@ /**

var removeValueInArray = exports.removeValueInArray = function removeValueInArray(index, array) {
return [].concat(_toConsumableArray(array.slice(0, index)), _toConsumableArray(array.slice(index + 1, array.length)));
return [].concat((0, _toConsumableArray3.default)(array.slice(0, index)), (0, _toConsumableArray3.default)(array.slice(index + 1, array.length)));
};

@@ -78,3 +89,3 @@ /**

function isObject(item) {
return item && (typeof item === 'undefined' ? 'undefined' : _typeof(item)) === 'object' && !Array.isArray(item);
return item && (typeof item === 'undefined' ? 'undefined' : (0, _typeof3.default)(item)) === 'object' && !Array.isArray(item);
}

@@ -97,3 +108,3 @@ /**

if (isObject(source[key])) {
if (!(key in target)) Object.assign(output, _defineProperty({}, key, source[key]));else {
if (!(key in target)) Object.assign(output, (0, _defineProperty3.default)({}, key, source[key]));else {
output[key] = mergeDeep(target[key], source[key]);

@@ -103,6 +114,6 @@ }

if (typeof source[key] === 'boolean') {
Object.assign(output, _defineProperty({}, key, !target[key]));
Object.assign(output, (0, _defineProperty3.default)({}, key, !target[key]));
}
} else {
Object.assign(output, _defineProperty({}, key, source[key]));
Object.assign(output, (0, _defineProperty3.default)({}, key, source[key]));
}

@@ -109,0 +120,0 @@ });

@@ -7,4 +7,10 @@ 'use strict';

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; };
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends4 = require('babel-runtime/helpers/extends');
var _extends5 = _interopRequireDefault(_extends4);
exports.default = function (ctx, request, response, TOKEN) {

@@ -17,6 +23,6 @@ var type = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'none';

var requestData = requestKeys.reduce(function (prev, next) {
return _extends({}, prev, _defineProperty({}, 'request-' + next, request[next]));
return (0, _extends5.default)({}, prev, (0, _defineProperty3.default)({}, 'request-' + next, request[next]));
}, {});
var responsetData = responseKeys.reduce(function (prev, next) {
return _extends({}, prev, _defineProperty({}, 'response-' + next, response[next]));
return (0, _extends5.default)({}, prev, (0, _defineProperty3.default)({}, 'response-' + next, response[next]));
}, {});

@@ -35,3 +41,3 @@ // const requestData = getSubset(requestKeys, request)

source: SOURCE,
event: _extends({}, flattterApiData, requestData, responsetData, { sourcetype: 'devLog' }),
event: (0, _extends5.default)({}, flattterApiData, requestData, responsetData, { sourcetype: 'devLog' }),
sourcetype: 'json',

@@ -70,5 +76,3 @@ index: SOURCE

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SOURCE = 'gc_ui';
var SPLUNK_URI = 'http://splunk-heavyforwarder-public.vtex.com/services/collector/event?channel=' + (0, _v2.default)() + '&source=' + SOURCE;

@@ -7,6 +7,22 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
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; };
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
var _extends4 = require('babel-runtime/helpers/extends');
var _extends5 = _interopRequireDefault(_extends4);
var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _metricLogger = require('./metricLogger');

@@ -26,6 +42,2 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
var getCurrentTime = function getCurrentTime() {

@@ -38,5 +50,5 @@ return new Date().getTime();

return function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_, args, ctx, info) {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(_, args, ctx, info) {
var metricId, start_time, response, endHandler;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {

@@ -51,4 +63,4 @@ switch (_context2.prev = _context2.next) {

return resolver(_, args, ctx, info, function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, method, payload, adicionalHeaders) {
return regeneratorRuntime.wrap(function _callee$(_context) {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(url, method, payload, adicionalHeaders) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -103,4 +115,4 @@ switch (_context.prev = _context.next) {

return Object.keys(resolvers).reduce(function (prev, rootResolverName) {
return _extends({}, prev, _defineProperty({}, rootResolverName, _typeof(resolvers[rootResolverName]) !== 'object' ? addLoggerToResolver(splunkToken, resolvers[rootResolverName]) : Object.keys(resolvers[rootResolverName]).reduce(function (prev, fieldResolverName) {
return _extends({}, prev, _defineProperty({}, fieldResolverName, addLoggerToResolver(splunkToken, resolvers[rootResolverName][fieldResolverName])));
return (0, _extends5.default)({}, prev, (0, _defineProperty3.default)({}, rootResolverName, (0, _typeof3.default)(resolvers[rootResolverName]) !== 'object' ? addLoggerToResolver(splunkToken, resolvers[rootResolverName]) : Object.keys(resolvers[rootResolverName]).reduce(function (prev, fieldResolverName) {
return (0, _extends5.default)({}, prev, (0, _defineProperty3.default)({}, fieldResolverName, addLoggerToResolver(splunkToken, resolvers[rootResolverName][fieldResolverName])));
}, {})));

@@ -107,0 +119,0 @@ }, {});

@@ -7,6 +7,18 @@ 'use strict';

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; };
var _regenerator = require('babel-runtime/regenerator');
require('babel-polyfill');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends3 = require('babel-runtime/helpers/extends');
var _extends4 = _interopRequireDefault(_extends3);
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _axios = require('axios');

@@ -28,8 +40,4 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
var makeApiCall = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(metricId, url, ctx, method, splunkToken, fieldName, payload) {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(metricId, url, ctx, method, splunkToken, fieldName, payload) {
var adicionalHeaders = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};

@@ -39,3 +47,3 @@

return regeneratorRuntime.wrap(function _callee$(_context) {
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {

@@ -57,3 +65,3 @@ switch (_context.prev = _context.next) {

withCredentials: true,
headers: _extends(_defineProperty({
headers: (0, _extends4.default)((0, _defineProperty3.default)({
'Proxy-Authorization': ctx.vtex.authToken,

@@ -66,3 +74,3 @@ 'Cache-Control': 'public, max-age=3',

_metricLogger = function _metricLogger(action, adicionalInformation) {
return (0, _metricLogger3.default)(metricId, ctx, action, _extends({
return (0, _metricLogger3.default)(metricId, ctx, action, (0, _extends4.default)({
requestUrl: requestParams.baseURL + requestParams.url,

@@ -69,0 +77,0 @@ method: requestParams.method,

@@ -7,4 +7,10 @@ 'use strict';

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; };
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends3 = require('babel-runtime/helpers/extends');
var _extends4 = _interopRequireDefault(_extends3);
var _axios = require('axios');

@@ -20,4 +26,2 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SPLUNK_ENDPOINT = 'splunk-heavyforwarder-public.vtex.com';

@@ -40,3 +44,3 @@ var splunkEvents = new _splunkEvents2.default();

var userAgent = vtex.userAgent.split('@');
var event = _extends({}, data, {
var event = (0, _extends4.default)({}, data, {
resolverName: fieldName,

@@ -57,4 +61,4 @@ requestid: id,

var headers = context.headers || {};
return (0, _axios2.default)(_extends({}, context, {
headers: _extends({}, headers, _defineProperty({
return (0, _axios2.default)((0, _extends4.default)({}, context, {
headers: (0, _extends4.default)({}, headers, (0, _defineProperty3.default)({
'Proxy-Authorization': vtex.authToken,

@@ -61,0 +65,0 @@ 'X-Vtex-Proxy-To': 'https://' + SPLUNK_ENDPOINT + ':8088'

{
"name": "@gocommerce/utils",
"version": "0.6.7",
"version": "0.6.8",
"description": "",

@@ -16,4 +16,3 @@ "main": "dist/index.js",

"typescript": "3.0.3",
"uuid": "3.2.1",
"babel-polyfill": "^6.26.0"
"uuid": "3.2.1"
},

@@ -25,3 +24,3 @@ "devDependencies": {

"babel-core": "^6.26.0",
"babel-loader": "^6.4.1",
"babel-loader": "^8.0.6",
"babel-plugin-lodash": "^3.2.11",

@@ -33,8 +32,8 @@ "babel-plugin-syntax-dynamic-import": "^6.18.0",

"babel-plugin-transform-react-remove-prop-types": "^0.4.8",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "1.7.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2017": "^6.24.1",
"babel-preset-react": "6.24.1",
"babel-register": "6.26.0"
"babel-preset-react": "6.24.1"
}
}

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