@shipengine/alchemy 5.1.1 → 5.1.2

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 +161 -56
  2. package/index.mjs +159 -57
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -10786,17 +10786,17 @@ var AccountBillingPlanChangeType = /* @__PURE__ */ ((AccountBillingPlanChangeTyp
10786
10786
  return AccountBillingPlanChangeType2;
10787
10787
  })(AccountBillingPlanChangeType || {});
10788
10788
 
10789
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
10790
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
10791
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
10792
- var __objRest$a = (source, exclude) => {
10789
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
10790
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
10791
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
10792
+ var __objRest$d = (source, exclude) => {
10793
10793
  var target = {};
10794
10794
  for (var prop in source)
10795
- if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
10795
+ if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
10796
10796
  target[prop] = source[prop];
10797
- if (source != null && __getOwnPropSymbols$f)
10798
- for (var prop of __getOwnPropSymbols$f(source)) {
10799
- if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
10797
+ if (source != null && __getOwnPropSymbols$i)
10798
+ for (var prop of __getOwnPropSymbols$i(source)) {
10799
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(source, prop))
10800
10800
  target[prop] = source[prop];
10801
10801
  }
10802
10802
  return target;
@@ -10810,7 +10810,7 @@ class CodedError {
10810
10810
  this.message = message;
10811
10811
  }
10812
10812
  static fromObject(_a) {
10813
- var _b = _a, { message } = _b, options = __objRest$a(_b, ["message"]);
10813
+ var _b = _a, { message } = _b, options = __objRest$d(_b, ["message"]);
10814
10814
  return new CodedError(message, options);
10815
10815
  }
10816
10816
  }
@@ -10918,17 +10918,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
10918
10918
  RateCardStatus
10919
10919
  }, Symbol.toStringTag, { value: 'Module' }));
10920
10920
 
10921
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
10922
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
10923
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
10924
- var __objRest$9 = (source, exclude) => {
10921
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
10922
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
10923
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
10924
+ var __objRest$c = (source, exclude) => {
10925
10925
  var target = {};
10926
10926
  for (var prop in source)
10927
- if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
10927
+ if (__hasOwnProp$h.call(source, prop) && exclude.indexOf(prop) < 0)
10928
10928
  target[prop] = source[prop];
10929
- if (source != null && __getOwnPropSymbols$e)
10930
- for (var prop of __getOwnPropSymbols$e(source)) {
10931
- if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
10929
+ if (source != null && __getOwnPropSymbols$h)
10930
+ for (var prop of __getOwnPropSymbols$h(source)) {
10931
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$h.call(source, prop))
10932
10932
  target[prop] = source[prop];
10933
10933
  }
10934
10934
  return target;
@@ -10960,7 +10960,7 @@ class AccountSettingsAPI {
10960
10960
  * The `updateImage` method updates specific image data for a given image id.
10961
10961
  */
10962
10962
  this.updateImage = (_a) => {
10963
- var _b = _a, { labelImageId } = _b, data = __objRest$9(_b, ["labelImageId"]);
10963
+ var _b = _a, { labelImageId } = _b, data = __objRest$c(_b, ["labelImageId"]);
10964
10964
  return this.client.put(`/v1/account/settings/images/${labelImageId}`, data);
10965
10965
  };
10966
10966
  /**
@@ -13690,30 +13690,30 @@ const getEndUserIpAddress = () => __async$D(void 0, null, function* () {
13690
13690
  var __defProp$6 = Object.defineProperty;
13691
13691
  var __defProps$3 = Object.defineProperties;
13692
13692
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
13693
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
13694
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
13695
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
13693
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
13694
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
13695
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
13696
13696
  var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13697
13697
  var __spreadValues$6 = (a, b) => {
13698
13698
  for (var prop in b || (b = {}))
13699
- if (__hasOwnProp$d.call(b, prop))
13699
+ if (__hasOwnProp$g.call(b, prop))
13700
13700
  __defNormalProp$6(a, prop, b[prop]);
13701
- if (__getOwnPropSymbols$d)
13702
- for (var prop of __getOwnPropSymbols$d(b)) {
13703
- if (__propIsEnum$d.call(b, prop))
13701
+ if (__getOwnPropSymbols$g)
13702
+ for (var prop of __getOwnPropSymbols$g(b)) {
13703
+ if (__propIsEnum$g.call(b, prop))
13704
13704
  __defNormalProp$6(a, prop, b[prop]);
13705
13705
  }
13706
13706
  return a;
13707
13707
  };
13708
13708
  var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
13709
- var __objRest$8 = (source, exclude) => {
13709
+ var __objRest$b = (source, exclude) => {
13710
13710
  var target = {};
13711
13711
  for (var prop in source)
13712
- if (__hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0)
13712
+ if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
13713
13713
  target[prop] = source[prop];
13714
- if (source != null && __getOwnPropSymbols$d)
13715
- for (var prop of __getOwnPropSymbols$d(source)) {
13716
- if (exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop))
13714
+ if (source != null && __getOwnPropSymbols$g)
13715
+ for (var prop of __getOwnPropSymbols$g(source)) {
13716
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
13717
13717
  target[prop] = source[prop];
13718
13718
  }
13719
13719
  return target;
@@ -13757,7 +13757,7 @@ class CarriersAPI {
13757
13757
  * The `connect` method connects a carrier account to a user's ShipEngine account.
13758
13758
  */
13759
13759
  this.connect = (_a) => __async$C(this, null, function* () {
13760
- var _b = _a, { carrierCode } = _b, connection = __objRest$8(_b, ["carrierCode"]);
13760
+ var _b = _a, { carrierCode } = _b, connection = __objRest$b(_b, ["carrierCode"]);
13761
13761
  const endUserIpAddress = yield getEndUserIpAddress();
13762
13762
  if (!endUserIpAddress)
13763
13763
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -13840,6 +13840,29 @@ class CarriersAPI {
13840
13840
  }
13841
13841
  }
13842
13842
 
13843
+ class ConnectionsAPI {
13844
+ constructor(client) {
13845
+ this.client = client;
13846
+ /**
13847
+ * The `listCarriers` method retrieves a list of carriers available to be connected.
13848
+ */
13849
+ this.listCarriers = (params) => {
13850
+ return this.client.get("/v1/connections/carriers", { params });
13851
+ };
13852
+ /**
13853
+ * The `getCarrierConnectionForm` method retrieves a JSON Form Schema for collecting
13854
+ * information required to connect to the carrier.
13855
+ */
13856
+ this.getCarrierConnectionForm = (carrierName, params) => {
13857
+ return this.client.get(
13858
+ `/v1/connections/carriers/${carrierName}/form`,
13859
+ { params }
13860
+ );
13861
+ };
13862
+ this.client = client;
13863
+ }
13864
+ }
13865
+
13843
13866
  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}();
13844
13867
 
13845
13868
  var humpsExports = {};
@@ -16050,17 +16073,17 @@ class CustomPackagesAPI {
16050
16073
  }
16051
16074
 
16052
16075
  var __defProp$5 = Object.defineProperty;
16053
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
16054
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
16055
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
16076
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
16077
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
16078
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
16056
16079
  var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16057
16080
  var __spreadValues$5 = (a, b) => {
16058
16081
  for (var prop in b || (b = {}))
16059
- if (__hasOwnProp$c.call(b, prop))
16082
+ if (__hasOwnProp$f.call(b, prop))
16060
16083
  __defNormalProp$5(a, prop, b[prop]);
16061
- if (__getOwnPropSymbols$c)
16062
- for (var prop of __getOwnPropSymbols$c(b)) {
16063
- if (__propIsEnum$c.call(b, prop))
16084
+ if (__getOwnPropSymbols$f)
16085
+ for (var prop of __getOwnPropSymbols$f(b)) {
16086
+ if (__propIsEnum$f.call(b, prop))
16064
16087
  __defNormalProp$5(a, prop, b[prop]);
16065
16088
  }
16066
16089
  return a;
@@ -16554,17 +16577,17 @@ class WarehousesAPI {
16554
16577
  var __defProp$4 = Object.defineProperty;
16555
16578
  var __defProps$2 = Object.defineProperties;
16556
16579
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
16557
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
16558
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
16559
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
16580
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
16581
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
16582
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
16560
16583
  var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16561
16584
  var __spreadValues$4 = (a, b) => {
16562
16585
  for (var prop in b || (b = {}))
16563
- if (__hasOwnProp$b.call(b, prop))
16586
+ if (__hasOwnProp$e.call(b, prop))
16564
16587
  __defNormalProp$4(a, prop, b[prop]);
16565
- if (__getOwnPropSymbols$b)
16566
- for (var prop of __getOwnPropSymbols$b(b)) {
16567
- if (__propIsEnum$b.call(b, prop))
16588
+ if (__getOwnPropSymbols$e)
16589
+ for (var prop of __getOwnPropSymbols$e(b)) {
16590
+ if (__propIsEnum$e.call(b, prop))
16568
16591
  __defNormalProp$4(a, prop, b[prop]);
16569
16592
  }
16570
16593
  return a;
@@ -16731,6 +16754,15 @@ class ShipEngineAPI {
16731
16754
  get carriers() {
16732
16755
  return new CarriersAPI(this.client);
16733
16756
  }
16757
+ /**
16758
+ * The `connections` method provides access to the Connections endpoints in ShipEngine
16759
+ * API. e.g. List Carrier Connections, Get Carrier Connection Form
16760
+ *
16761
+ * @see {@link ConnectionsAPI | The Connections API module}
16762
+ */
16763
+ get connections() {
16764
+ return new ConnectionsAPI(this.client);
16765
+ }
16734
16766
  /**
16735
16767
  * The `customPackages` method provides access to the Packages endpoint in ShipEngine
16736
16768
  * API. e.g. List Packages
@@ -16913,17 +16945,17 @@ const onError = (_errors) => _default();
16913
16945
  var __defProp$3 = Object.defineProperty;
16914
16946
  var __defProps$1 = Object.defineProperties;
16915
16947
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
16916
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
16917
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
16918
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
16948
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
16949
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
16950
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
16919
16951
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16920
16952
  var __spreadValues$3 = (a, b) => {
16921
16953
  for (var prop in b || (b = {}))
16922
- if (__hasOwnProp$a.call(b, prop))
16954
+ if (__hasOwnProp$d.call(b, prop))
16923
16955
  __defNormalProp$3(a, prop, b[prop]);
16924
- if (__getOwnPropSymbols$a)
16925
- for (var prop of __getOwnPropSymbols$a(b)) {
16926
- if (__propIsEnum$a.call(b, prop))
16956
+ if (__getOwnPropSymbols$d)
16957
+ for (var prop of __getOwnPropSymbols$d(b)) {
16958
+ if (__propIsEnum$d.call(b, prop))
16927
16959
  __defNormalProp$3(a, prop, b[prop]);
16928
16960
  }
16929
16961
  return a;
@@ -17348,6 +17380,21 @@ const useListCarriers = () => {
17348
17380
  });
17349
17381
  };
17350
17382
 
17383
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
17384
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
17385
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
17386
+ var __objRest$a = (source, exclude) => {
17387
+ var target = {};
17388
+ for (var prop in source)
17389
+ if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
17390
+ target[prop] = source[prop];
17391
+ if (source != null && __getOwnPropSymbols$c)
17392
+ for (var prop of __getOwnPropSymbols$c(source)) {
17393
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
17394
+ target[prop] = source[prop];
17395
+ }
17396
+ return target;
17397
+ };
17351
17398
  var __async$q = (__this, __arguments, generator) => {
17352
17399
  return new Promise((resolve, reject) => {
17353
17400
  var fulfilled = (value) => {
@@ -17368,18 +17415,19 @@ var __async$q = (__this, __arguments, generator) => {
17368
17415
  step((generator = generator.apply(__this, __arguments)).next());
17369
17416
  });
17370
17417
  };
17371
- const useUpdateAutoFunding = (carrierId) => {
17418
+ const useUpdateAutoFunding = () => {
17372
17419
  const { client } = useShipEngine();
17373
17420
  const queryClient = reactQuery.useQueryClient();
17374
17421
  return reactQuery.useMutation({
17375
- mutationFn: (options) => __async$q(void 0, null, function* () {
17422
+ mutationFn: (_a) => __async$q(void 0, null, function* () {
17423
+ var _b = _a, { carrierId } = _b, options = __objRest$a(_b, ["carrierId"]);
17376
17424
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
17377
17425
  return result.data;
17378
17426
  }),
17379
17427
  mutationKey: ["useUpdateAutoFunding"],
17380
17428
  onError,
17381
- onSuccess: (_) => {
17382
- queryClient.invalidateQueries(["useGetAutoFunding", carrierId], { exact: true });
17429
+ onSuccess: () => {
17430
+ queryClient.invalidateQueries(["useGetAutoFunding"]);
17383
17431
  }
17384
17432
  });
17385
17433
  };
@@ -17401,6 +17449,60 @@ const useGetZonesByCarrier = (carrierId) => {
17401
17449
  });
17402
17450
  };
17403
17451
 
17452
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
17453
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
17454
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
17455
+ var __objRest$9 = (source, exclude) => {
17456
+ var target = {};
17457
+ for (var prop in source)
17458
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
17459
+ target[prop] = source[prop];
17460
+ if (source != null && __getOwnPropSymbols$b)
17461
+ for (var prop of __getOwnPropSymbols$b(source)) {
17462
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
17463
+ target[prop] = source[prop];
17464
+ }
17465
+ return target;
17466
+ };
17467
+ const useGetCarrierConnectionForm = (_params) => {
17468
+ const { client } = useShipEngine();
17469
+ const _a = _params || {}, { carrierName, enabled = true } = _a, params = __objRest$9(_a, ["carrierName", "enabled"]);
17470
+ return reactQuery.useQuery({
17471
+ enabled,
17472
+ onError,
17473
+ queryFn: () => client.connections.getCarrierConnectionForm(carrierName, params),
17474
+ queryKey: ["useGetCarrierConnectionForm", params],
17475
+ select: (result) => result.data
17476
+ });
17477
+ };
17478
+
17479
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
17480
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
17481
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
17482
+ var __objRest$8 = (source, exclude) => {
17483
+ var target = {};
17484
+ for (var prop in source)
17485
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
17486
+ target[prop] = source[prop];
17487
+ if (source != null && __getOwnPropSymbols$a)
17488
+ for (var prop of __getOwnPropSymbols$a(source)) {
17489
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
17490
+ target[prop] = source[prop];
17491
+ }
17492
+ return target;
17493
+ };
17494
+ const useListCarrierConnections = (_params) => {
17495
+ const { client } = useShipEngine();
17496
+ const _a = _params || {}, { enabled = true } = _a, params = __objRest$8(_a, ["enabled"]);
17497
+ return reactQuery.useQuery({
17498
+ enabled,
17499
+ onError,
17500
+ queryFn: () => client.connections.listCarriers(params),
17501
+ queryKey: ["useListCarrierConnections", params],
17502
+ select: (result) => result.data
17503
+ });
17504
+ };
17505
+
17404
17506
  const useListCustomPackageTypes = () => {
17405
17507
  const { client } = useShipEngine();
17406
17508
  return reactQuery.useQuery({
@@ -19809,6 +19911,7 @@ exports.AlchemyTestProvider = AlchemyTestProvider;
19809
19911
  exports.CarriersAPI = CarriersAPI;
19810
19912
  exports.CodedError = CodedError;
19811
19913
  exports.ConfirmationType = ConfirmationType;
19914
+ exports.ConnectionsAPI = ConnectionsAPI;
19812
19915
  exports.CreditCardVendor = CreditCardVendor;
19813
19916
  exports.Currency = Currency;
19814
19917
  exports.CustomPackagesAPI = CustomPackagesAPI;
@@ -19874,6 +19977,7 @@ exports.useGetAccountImages = useGetAccountImages;
19874
19977
  exports.useGetAccountSettings = useGetAccountSettings;
19875
19978
  exports.useGetAutoFundingConfiguration = useGetAutoFundingConfiguration;
19876
19979
  exports.useGetCarrierById = useGetCarrierById;
19980
+ exports.useGetCarrierConnectionForm = useGetCarrierConnectionForm;
19877
19981
  exports.useGetCountriesByCarrier = useGetCountriesByCarrier;
19878
19982
  exports.useGetCurrenciesByCarrier = useGetCurrenciesByCarrier;
19879
19983
  exports.useGetFundingSourceById = useGetFundingSourceById;
@@ -19893,6 +19997,7 @@ exports.useGetShippingRuleConditionsOptions = useGetShippingRuleConditionsOption
19893
19997
  exports.useGetThemeById = useGetThemeById;
19894
19998
  exports.useGetZonesByCarrier = useGetZonesByCarrier;
19895
19999
  exports.useI18n = useI18n;
20000
+ exports.useListCarrierConnections = useListCarrierConnections;
19896
20001
  exports.useListCarriers = useListCarriers;
19897
20002
  exports.useListCustomPackageTypes = useListCustomPackageTypes;
19898
20003
  exports.useListFundingSources = useListFundingSources;
package/index.mjs CHANGED
@@ -10764,17 +10764,17 @@ var AccountBillingPlanChangeType = /* @__PURE__ */ ((AccountBillingPlanChangeTyp
10764
10764
  return AccountBillingPlanChangeType2;
10765
10765
  })(AccountBillingPlanChangeType || {});
10766
10766
 
10767
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
10768
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
10769
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
10770
- var __objRest$a = (source, exclude) => {
10767
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
10768
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
10769
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
10770
+ var __objRest$d = (source, exclude) => {
10771
10771
  var target = {};
10772
10772
  for (var prop in source)
10773
- if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
10773
+ if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
10774
10774
  target[prop] = source[prop];
10775
- if (source != null && __getOwnPropSymbols$f)
10776
- for (var prop of __getOwnPropSymbols$f(source)) {
10777
- if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
10775
+ if (source != null && __getOwnPropSymbols$i)
10776
+ for (var prop of __getOwnPropSymbols$i(source)) {
10777
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(source, prop))
10778
10778
  target[prop] = source[prop];
10779
10779
  }
10780
10780
  return target;
@@ -10788,7 +10788,7 @@ class CodedError {
10788
10788
  this.message = message;
10789
10789
  }
10790
10790
  static fromObject(_a) {
10791
- var _b = _a, { message } = _b, options = __objRest$a(_b, ["message"]);
10791
+ var _b = _a, { message } = _b, options = __objRest$d(_b, ["message"]);
10792
10792
  return new CodedError(message, options);
10793
10793
  }
10794
10794
  }
@@ -10896,17 +10896,17 @@ const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
10896
10896
  RateCardStatus
10897
10897
  }, Symbol.toStringTag, { value: 'Module' }));
10898
10898
 
10899
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
10900
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
10901
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
10902
- var __objRest$9 = (source, exclude) => {
10899
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
10900
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
10901
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
10902
+ var __objRest$c = (source, exclude) => {
10903
10903
  var target = {};
10904
10904
  for (var prop in source)
10905
- if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
10905
+ if (__hasOwnProp$h.call(source, prop) && exclude.indexOf(prop) < 0)
10906
10906
  target[prop] = source[prop];
10907
- if (source != null && __getOwnPropSymbols$e)
10908
- for (var prop of __getOwnPropSymbols$e(source)) {
10909
- if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
10907
+ if (source != null && __getOwnPropSymbols$h)
10908
+ for (var prop of __getOwnPropSymbols$h(source)) {
10909
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$h.call(source, prop))
10910
10910
  target[prop] = source[prop];
10911
10911
  }
10912
10912
  return target;
@@ -10938,7 +10938,7 @@ class AccountSettingsAPI {
10938
10938
  * The `updateImage` method updates specific image data for a given image id.
10939
10939
  */
10940
10940
  this.updateImage = (_a) => {
10941
- var _b = _a, { labelImageId } = _b, data = __objRest$9(_b, ["labelImageId"]);
10941
+ var _b = _a, { labelImageId } = _b, data = __objRest$c(_b, ["labelImageId"]);
10942
10942
  return this.client.put(`/v1/account/settings/images/${labelImageId}`, data);
10943
10943
  };
10944
10944
  /**
@@ -13668,30 +13668,30 @@ const getEndUserIpAddress = () => __async$D(void 0, null, function* () {
13668
13668
  var __defProp$6 = Object.defineProperty;
13669
13669
  var __defProps$3 = Object.defineProperties;
13670
13670
  var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
13671
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
13672
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
13673
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
13671
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
13672
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
13673
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
13674
13674
  var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13675
13675
  var __spreadValues$6 = (a, b) => {
13676
13676
  for (var prop in b || (b = {}))
13677
- if (__hasOwnProp$d.call(b, prop))
13677
+ if (__hasOwnProp$g.call(b, prop))
13678
13678
  __defNormalProp$6(a, prop, b[prop]);
13679
- if (__getOwnPropSymbols$d)
13680
- for (var prop of __getOwnPropSymbols$d(b)) {
13681
- if (__propIsEnum$d.call(b, prop))
13679
+ if (__getOwnPropSymbols$g)
13680
+ for (var prop of __getOwnPropSymbols$g(b)) {
13681
+ if (__propIsEnum$g.call(b, prop))
13682
13682
  __defNormalProp$6(a, prop, b[prop]);
13683
13683
  }
13684
13684
  return a;
13685
13685
  };
13686
13686
  var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
13687
- var __objRest$8 = (source, exclude) => {
13687
+ var __objRest$b = (source, exclude) => {
13688
13688
  var target = {};
13689
13689
  for (var prop in source)
13690
- if (__hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0)
13690
+ if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
13691
13691
  target[prop] = source[prop];
13692
- if (source != null && __getOwnPropSymbols$d)
13693
- for (var prop of __getOwnPropSymbols$d(source)) {
13694
- if (exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop))
13692
+ if (source != null && __getOwnPropSymbols$g)
13693
+ for (var prop of __getOwnPropSymbols$g(source)) {
13694
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
13695
13695
  target[prop] = source[prop];
13696
13696
  }
13697
13697
  return target;
@@ -13735,7 +13735,7 @@ class CarriersAPI {
13735
13735
  * The `connect` method connects a carrier account to a user's ShipEngine account.
13736
13736
  */
13737
13737
  this.connect = (_a) => __async$C(this, null, function* () {
13738
- var _b = _a, { carrierCode } = _b, connection = __objRest$8(_b, ["carrierCode"]);
13738
+ var _b = _a, { carrierCode } = _b, connection = __objRest$b(_b, ["carrierCode"]);
13739
13739
  const endUserIpAddress = yield getEndUserIpAddress();
13740
13740
  if (!endUserIpAddress)
13741
13741
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -13818,6 +13818,29 @@ class CarriersAPI {
13818
13818
  }
13819
13819
  }
13820
13820
 
13821
+ class ConnectionsAPI {
13822
+ constructor(client) {
13823
+ this.client = client;
13824
+ /**
13825
+ * The `listCarriers` method retrieves a list of carriers available to be connected.
13826
+ */
13827
+ this.listCarriers = (params) => {
13828
+ return this.client.get("/v1/connections/carriers", { params });
13829
+ };
13830
+ /**
13831
+ * The `getCarrierConnectionForm` method retrieves a JSON Form Schema for collecting
13832
+ * information required to connect to the carrier.
13833
+ */
13834
+ this.getCarrierConnectionForm = (carrierName, params) => {
13835
+ return this.client.get(
13836
+ `/v1/connections/carriers/${carrierName}/form`,
13837
+ { params }
13838
+ );
13839
+ };
13840
+ this.client = client;
13841
+ }
13842
+ }
13843
+
13821
13844
  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}();
13822
13845
 
13823
13846
  var humpsExports = {};
@@ -16028,17 +16051,17 @@ class CustomPackagesAPI {
16028
16051
  }
16029
16052
 
16030
16053
  var __defProp$5 = Object.defineProperty;
16031
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
16032
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
16033
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
16054
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
16055
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
16056
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
16034
16057
  var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16035
16058
  var __spreadValues$5 = (a, b) => {
16036
16059
  for (var prop in b || (b = {}))
16037
- if (__hasOwnProp$c.call(b, prop))
16060
+ if (__hasOwnProp$f.call(b, prop))
16038
16061
  __defNormalProp$5(a, prop, b[prop]);
16039
- if (__getOwnPropSymbols$c)
16040
- for (var prop of __getOwnPropSymbols$c(b)) {
16041
- if (__propIsEnum$c.call(b, prop))
16062
+ if (__getOwnPropSymbols$f)
16063
+ for (var prop of __getOwnPropSymbols$f(b)) {
16064
+ if (__propIsEnum$f.call(b, prop))
16042
16065
  __defNormalProp$5(a, prop, b[prop]);
16043
16066
  }
16044
16067
  return a;
@@ -16532,17 +16555,17 @@ class WarehousesAPI {
16532
16555
  var __defProp$4 = Object.defineProperty;
16533
16556
  var __defProps$2 = Object.defineProperties;
16534
16557
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
16535
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
16536
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
16537
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
16558
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
16559
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
16560
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
16538
16561
  var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16539
16562
  var __spreadValues$4 = (a, b) => {
16540
16563
  for (var prop in b || (b = {}))
16541
- if (__hasOwnProp$b.call(b, prop))
16564
+ if (__hasOwnProp$e.call(b, prop))
16542
16565
  __defNormalProp$4(a, prop, b[prop]);
16543
- if (__getOwnPropSymbols$b)
16544
- for (var prop of __getOwnPropSymbols$b(b)) {
16545
- if (__propIsEnum$b.call(b, prop))
16566
+ if (__getOwnPropSymbols$e)
16567
+ for (var prop of __getOwnPropSymbols$e(b)) {
16568
+ if (__propIsEnum$e.call(b, prop))
16546
16569
  __defNormalProp$4(a, prop, b[prop]);
16547
16570
  }
16548
16571
  return a;
@@ -16709,6 +16732,15 @@ class ShipEngineAPI {
16709
16732
  get carriers() {
16710
16733
  return new CarriersAPI(this.client);
16711
16734
  }
16735
+ /**
16736
+ * The `connections` method provides access to the Connections endpoints in ShipEngine
16737
+ * API. e.g. List Carrier Connections, Get Carrier Connection Form
16738
+ *
16739
+ * @see {@link ConnectionsAPI | The Connections API module}
16740
+ */
16741
+ get connections() {
16742
+ return new ConnectionsAPI(this.client);
16743
+ }
16712
16744
  /**
16713
16745
  * The `customPackages` method provides access to the Packages endpoint in ShipEngine
16714
16746
  * API. e.g. List Packages
@@ -16891,17 +16923,17 @@ const onError = (_errors) => _default();
16891
16923
  var __defProp$3 = Object.defineProperty;
16892
16924
  var __defProps$1 = Object.defineProperties;
16893
16925
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
16894
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
16895
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
16896
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
16926
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
16927
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
16928
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
16897
16929
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16898
16930
  var __spreadValues$3 = (a, b) => {
16899
16931
  for (var prop in b || (b = {}))
16900
- if (__hasOwnProp$a.call(b, prop))
16932
+ if (__hasOwnProp$d.call(b, prop))
16901
16933
  __defNormalProp$3(a, prop, b[prop]);
16902
- if (__getOwnPropSymbols$a)
16903
- for (var prop of __getOwnPropSymbols$a(b)) {
16904
- if (__propIsEnum$a.call(b, prop))
16934
+ if (__getOwnPropSymbols$d)
16935
+ for (var prop of __getOwnPropSymbols$d(b)) {
16936
+ if (__propIsEnum$d.call(b, prop))
16905
16937
  __defNormalProp$3(a, prop, b[prop]);
16906
16938
  }
16907
16939
  return a;
@@ -17326,6 +17358,21 @@ const useListCarriers = () => {
17326
17358
  });
17327
17359
  };
17328
17360
 
17361
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
17362
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
17363
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
17364
+ var __objRest$a = (source, exclude) => {
17365
+ var target = {};
17366
+ for (var prop in source)
17367
+ if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
17368
+ target[prop] = source[prop];
17369
+ if (source != null && __getOwnPropSymbols$c)
17370
+ for (var prop of __getOwnPropSymbols$c(source)) {
17371
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
17372
+ target[prop] = source[prop];
17373
+ }
17374
+ return target;
17375
+ };
17329
17376
  var __async$q = (__this, __arguments, generator) => {
17330
17377
  return new Promise((resolve, reject) => {
17331
17378
  var fulfilled = (value) => {
@@ -17346,18 +17393,19 @@ var __async$q = (__this, __arguments, generator) => {
17346
17393
  step((generator = generator.apply(__this, __arguments)).next());
17347
17394
  });
17348
17395
  };
17349
- const useUpdateAutoFunding = (carrierId) => {
17396
+ const useUpdateAutoFunding = () => {
17350
17397
  const { client } = useShipEngine();
17351
17398
  const queryClient = useQueryClient();
17352
17399
  return useMutation({
17353
- mutationFn: (options) => __async$q(void 0, null, function* () {
17400
+ mutationFn: (_a) => __async$q(void 0, null, function* () {
17401
+ var _b = _a, { carrierId } = _b, options = __objRest$a(_b, ["carrierId"]);
17354
17402
  const result = yield client.carriers.updateAutoFunding(carrierId, options);
17355
17403
  return result.data;
17356
17404
  }),
17357
17405
  mutationKey: ["useUpdateAutoFunding"],
17358
17406
  onError,
17359
- onSuccess: (_) => {
17360
- queryClient.invalidateQueries(["useGetAutoFunding", carrierId], { exact: true });
17407
+ onSuccess: () => {
17408
+ queryClient.invalidateQueries(["useGetAutoFunding"]);
17361
17409
  }
17362
17410
  });
17363
17411
  };
@@ -17379,6 +17427,60 @@ const useGetZonesByCarrier = (carrierId) => {
17379
17427
  });
17380
17428
  };
17381
17429
 
17430
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
17431
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
17432
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
17433
+ var __objRest$9 = (source, exclude) => {
17434
+ var target = {};
17435
+ for (var prop in source)
17436
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
17437
+ target[prop] = source[prop];
17438
+ if (source != null && __getOwnPropSymbols$b)
17439
+ for (var prop of __getOwnPropSymbols$b(source)) {
17440
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
17441
+ target[prop] = source[prop];
17442
+ }
17443
+ return target;
17444
+ };
17445
+ const useGetCarrierConnectionForm = (_params) => {
17446
+ const { client } = useShipEngine();
17447
+ const _a = _params || {}, { carrierName, enabled = true } = _a, params = __objRest$9(_a, ["carrierName", "enabled"]);
17448
+ return useQuery({
17449
+ enabled,
17450
+ onError,
17451
+ queryFn: () => client.connections.getCarrierConnectionForm(carrierName, params),
17452
+ queryKey: ["useGetCarrierConnectionForm", params],
17453
+ select: (result) => result.data
17454
+ });
17455
+ };
17456
+
17457
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
17458
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
17459
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
17460
+ var __objRest$8 = (source, exclude) => {
17461
+ var target = {};
17462
+ for (var prop in source)
17463
+ if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
17464
+ target[prop] = source[prop];
17465
+ if (source != null && __getOwnPropSymbols$a)
17466
+ for (var prop of __getOwnPropSymbols$a(source)) {
17467
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
17468
+ target[prop] = source[prop];
17469
+ }
17470
+ return target;
17471
+ };
17472
+ const useListCarrierConnections = (_params) => {
17473
+ const { client } = useShipEngine();
17474
+ const _a = _params || {}, { enabled = true } = _a, params = __objRest$8(_a, ["enabled"]);
17475
+ return useQuery({
17476
+ enabled,
17477
+ onError,
17478
+ queryFn: () => client.connections.listCarriers(params),
17479
+ queryKey: ["useListCarrierConnections", params],
17480
+ select: (result) => result.data
17481
+ });
17482
+ };
17483
+
17382
17484
  const useListCustomPackageTypes = () => {
17383
17485
  const { client } = useShipEngine();
17384
17486
  return useQuery({
@@ -19779,4 +19881,4 @@ const alchemy = {
19779
19881
  createElement
19780
19882
  };
19781
19883
 
19782
- export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngine, ShipEngineAPI, ShipEngineContext, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, alchemy, alchemy as default, delay, getEmotionCache, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, logger, onError, parseError, retryUntil, useAddFunds, useAlchemy, useCalculateRates, useConnectCarrier, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeactivateOrderSource, useDeleteAccountImage, useDeleteRateCard, useDeleteShippingRule, useDeleteWarehouse, useDownloadRateCard, useEditShippingRule, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountImages, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetFundingSourceTransactions, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetShippingRuleById, useGetShippingRuleConditionsOptions, useGetThemeById, useGetZonesByCarrier, useI18n, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListShippingRules, useListWarehouses, useLoadIcons, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountBillingPlan, useUpdateAccountImage, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };
19884
+ export { AccountSettingsAPI, AddressesAPI, AlchemyContext, AlchemyProvider, AlchemyTestProvider, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, Element, ErrorBoundary, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, ShipEngine, ShipEngineAPI, ShipEngineContext, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, alchemy, alchemy as default, delay, getEmotionCache, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, logger, onError, parseError, retryUntil, useAddFunds, useAlchemy, useCalculateRates, useConnectCarrier, useCreateAccountImage, useCreateFundingSource, useCreateLabel, useCreateRateCard, useCreateSalesOrderShipment, useCreateShipment, useCreateShippingRule, useCreateWarehouse, useDeactivateOrderSource, useDeleteAccountImage, useDeleteRateCard, useDeleteShippingRule, useDeleteWarehouse, useDownloadRateCard, useEditShippingRule, useFundingSourcesAddFunds, useGetAccountBillingPlan, useGetAccountImages, useGetAccountSettings, useGetAutoFundingConfiguration, useGetCarrierById, useGetCarrierConnectionForm, useGetCountriesByCarrier, useGetCurrenciesByCarrier, useGetFundingSourceById, useGetFundingSourceMetadata, useGetFundingSourceTransactions, useGetInsuranceAccount, useGetLabel, useGetPackageRatingGroupByCarrier, useGetRateCardById, useGetSalesOrder, useGetSalesOrderShipment, useGetServicesByCarrier, useGetShipment, useGetShipmentRates, useGetShippingRuleById, useGetShippingRuleConditionsOptions, useGetThemeById, useGetZonesByCarrier, useI18n, useListCarrierConnections, useListCarriers, useListCustomPackageTypes, useListFundingSources, useListLabels, useListOrderSources, useListRateCards, useListSalesOrderShipments, useListSalesOrders, useListShipments, useListShippingRules, useListWarehouses, useLoadIcons, useNotifySalesOrderShipped, useParseAddress, usePublishRateCard, useRefreshOrderSource, useRefreshOrderSourceAsync, useRegisterCarrier, useShipEngine, useUpdateAccountBillingPlan, useUpdateAccountImage, useUpdateAccountSettings, useUpdateAutoFunding, useUpdateFundingSource, useUpdateRateCard, useUpdateSalesOrderShipment, useUpdateWarehouse, useUploadRateCard, useValidateAddresses, useVoidLabel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/alchemy",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {