@shipengine/alchemy 6.0.21 → 6.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +36 -141
  2. package/index.mjs +35 -142
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -13739,6 +13739,37 @@ const getEndUserIpAddress = () => __async$U(void 0, null, function* () {
13739
13739
  }
13740
13740
  });
13741
13741
 
13742
+ const camelizeKeys = (obj) => {
13743
+ if (Array.isArray(obj)) {
13744
+ return obj.map(camelizeKeys);
13745
+ } else if (obj !== null && typeof obj === "object") {
13746
+ const newObj = {};
13747
+ for (const key in obj) {
13748
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
13749
+ const newKey = key.replace(/_([a-z])/g, (match, letter) => letter.toUpperCase());
13750
+ newObj[newKey] = camelizeKeys(obj[key]);
13751
+ }
13752
+ }
13753
+ return newObj;
13754
+ }
13755
+ return obj;
13756
+ };
13757
+ const decamelizeKeys = (obj, separator = "_") => {
13758
+ if (Array.isArray(obj)) {
13759
+ return obj.map((item) => decamelizeKeys(item, separator));
13760
+ } else if (obj !== null && typeof obj === "object") {
13761
+ const newObj = {};
13762
+ for (const key in obj) {
13763
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
13764
+ const newKey = key.replace(/([A-Z])/g, (match) => separator + match.toLowerCase());
13765
+ newObj[newKey] = decamelizeKeys(obj[key], separator);
13766
+ }
13767
+ }
13768
+ return newObj;
13769
+ }
13770
+ return obj;
13771
+ };
13772
+
13742
13773
  var __defProp$r = Object.defineProperty;
13743
13774
  var __defProps$l = Object.defineProperties;
13744
13775
  var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
@@ -13991,144 +14022,6 @@ class ConnectionsAPI {
13991
14022
 
13992
14023
  var o={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},l={};function a(e){return "string"==typeof e?o[e.toLowerCase()]:e}function c(e,r){return c=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},c(e,r)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return !1}}function f(e,r,t){return f=u()?Reflect.construct:function(e,r,t){var s=[null];s.push.apply(s,r);var i=new(Function.bind.apply(e,s));return t&&c(i,t.prototype),i},f.apply(null,arguments)}function h(e){if(null==e)return e;if(Array.isArray(e))return e.slice();if("object"==typeof e){var r={};return Object.keys(e).forEach(function(t){r[t]=e[t];}),r}return e}function v(e){return void 0===e?"undefined":null===e?"null":Array.isArray(e)?"[ "+e.map(function(e){return v(e)}).join(", ")+" ]":"object"==typeof e?JSON.stringify(e):"function"==typeof e?"[Function: "+e.name+"]":"boolean"==typeof e||"number"==typeof e?e:"'"+e.toString()+"'"}function p(e){if("string"!=typeof e){for(var r=new Array(arguments.length),t=0;t<arguments.length;t++)r[t]=v(arguments[t]);return r.join(" ")}for(var s=/%[sdj%]/g,i=1,n=arguments,o=n.length,l=String(e).replace(s,function(e){if("%%"===e)return "%";if(i>=o)return e;switch(e){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch(e){return "[Circular]"}default:return e}}),a=n[i];i<o;a=n[++i])l+=null===a||"object"!=typeof a?" "+a:" "+v(a);return l}function m(e,r){var t=e.split("\n");t[0]&&t[0].indexOf("call-stack-error")>=0&&t.shift();var s=t[r],i=null;if(s){var n=/^\s*(at|.*@)\s*(.+)?$/.exec(s);i=Array.isArray(n)&&n[2]?n[2]:s;}return i}Object.keys(o).forEach(function(e){l[o[e]]=e;});var y={};function d(e,r){if(r){if(y[r])return;y[r]=!0;}console.error(e+"\n");}function g(e){return y[e]}function w(){var e=[];return function(r,t){return t&&"object"==typeof t?-1!==e.indexOf(t)?"[Circular]":(e.push(t),t):t}}var b=/*#__PURE__*/function(){function e(){}return e.prototype.write=function(e){e.level<30?console.log(e):e.level<40?console.info(e):e.level<50?console.warn(e):console.error(e),e.err&&e.err.stack&&console.error(e.err.stack),e.obj&&console.log(e.obj);},e}(),j=/*#__PURE__*/function(){function e(r,t,s){var i,n,o,l,a=this;if(!(this instanceof e))return new e(r,t);if(void 0!==t&&(i=r,r=t,!(i instanceof e)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!r)throw new TypeError("options (object) is required");if(i){if(r.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!r.name)throw new TypeError("options.name (string) is required");if(r.stream&&r.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(r.streams&&!Array.isArray(r.streams))throw new TypeError("invalid options.streams: must be an array");if(r.serializers&&("object"!=typeof r.serializers||Array.isArray(r.serializers)))throw new TypeError("invalid options.serializers: must be an object");if(i&&s){this._level=i._level,this.streams=i.streams,this.serializers=i.serializers,this.src=i.src,n=this.fields={};var c=Object.keys(i.fields);for(l=0;l<c.length;l++)n[o=c[l]]=i.fields[o];var u=Object.keys(r);for(l=0;l<u.length;l++)n[o=u[l]]=r[o];}else {if(i){for(this._level=i._level,this.streams=[],l=0;l<i.streams.length;l++){var f=h(i.streams[l]);this.streams.push(f);}this.serializers=h(i.serializers),this.src=i.src,this.fields=h(i.fields),r.level&&this.level(r.level);}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};r.stream?this.addStream({type:"stream",stream:r.stream,level:r.level}):r.streams?r.streams.forEach(function(e){a.addStream(e,r.level);}):i&&r.level?this.level(r.level):i||this.addStream({type:"raw",stream:new b,level:r.level}),r.serializers&&this.addSerializers(r.serializers),r.src&&(this.src=!0),delete(n=h(r)).stream,delete n.level,delete n.streams,delete n.serializers,delete n.src,this.serializers&&this._applySerializers(n),Object.keys(n).forEach(function(e){a.fields[e]=n[e];});}}var r=e.prototype;return r.addStream=function(e,r){void 0===r&&(r=30),(e=h(e)).type="raw",e.level=a(e.level||r),e.level<this._level&&(this._level=e.level),this.streams.push(e),delete this.haveNonRawStreams;},r.addSerializers=function(e){var r=this;this.serializers||(this.serializers={}),Object.keys(e).forEach(function(t){var s=e[t];if("function"!=typeof s)throw new TypeError(p('invalid serializer for "%s" field: must be a function',t));r.serializers[t]=s;});},r.child=function(e,r){return new this.constructor(this,e||{},r)},r.level=function(e){if(void 0===e)return this._level;for(var r=a(e),t=this.streams.length,s=0;s<t;s++)this.streams[s].level=r;this._level=r;},r.levels=function(e,r){if(void 0===e)return this.streams.map(function(e){return e.level});var t;if("number"==typeof e){if(void 0===(t=this.streams[e]))throw new Error("invalid stream index: "+e)}else {for(var s=this.streams.length,i=0;i<s;i++){var n=this.streams[i];if(n.name===e){t=n;break}}if(!t)throw new Error(p('no stream with name "%s"',e))}if(void 0===r)return t.level;var o=a(r);t.level=o,o<this._level&&(this._level=o);},r._applySerializers=function(e,r){var t=this;Object.keys(this.serializers).forEach(function(s){if(!(void 0===e[s]||r&&r[s]))try{e[s]=t.serializers[s](e[s]);}catch(r){d(p('bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bugin that serializer function.\n%s',s,r.stack||r)),e[s]=p('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',s);}});},r._emit=function(e,r){var t,s;if(void 0===this.haveNonRawStreams)for(this.haveNonRawStreams=!1,t=0;t<this.streams.length;t++)if(!this.streams[t].raw){this.haveNonRawStreams=!0;break}if(r||this.haveNonRawStreams)try{s=JSON.stringify(e,w())+"\n";}catch(r){var i=r.stack.split(/\n/g,2).join("\n");d('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n'+function(e,r){return r||(r=" "),r+e.split(/\r?\n/g).join("\n"+r)}(p("%s\n%s",e,r.stack)),i),s=p("(Exception in JSON.stringify(rec): %j. See stderr for details.)\n",r.message);}if(r)return s;var n=e.level;for(t=0;t<this.streams.length;t++){var o=this.streams[t];o.level<=n&&o.stream.write(e);}return s},e}();function z(e){return function(){var r=this;function t(t){var n;t[0]instanceof Error?(s={err:r.serializers&&r.serializers.err?r.serializers.err(t[0]):k.err(t[0])},n={err:!0},i=1===t.length?[s.err.message]:Array.prototype.slice.call(t,1)):"object"!=typeof t[0]&&null!==t[0]||Array.isArray(t[0])?(s=null,i=Array.prototype.slice.call(t)):(s=t[0],i=1===t.length&&s.err&&s.err instanceof Error?[s.err.message]:Array.prototype.slice.call(t,1));var o=h(r.fields);o.level=e;var a=s?h(s):null;if(a&&(r.serializers&&r._applySerializers(a,n),Object.keys(a).forEach(function(e){o[e]=a[e];})),o.levelName=l[e],o.msg=i.length?p.apply(r,i):"",o.time||(o.time=new Date),r.src&&!o.src)try{throw new Error("call-stack-error")}catch(e){var c=e.stack?m(e.stack,2):"";c||g("src")||d("Unable to determine src line info","src"),o.src=c||"";}return o.v=1,o}var s=null,i=arguments,n=null;if(0===arguments.length)return this._level<=e;this._level>e||(n=t(i),this._emit(n));}}function S(e){var r=e.stack||e.toString();if(e.cause&&"function"==typeof e.cause){var t=e.cause();t&&(r+="\nCaused by: "+S(t));}return r}j.prototype.trace=z(10),j.prototype.debug=z(20),j.prototype.info=z(30),j.prototype.warn=z(40),j.prototype.error=z(50),j.prototype.fatal=z(60);var k={err:function(e){return e&&e.stack?{message:e.message,name:e.name,stack:S(e),code:e.code,signal:e.signal}:e}};function E(){return f(j,[].slice.call(arguments))}var A={levels:{trace:"color: DeepPink",debug:"color: GoldenRod",info:"color: DarkTurquoise",warn:"color: Purple",error:"color: Crimson",fatal:"color: Black"},def:"color: DimGray",msg:"color: SteelBlue",src:"color: DimGray; font-style: italic; font-size: 0.9em"},R=/*#__PURE__*/function(){function e(e){var r=void 0===e?{}:e,t=r.logByLevel,s=r.css,i=void 0===s?A:s;this.logByLevel=void 0!==t&&t,this.css=i;}return e.prototype.write=function(e){var r,t,s=this.css.def,i=this.css.msg,n=this.css.src,o=e.childName?e.name+"/"+e.childName:e.name,a=l[e.level],c=(Array(6-a.length).join(" ")+a).toUpperCase();this.logByLevel?(10===e.level?a="debug":60===e.level&&(a="error"),t="function"==typeof console[a]?console[a]:console.log):t=console.log,r=e.level<20?this.css.levels.trace:e.level<30?this.css.levels.debug:e.level<40?this.css.levels.info:e.level<50?this.css.levels.warn:e.level<60?this.css.levels.error:this.css.levels.fatal;var u=function(e,r){return Array(r+1-(e+"").length).join("0")+e},f=[];f.push("[%s:%s:%s:%s] %c%s%c: %s: %c%s "+(e.src?"%c%s":"")),f.push(u(e.time.getHours(),2)),f.push(u(e.time.getMinutes(),2)),f.push(u(e.time.getSeconds(),2)),f.push(u(e.time.getMilliseconds(),4)),f.push(r),f.push(c),f.push(s),f.push(o),f.push(i),f.push(e.msg),e.src&&(f.push(n),f.push(e.src)),e.obj&&(f.push("\n"),f.push(e.obj)),e.err&&e.err.stack&&(f.push("\n"),f.push(e.err.stack)),t.apply(console,f);},e.getDefaultCss=function(){return A},e}();
13993
14024
 
13994
- var humpsExports = {};
13995
- var humps = {
13996
- get exports(){ return humpsExports; },
13997
- set exports(v){ humpsExports = v; },
13998
- };
13999
-
14000
- (function (module) {
14001
- (function(global) {
14002
-
14003
- var _processKeys = function(convert, obj, options) {
14004
- if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) {
14005
- return obj;
14006
- }
14007
-
14008
- var output,
14009
- i = 0,
14010
- l = 0;
14011
-
14012
- if(_isArray(obj)) {
14013
- output = [];
14014
- for(l=obj.length; i<l; i++) {
14015
- output.push(_processKeys(convert, obj[i], options));
14016
- }
14017
- }
14018
- else {
14019
- output = {};
14020
- for(var key in obj) {
14021
- if(Object.prototype.hasOwnProperty.call(obj, key)) {
14022
- output[convert(key, options)] = _processKeys(convert, obj[key], options);
14023
- }
14024
- }
14025
- }
14026
- return output;
14027
- };
14028
-
14029
- // String conversion methods
14030
-
14031
- var separateWords = function(string, options) {
14032
- options = options || {};
14033
- var separator = options.separator || '_';
14034
- var split = options.split || /(?=[A-Z])/;
14035
-
14036
- return string.split(split).join(separator);
14037
- };
14038
-
14039
- var camelize = function(string) {
14040
- if (_isNumerical(string)) {
14041
- return string;
14042
- }
14043
- string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) {
14044
- return chr ? chr.toUpperCase() : '';
14045
- });
14046
- // Ensure 1st char is always lowercase
14047
- return string.substr(0, 1).toLowerCase() + string.substr(1);
14048
- };
14049
-
14050
- var pascalize = function(string) {
14051
- var camelized = camelize(string);
14052
- // Ensure 1st char is always uppercase
14053
- return camelized.substr(0, 1).toUpperCase() + camelized.substr(1);
14054
- };
14055
-
14056
- var decamelize = function(string, options) {
14057
- return separateWords(string, options).toLowerCase();
14058
- };
14059
-
14060
- // Utilities
14061
- // Taken from Underscore.js
14062
-
14063
- var toString = Object.prototype.toString;
14064
-
14065
- var _isFunction = function(obj) {
14066
- return typeof(obj) === 'function';
14067
- };
14068
- var _isObject = function(obj) {
14069
- return obj === Object(obj);
14070
- };
14071
- var _isArray = function(obj) {
14072
- return toString.call(obj) == '[object Array]';
14073
- };
14074
- var _isDate = function(obj) {
14075
- return toString.call(obj) == '[object Date]';
14076
- };
14077
- var _isRegExp = function(obj) {
14078
- return toString.call(obj) == '[object RegExp]';
14079
- };
14080
- var _isBoolean = function(obj) {
14081
- return toString.call(obj) == '[object Boolean]';
14082
- };
14083
-
14084
- // Performant way to determine if obj coerces to a number
14085
- var _isNumerical = function(obj) {
14086
- obj = obj - 0;
14087
- return obj === obj;
14088
- };
14089
-
14090
- // Sets up function which handles processing keys
14091
- // allowing the convert function to be modified by a callback
14092
- var _processor = function(convert, options) {
14093
- var callback = options && 'process' in options ? options.process : options;
14094
-
14095
- if(typeof(callback) !== 'function') {
14096
- return convert;
14097
- }
14098
-
14099
- return function(string, options) {
14100
- return callback(string, convert, options);
14101
- }
14102
- };
14103
-
14104
- var humps = {
14105
- camelize: camelize,
14106
- decamelize: decamelize,
14107
- pascalize: pascalize,
14108
- depascalize: decamelize,
14109
- camelizeKeys: function(object, options) {
14110
- return _processKeys(_processor(camelize, options), object);
14111
- },
14112
- decamelizeKeys: function(object, options) {
14113
- return _processKeys(_processor(decamelize, options), object, options);
14114
- },
14115
- pascalizeKeys: function(object, options) {
14116
- return _processKeys(_processor(pascalize, options), object);
14117
- },
14118
- depascalizeKeys: function () {
14119
- return this.decamelizeKeys.apply(this, arguments);
14120
- }
14121
- };
14122
-
14123
- if (module.exports) {
14124
- module.exports = humps;
14125
- } else {
14126
- global.humps = humps;
14127
- }
14128
-
14129
- })(commonjsGlobal);
14130
- } (humps));
14131
-
14132
14025
  class InvalidTokenError extends Error {
14133
14026
  }
14134
14027
  InvalidTokenError.prototype.name = "InvalidTokenError";
@@ -34343,11 +34236,11 @@ class ShipEngineAPI {
34343
34236
  headers: __spreadProps$k(__spreadValues$n({}, headers), {
34344
34237
  "Content-Type": "application/json"
34345
34238
  }),
34346
- paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
34239
+ paramsSerializer: (params) => lib.stringify(decamelizeKeys(params), { arrayFormat: "brackets" }),
34347
34240
  transformRequest: [
34348
34241
  (data) => {
34349
34242
  if (data && !(data instanceof FormData))
34350
- return humpsExports.decamelizeKeys(data);
34243
+ return decamelizeKeys(data);
34351
34244
  else
34352
34245
  return data;
34353
34246
  },
@@ -34367,7 +34260,7 @@ class ShipEngineAPI {
34367
34260
  },
34368
34261
  (data) => {
34369
34262
  if (data && !(data instanceof Blob))
34370
- return humpsExports.camelizeKeys(data);
34263
+ return camelizeKeys(data);
34371
34264
  else
34372
34265
  return data;
34373
34266
  }
@@ -38880,6 +38773,8 @@ exports.ThemesAPI = ThemesAPI;
38880
38773
  exports.WarehousesAPI = WarehousesAPI;
38881
38774
  exports.WebhooksAPI = WebhooksAPI;
38882
38775
  exports.alchemy = alchemy;
38776
+ exports.camelizeKeys = camelizeKeys;
38777
+ exports.decamelizeKeys = decamelizeKeys;
38883
38778
  exports.default = alchemy;
38884
38779
  exports.delay = delay;
38885
38780
  exports.getEmotionCache = getEmotionCache;
package/index.mjs CHANGED
@@ -13717,6 +13717,37 @@ const getEndUserIpAddress = () => __async$U(void 0, null, function* () {
13717
13717
  }
13718
13718
  });
13719
13719
 
13720
+ const camelizeKeys = (obj) => {
13721
+ if (Array.isArray(obj)) {
13722
+ return obj.map(camelizeKeys);
13723
+ } else if (obj !== null && typeof obj === "object") {
13724
+ const newObj = {};
13725
+ for (const key in obj) {
13726
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
13727
+ const newKey = key.replace(/_([a-z])/g, (match, letter) => letter.toUpperCase());
13728
+ newObj[newKey] = camelizeKeys(obj[key]);
13729
+ }
13730
+ }
13731
+ return newObj;
13732
+ }
13733
+ return obj;
13734
+ };
13735
+ const decamelizeKeys = (obj, separator = "_") => {
13736
+ if (Array.isArray(obj)) {
13737
+ return obj.map((item) => decamelizeKeys(item, separator));
13738
+ } else if (obj !== null && typeof obj === "object") {
13739
+ const newObj = {};
13740
+ for (const key in obj) {
13741
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
13742
+ const newKey = key.replace(/([A-Z])/g, (match) => separator + match.toLowerCase());
13743
+ newObj[newKey] = decamelizeKeys(obj[key], separator);
13744
+ }
13745
+ }
13746
+ return newObj;
13747
+ }
13748
+ return obj;
13749
+ };
13750
+
13720
13751
  var __defProp$r = Object.defineProperty;
13721
13752
  var __defProps$l = Object.defineProperties;
13722
13753
  var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
@@ -13969,144 +14000,6 @@ class ConnectionsAPI {
13969
14000
 
13970
14001
  var o={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},l={};function a(e){return "string"==typeof e?o[e.toLowerCase()]:e}function c(e,r){return c=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},c(e,r)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return !1}}function f(e,r,t){return f=u()?Reflect.construct:function(e,r,t){var s=[null];s.push.apply(s,r);var i=new(Function.bind.apply(e,s));return t&&c(i,t.prototype),i},f.apply(null,arguments)}function h(e){if(null==e)return e;if(Array.isArray(e))return e.slice();if("object"==typeof e){var r={};return Object.keys(e).forEach(function(t){r[t]=e[t];}),r}return e}function v(e){return void 0===e?"undefined":null===e?"null":Array.isArray(e)?"[ "+e.map(function(e){return v(e)}).join(", ")+" ]":"object"==typeof e?JSON.stringify(e):"function"==typeof e?"[Function: "+e.name+"]":"boolean"==typeof e||"number"==typeof e?e:"'"+e.toString()+"'"}function p(e){if("string"!=typeof e){for(var r=new Array(arguments.length),t=0;t<arguments.length;t++)r[t]=v(arguments[t]);return r.join(" ")}for(var s=/%[sdj%]/g,i=1,n=arguments,o=n.length,l=String(e).replace(s,function(e){if("%%"===e)return "%";if(i>=o)return e;switch(e){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch(e){return "[Circular]"}default:return e}}),a=n[i];i<o;a=n[++i])l+=null===a||"object"!=typeof a?" "+a:" "+v(a);return l}function m(e,r){var t=e.split("\n");t[0]&&t[0].indexOf("call-stack-error")>=0&&t.shift();var s=t[r],i=null;if(s){var n=/^\s*(at|.*@)\s*(.+)?$/.exec(s);i=Array.isArray(n)&&n[2]?n[2]:s;}return i}Object.keys(o).forEach(function(e){l[o[e]]=e;});var y={};function d(e,r){if(r){if(y[r])return;y[r]=!0;}console.error(e+"\n");}function g(e){return y[e]}function w(){var e=[];return function(r,t){return t&&"object"==typeof t?-1!==e.indexOf(t)?"[Circular]":(e.push(t),t):t}}var b=/*#__PURE__*/function(){function e(){}return e.prototype.write=function(e){e.level<30?console.log(e):e.level<40?console.info(e):e.level<50?console.warn(e):console.error(e),e.err&&e.err.stack&&console.error(e.err.stack),e.obj&&console.log(e.obj);},e}(),j=/*#__PURE__*/function(){function e(r,t,s){var i,n,o,l,a=this;if(!(this instanceof e))return new e(r,t);if(void 0!==t&&(i=r,r=t,!(i instanceof e)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!r)throw new TypeError("options (object) is required");if(i){if(r.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!r.name)throw new TypeError("options.name (string) is required");if(r.stream&&r.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(r.streams&&!Array.isArray(r.streams))throw new TypeError("invalid options.streams: must be an array");if(r.serializers&&("object"!=typeof r.serializers||Array.isArray(r.serializers)))throw new TypeError("invalid options.serializers: must be an object");if(i&&s){this._level=i._level,this.streams=i.streams,this.serializers=i.serializers,this.src=i.src,n=this.fields={};var c=Object.keys(i.fields);for(l=0;l<c.length;l++)n[o=c[l]]=i.fields[o];var u=Object.keys(r);for(l=0;l<u.length;l++)n[o=u[l]]=r[o];}else {if(i){for(this._level=i._level,this.streams=[],l=0;l<i.streams.length;l++){var f=h(i.streams[l]);this.streams.push(f);}this.serializers=h(i.serializers),this.src=i.src,this.fields=h(i.fields),r.level&&this.level(r.level);}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};r.stream?this.addStream({type:"stream",stream:r.stream,level:r.level}):r.streams?r.streams.forEach(function(e){a.addStream(e,r.level);}):i&&r.level?this.level(r.level):i||this.addStream({type:"raw",stream:new b,level:r.level}),r.serializers&&this.addSerializers(r.serializers),r.src&&(this.src=!0),delete(n=h(r)).stream,delete n.level,delete n.streams,delete n.serializers,delete n.src,this.serializers&&this._applySerializers(n),Object.keys(n).forEach(function(e){a.fields[e]=n[e];});}}var r=e.prototype;return r.addStream=function(e,r){void 0===r&&(r=30),(e=h(e)).type="raw",e.level=a(e.level||r),e.level<this._level&&(this._level=e.level),this.streams.push(e),delete this.haveNonRawStreams;},r.addSerializers=function(e){var r=this;this.serializers||(this.serializers={}),Object.keys(e).forEach(function(t){var s=e[t];if("function"!=typeof s)throw new TypeError(p('invalid serializer for "%s" field: must be a function',t));r.serializers[t]=s;});},r.child=function(e,r){return new this.constructor(this,e||{},r)},r.level=function(e){if(void 0===e)return this._level;for(var r=a(e),t=this.streams.length,s=0;s<t;s++)this.streams[s].level=r;this._level=r;},r.levels=function(e,r){if(void 0===e)return this.streams.map(function(e){return e.level});var t;if("number"==typeof e){if(void 0===(t=this.streams[e]))throw new Error("invalid stream index: "+e)}else {for(var s=this.streams.length,i=0;i<s;i++){var n=this.streams[i];if(n.name===e){t=n;break}}if(!t)throw new Error(p('no stream with name "%s"',e))}if(void 0===r)return t.level;var o=a(r);t.level=o,o<this._level&&(this._level=o);},r._applySerializers=function(e,r){var t=this;Object.keys(this.serializers).forEach(function(s){if(!(void 0===e[s]||r&&r[s]))try{e[s]=t.serializers[s](e[s]);}catch(r){d(p('bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bugin that serializer function.\n%s',s,r.stack||r)),e[s]=p('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',s);}});},r._emit=function(e,r){var t,s;if(void 0===this.haveNonRawStreams)for(this.haveNonRawStreams=!1,t=0;t<this.streams.length;t++)if(!this.streams[t].raw){this.haveNonRawStreams=!0;break}if(r||this.haveNonRawStreams)try{s=JSON.stringify(e,w())+"\n";}catch(r){var i=r.stack.split(/\n/g,2).join("\n");d('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n'+function(e,r){return r||(r=" "),r+e.split(/\r?\n/g).join("\n"+r)}(p("%s\n%s",e,r.stack)),i),s=p("(Exception in JSON.stringify(rec): %j. See stderr for details.)\n",r.message);}if(r)return s;var n=e.level;for(t=0;t<this.streams.length;t++){var o=this.streams[t];o.level<=n&&o.stream.write(e);}return s},e}();function z(e){return function(){var r=this;function t(t){var n;t[0]instanceof Error?(s={err:r.serializers&&r.serializers.err?r.serializers.err(t[0]):k.err(t[0])},n={err:!0},i=1===t.length?[s.err.message]:Array.prototype.slice.call(t,1)):"object"!=typeof t[0]&&null!==t[0]||Array.isArray(t[0])?(s=null,i=Array.prototype.slice.call(t)):(s=t[0],i=1===t.length&&s.err&&s.err instanceof Error?[s.err.message]:Array.prototype.slice.call(t,1));var o=h(r.fields);o.level=e;var a=s?h(s):null;if(a&&(r.serializers&&r._applySerializers(a,n),Object.keys(a).forEach(function(e){o[e]=a[e];})),o.levelName=l[e],o.msg=i.length?p.apply(r,i):"",o.time||(o.time=new Date),r.src&&!o.src)try{throw new Error("call-stack-error")}catch(e){var c=e.stack?m(e.stack,2):"";c||g("src")||d("Unable to determine src line info","src"),o.src=c||"";}return o.v=1,o}var s=null,i=arguments,n=null;if(0===arguments.length)return this._level<=e;this._level>e||(n=t(i),this._emit(n));}}function S(e){var r=e.stack||e.toString();if(e.cause&&"function"==typeof e.cause){var t=e.cause();t&&(r+="\nCaused by: "+S(t));}return r}j.prototype.trace=z(10),j.prototype.debug=z(20),j.prototype.info=z(30),j.prototype.warn=z(40),j.prototype.error=z(50),j.prototype.fatal=z(60);var k={err:function(e){return e&&e.stack?{message:e.message,name:e.name,stack:S(e),code:e.code,signal:e.signal}:e}};function E(){return f(j,[].slice.call(arguments))}var A={levels:{trace:"color: DeepPink",debug:"color: GoldenRod",info:"color: DarkTurquoise",warn:"color: Purple",error:"color: Crimson",fatal:"color: Black"},def:"color: DimGray",msg:"color: SteelBlue",src:"color: DimGray; font-style: italic; font-size: 0.9em"},R=/*#__PURE__*/function(){function e(e){var r=void 0===e?{}:e,t=r.logByLevel,s=r.css,i=void 0===s?A:s;this.logByLevel=void 0!==t&&t,this.css=i;}return e.prototype.write=function(e){var r,t,s=this.css.def,i=this.css.msg,n=this.css.src,o=e.childName?e.name+"/"+e.childName:e.name,a=l[e.level],c=(Array(6-a.length).join(" ")+a).toUpperCase();this.logByLevel?(10===e.level?a="debug":60===e.level&&(a="error"),t="function"==typeof console[a]?console[a]:console.log):t=console.log,r=e.level<20?this.css.levels.trace:e.level<30?this.css.levels.debug:e.level<40?this.css.levels.info:e.level<50?this.css.levels.warn:e.level<60?this.css.levels.error:this.css.levels.fatal;var u=function(e,r){return Array(r+1-(e+"").length).join("0")+e},f=[];f.push("[%s:%s:%s:%s] %c%s%c: %s: %c%s "+(e.src?"%c%s":"")),f.push(u(e.time.getHours(),2)),f.push(u(e.time.getMinutes(),2)),f.push(u(e.time.getSeconds(),2)),f.push(u(e.time.getMilliseconds(),4)),f.push(r),f.push(c),f.push(s),f.push(o),f.push(i),f.push(e.msg),e.src&&(f.push(n),f.push(e.src)),e.obj&&(f.push("\n"),f.push(e.obj)),e.err&&e.err.stack&&(f.push("\n"),f.push(e.err.stack)),t.apply(console,f);},e.getDefaultCss=function(){return A},e}();
13971
14002
 
13972
- var humpsExports = {};
13973
- var humps = {
13974
- get exports(){ return humpsExports; },
13975
- set exports(v){ humpsExports = v; },
13976
- };
13977
-
13978
- (function (module) {
13979
- (function(global) {
13980
-
13981
- var _processKeys = function(convert, obj, options) {
13982
- if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) {
13983
- return obj;
13984
- }
13985
-
13986
- var output,
13987
- i = 0,
13988
- l = 0;
13989
-
13990
- if(_isArray(obj)) {
13991
- output = [];
13992
- for(l=obj.length; i<l; i++) {
13993
- output.push(_processKeys(convert, obj[i], options));
13994
- }
13995
- }
13996
- else {
13997
- output = {};
13998
- for(var key in obj) {
13999
- if(Object.prototype.hasOwnProperty.call(obj, key)) {
14000
- output[convert(key, options)] = _processKeys(convert, obj[key], options);
14001
- }
14002
- }
14003
- }
14004
- return output;
14005
- };
14006
-
14007
- // String conversion methods
14008
-
14009
- var separateWords = function(string, options) {
14010
- options = options || {};
14011
- var separator = options.separator || '_';
14012
- var split = options.split || /(?=[A-Z])/;
14013
-
14014
- return string.split(split).join(separator);
14015
- };
14016
-
14017
- var camelize = function(string) {
14018
- if (_isNumerical(string)) {
14019
- return string;
14020
- }
14021
- string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) {
14022
- return chr ? chr.toUpperCase() : '';
14023
- });
14024
- // Ensure 1st char is always lowercase
14025
- return string.substr(0, 1).toLowerCase() + string.substr(1);
14026
- };
14027
-
14028
- var pascalize = function(string) {
14029
- var camelized = camelize(string);
14030
- // Ensure 1st char is always uppercase
14031
- return camelized.substr(0, 1).toUpperCase() + camelized.substr(1);
14032
- };
14033
-
14034
- var decamelize = function(string, options) {
14035
- return separateWords(string, options).toLowerCase();
14036
- };
14037
-
14038
- // Utilities
14039
- // Taken from Underscore.js
14040
-
14041
- var toString = Object.prototype.toString;
14042
-
14043
- var _isFunction = function(obj) {
14044
- return typeof(obj) === 'function';
14045
- };
14046
- var _isObject = function(obj) {
14047
- return obj === Object(obj);
14048
- };
14049
- var _isArray = function(obj) {
14050
- return toString.call(obj) == '[object Array]';
14051
- };
14052
- var _isDate = function(obj) {
14053
- return toString.call(obj) == '[object Date]';
14054
- };
14055
- var _isRegExp = function(obj) {
14056
- return toString.call(obj) == '[object RegExp]';
14057
- };
14058
- var _isBoolean = function(obj) {
14059
- return toString.call(obj) == '[object Boolean]';
14060
- };
14061
-
14062
- // Performant way to determine if obj coerces to a number
14063
- var _isNumerical = function(obj) {
14064
- obj = obj - 0;
14065
- return obj === obj;
14066
- };
14067
-
14068
- // Sets up function which handles processing keys
14069
- // allowing the convert function to be modified by a callback
14070
- var _processor = function(convert, options) {
14071
- var callback = options && 'process' in options ? options.process : options;
14072
-
14073
- if(typeof(callback) !== 'function') {
14074
- return convert;
14075
- }
14076
-
14077
- return function(string, options) {
14078
- return callback(string, convert, options);
14079
- }
14080
- };
14081
-
14082
- var humps = {
14083
- camelize: camelize,
14084
- decamelize: decamelize,
14085
- pascalize: pascalize,
14086
- depascalize: decamelize,
14087
- camelizeKeys: function(object, options) {
14088
- return _processKeys(_processor(camelize, options), object);
14089
- },
14090
- decamelizeKeys: function(object, options) {
14091
- return _processKeys(_processor(decamelize, options), object, options);
14092
- },
14093
- pascalizeKeys: function(object, options) {
14094
- return _processKeys(_processor(pascalize, options), object);
14095
- },
14096
- depascalizeKeys: function () {
14097
- return this.decamelizeKeys.apply(this, arguments);
14098
- }
14099
- };
14100
-
14101
- if (module.exports) {
14102
- module.exports = humps;
14103
- } else {
14104
- global.humps = humps;
14105
- }
14106
-
14107
- })(commonjsGlobal);
14108
- } (humps));
14109
-
14110
14003
  class InvalidTokenError extends Error {
14111
14004
  }
14112
14005
  InvalidTokenError.prototype.name = "InvalidTokenError";
@@ -34321,11 +34214,11 @@ class ShipEngineAPI {
34321
34214
  headers: __spreadProps$k(__spreadValues$n({}, headers), {
34322
34215
  "Content-Type": "application/json"
34323
34216
  }),
34324
- paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
34217
+ paramsSerializer: (params) => lib.stringify(decamelizeKeys(params), { arrayFormat: "brackets" }),
34325
34218
  transformRequest: [
34326
34219
  (data) => {
34327
34220
  if (data && !(data instanceof FormData))
34328
- return humpsExports.decamelizeKeys(data);
34221
+ return decamelizeKeys(data);
34329
34222
  else
34330
34223
  return data;
34331
34224
  },
@@ -34345,7 +34238,7 @@ class ShipEngineAPI {
34345
34238
  },
34346
34239
  (data) => {
34347
34240
  if (data && !(data instanceof Blob))
34348
- return humpsExports.camelizeKeys(data);
34241
+ return camelizeKeys(data);
34349
34242
  else
34350
34243
  return data;
34351
34244
  }
@@ -38816,4 +38709,4 @@ const alchemy = {
38816
38709
  createElement
38817
38710
  };
38818
38711
 
38819
- export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, MovementIndicator, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, SellersAPI, ServicePointsAPI, ShipEngine, ShipEngineAPI, ShipEngineContext, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, WebhooksAPI, alchemy, alchemy as default, delay, getEmotionCache, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, logger, onError, parseError, retryUntil, useAddFunds, useAddInsuranceFunds, useAddSandboxCarriers, useAlchemy, useCalculateRates, useCancelShipment, useCarrierConnectionsServicesList, useConnectCarrier, useConnectCarrierAccount, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateSandboxSeller, useCreateSellerApiKey, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useCreateWebhook, useDeactivateOrderSource, useDeleteAccountImage, useDeleteCarrier, useDeleteRateCard, useDeleteSellerApiKey, useDeleteShippingRule, useDeleteWarehouse, useDeleteWebhook, useDownloadRateCard, useEditShippingRule, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountImages, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCarrierConnectionForm, useGetConnectionsCarrierSettings, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetFundingSourceTransactions, useGetHereToken, useGetInsuranceAccount, useGetInsuranceFundingSourceAcceptedTerms, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicePoint, useGetServicesByCarrier, useGetShipment, useGetShipmentByExternalId, useGetShipmentRates, useGetShippingRuleById, useGetShippingRuleConditionsOptions, useGetThemeById, useGetZonesByCarrier, useI18n, useListCarrierConnections, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListOrderSourcesConnections, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListSandboxSellerIds, useListSellerApiKeys, useListServicePoints, useListShipments, useListShippingRules, useListWarehouses, useListWebhooks, useLoadIcons, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRatesEstimate, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountBillingPlan, useUpdateAccountImage, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateConnectionsCarrierSettings, useUpdateFundingSource, useUpdateOrderSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUpdateWebhook, useUploadRateCard, useValidateAddresses, useVoidLabel };
38712
+ export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, MovementIndicator, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, SellersAPI, ServicePointsAPI, ShipEngine, ShipEngineAPI, ShipEngineContext, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, WebhooksAPI, alchemy, camelizeKeys, decamelizeKeys, alchemy as default, delay, getEmotionCache, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, logger, onError, parseError, retryUntil, useAddFunds, useAddInsuranceFunds, useAddSandboxCarriers, useAlchemy, useCalculateRates, useCancelShipment, useCarrierConnectionsServicesList, useConnectCarrier, useConnectCarrierAccount, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateSandboxSeller, useCreateSellerApiKey, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useCreateWebhook, useDeactivateOrderSource, useDeleteAccountImage, useDeleteCarrier, useDeleteRateCard, useDeleteSellerApiKey, useDeleteShippingRule, useDeleteWarehouse, useDeleteWebhook, useDownloadRateCard, useEditShippingRule, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountImages, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCarrierConnectionForm, useGetConnectionsCarrierSettings, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetFundingSourceTransactions, useGetHereToken, useGetInsuranceAccount, useGetInsuranceFundingSourceAcceptedTerms, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicePoint, useGetServicesByCarrier, useGetShipment, useGetShipmentByExternalId, useGetShipmentRates, useGetShippingRuleById, useGetShippingRuleConditionsOptions, useGetThemeById, useGetZonesByCarrier, useI18n, useListCarrierConnections, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListOrderSourcesConnections, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListSandboxSellerIds, useListSellerApiKeys, useListServicePoints, useListShipments, useListShippingRules, useListWarehouses, useListWebhooks, useLoadIcons, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRatesEstimate, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountBillingPlan, useUpdateAccountImage, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateConnectionsCarrierSettings, useUpdateFundingSource, useUpdateOrderSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUpdateWebhook, useUploadRateCard, useValidateAddresses, useVoidLabel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/alchemy",
3
- "version": "6.0.21",
3
+ "version": "6.0.22",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {