@shipengine/js-api 3.1.0 → 3.3.0

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.
@@ -1,18 +1,28 @@
1
1
  export type AddressResidentialIndicator = "yes" | "no" | "unknown";
2
+ /**
3
+ * @category Entities
4
+ */
5
+ export interface ShippingAddress extends Address {
6
+ instructions?: string | null;
7
+ }
8
+ /**
9
+ * @category Entities
10
+ */
11
+ export interface ShippingAddressTo extends ShippingAddress {
12
+ geolocation?: AddressGeolocation[] | null;
13
+ }
2
14
  /**
3
15
  * @category Entities
4
16
  */
5
17
  export interface Address {
6
18
  addressLine1: string;
7
- addressLine2?: string;
8
- addressLine3?: string;
19
+ addressLine2?: string | null;
20
+ addressLine3?: string | null;
9
21
  addressResidentialIndicator?: AddressResidentialIndicator;
10
22
  cityLocality: string;
11
23
  companyName?: string;
12
24
  countryCode: string;
13
25
  email?: string;
14
- geolocation?: AddressGeolocation[];
15
- instructions?: string;
16
26
  name: string;
17
27
  phone: string;
18
28
  postalCode: string;
package/client.d.ts CHANGED
@@ -8,6 +8,7 @@ import { CustomPackagesAPI } from "./custom-packages";
8
8
  import { CodedError } from "./errors";
9
9
  import { FundingSourcesAPI } from "./funding-sources";
10
10
  import { InsuranceAPI } from "./insurance";
11
+ import { InvoiceAddressAPI } from "./invoice-address";
11
12
  import { LabelsAPI } from "./labels";
12
13
  import { OrderSourcesAPI } from "./order-sources";
13
14
  import { RateCardsAPI } from "./rate-cards";
@@ -143,6 +144,13 @@ export declare class ShipEngineAPI {
143
144
  * @see {@link InsuranceAPI | The Insurance API module}
144
145
  */
145
146
  get insurance(): InsuranceAPI;
147
+ /**
148
+ * The `invoiceAddress` method provides access to the Invoice Address endpoints
149
+ * in ShipEngine API.
150
+ *
151
+ * @see {@link InvoiceAddress | The Invoice Address API module}
152
+ */
153
+ get invoiceAddress(): InvoiceAddressAPI;
146
154
  /**
147
155
  * The `labels` method provides access to the Label endpoints in ShipEngine API.
148
156
  * e.g. Create Label, Get Label, Void Label, etc.
@@ -3,6 +3,7 @@ import { Money } from "../payments";
3
3
  import { CreationRangeQuery, PageableQuery } from "../resources";
4
4
  import { AddFundsResponse, CarrierRegistration, CarrierRegistrationResponse, CreateFundingSource, CreditCardInfo, FundingSource, FundingSourceAddress, FundingSourceCreateResponse, FundingSourceTransactionsResponse, InsuranceFundingSourceAcceptedTermsResponse, MetadataResponse } from "./types";
5
5
  /**
6
+ * @internal
6
7
  * # Funding Sources API module - /v1/funding_sources
7
8
  * Docs: https://auctane.atlassian.net/wiki/spaces/SE/pages/3628370266/ShipEngine+Funding+Sources+API
8
9
  */
@@ -1,9 +1,11 @@
1
1
  import { PageableResult } from "../resources";
2
2
  /**
3
+ * @internal
3
4
  * An encoded device fingerprint string containing information about the end-user's computing device such as OS, browser, etc.
4
5
  * Required for carrier registration and US Wallet creation.
5
6
  */
6
7
  type IovationBlackBox = string;
8
+ /** @internal */
7
9
  export type CreateFundingSource = {
8
10
  acceptedTerms: Term[];
9
11
  agreeToTerms: boolean;
@@ -13,7 +15,9 @@ export type CreateFundingSource = {
13
15
  creditCardInfo: CreditCardInfo;
14
16
  };
15
17
  };
18
+ /** @internal */
16
19
  export type FundingSource = {
20
+ balance: number;
17
21
  billingInfo: FundingSourceAddress;
18
22
  currencyCode: string;
19
23
  defaultCarrierId: string;
@@ -22,16 +26,21 @@ export type FundingSource = {
22
26
  creditCardInfo: AbbreviatedCreditCardInfo | null;
23
27
  };
24
28
  };
29
+ /** @internal */
25
30
  export type AbbreviatedCreditCardInfo = {
26
31
  cardNumberLastFour: string;
27
32
  provider: Provider;
28
33
  };
34
+ /** @internal */
29
35
  export type FundingSourceInsuranceProvider = "parcelguard" | "x_cover";
36
+ /** @internal */
30
37
  export type Provider = "visa" | "mastercard" | "americanExpress" | "discover";
38
+ /** @internal */
31
39
  export interface FundingSourcePickupAddress extends Omit<FundingSourceAddress, "email" | "phone"> {
32
40
  email?: string;
33
41
  phone?: string;
34
42
  }
43
+ /** @internal */
35
44
  export type FundingSourceCarrier = {
36
45
  acceptedTerms: Term[];
37
46
  agreeToTerms: boolean;
@@ -40,19 +49,22 @@ export type FundingSourceCarrier = {
40
49
  iovationBlackBox: IovationBlackBox;
41
50
  pickupAddress?: FundingSourcePickupAddress;
42
51
  };
52
+ /** @internal */
43
53
  export type CarrierRegistrationInsuranceProvider = {
44
54
  acceptedTerms: Term[];
45
55
  agreeToTerms: boolean;
46
56
  fundingSourceId: string;
47
57
  provider: FundingSourceInsuranceProvider;
48
58
  };
59
+ /** @internal */
49
60
  export interface CarrierRegistration {
50
61
  carriers?: FundingSourceCarrier[];
51
62
  insuranceProviders?: CarrierRegistrationInsuranceProvider[];
52
63
  }
64
+ /** @internal */
53
65
  export interface FundingSourceAddress {
54
66
  addressLine1: string;
55
- addressLine2?: string;
67
+ addressLine2?: string | null;
56
68
  cityLocality: string;
57
69
  company?: string;
58
70
  countryCode: string;
@@ -62,6 +74,7 @@ export interface FundingSourceAddress {
62
74
  postalCode: string;
63
75
  stateProvince: string;
64
76
  }
77
+ /** @internal */
65
78
  export interface CreditCardInfo {
66
79
  cardNumber: string;
67
80
  cvv: string;
@@ -70,21 +83,26 @@ export interface CreditCardInfo {
70
83
  name: string;
71
84
  provider: Provider;
72
85
  }
86
+ /** @internal */
73
87
  export interface Term {
74
88
  termType: string;
75
89
  version: string;
76
90
  }
91
+ /** @internal */
77
92
  export interface MetadataTermLink {
78
93
  link: string;
79
94
  locale: string;
80
95
  title: string;
81
96
  }
97
+ /** @internal */
82
98
  export interface MetadataOptionalTerm extends Term {
83
99
  links: MetadataTermLink[];
84
100
  }
101
+ /** @internal */
85
102
  export interface MetadataRequiredTerm extends Term {
86
103
  links: MetadataTermLink[];
87
104
  }
105
+ /** @internal */
88
106
  export declare enum MetadataCapability {
89
107
  AutoFunding = "auto_funding",
90
108
  UpdatePaymentMethod = "update_payment_method",
@@ -97,6 +115,7 @@ export declare enum MetadataCapability {
97
115
  AccountSettingsLink = "account_settings_link",
98
116
  Unknown = "unknown"
99
117
  }
118
+ /** @internal */
100
119
  export declare enum MetadataRequirement {
101
120
  BillingAddress = "billing_address",
102
121
  CurrencyCode = "currency_code",
@@ -106,6 +125,7 @@ export declare enum MetadataRequirement {
106
125
  PickupAddress = "pickup_address",
107
126
  Unknown = "unknown"
108
127
  }
128
+ /** @internal */
109
129
  export declare enum MetadataSatisfyingFormTypes {
110
130
  Address = "address",
111
131
  CreditCard = "credit_card",
@@ -113,17 +133,21 @@ export declare enum MetadataSatisfyingFormTypes {
113
133
  StampsSellerLabelProvider = "stamps_seller_label_provider",
114
134
  Unknown = "unknown"
115
135
  }
136
+ /** @internal */
116
137
  export type MetadataRegistrationRequirement = {
117
138
  requirementType: MetadataRequirement;
118
139
  satisfyingFormTypes: MetadataSatisfyingFormTypes[];
119
140
  };
141
+ /** @internal */
120
142
  export type MetadataCarrierProfile = {
121
143
  capabilities: MetadataCapability[] | null;
122
144
  carrierCode: string;
123
145
  registrationRequirements: MetadataRegistrationRequirement[];
124
146
  requiredTerms: MetadataRequiredTerm[];
125
147
  };
148
+ /** @internal */
126
149
  export type TransactionCategory = "adjustment" | "credit" | "debit" | "funds_added" | "insurance" | "label" | "refund" | "service_charge" | "unknown";
150
+ /** @internal */
127
151
  export type FundingSourceTransactionInvoice = {
128
152
  invoiceDownload: {
129
153
  pdf: string;
@@ -131,6 +155,7 @@ export type FundingSourceTransactionInvoice = {
131
155
  invoiceId: string;
132
156
  reference: string;
133
157
  };
158
+ /** @internal */
134
159
  export type FundingSourceTransaction = {
135
160
  description?: string | null;
136
161
  endingBalance: {
@@ -151,16 +176,19 @@ export type FundingSourceTransaction = {
151
176
  transactionCategory: TransactionCategory;
152
177
  transactionDate: string;
153
178
  };
179
+ /** @internal */
154
180
  export interface FundingSourceInsuranceProviderResponse {
155
181
  errorMessage: null | string;
156
182
  fundingSourceId: string;
157
183
  isSuccessful: boolean;
158
184
  provider: FundingSourceInsuranceProvider;
159
185
  }
186
+ /** @internal */
160
187
  export interface FundingSourceCreateResponse {
161
188
  fundingSource: FundingSource;
162
189
  insuranceProviderAttachmentResults: FundingSourceInsuranceProviderResponse[];
163
190
  }
191
+ /** @internal */
164
192
  export interface CarrierRegistrationResponse {
165
193
  carrierAttachmentResults: [
166
194
  {
@@ -173,6 +201,7 @@ export interface CarrierRegistrationResponse {
173
201
  ];
174
202
  insuranceProviderAttachmentResults: FundingSourceInsuranceProviderResponse[];
175
203
  }
204
+ /** @internal */
176
205
  export interface MetadataResponse {
177
206
  defaultFundingSourceProfile: {
178
207
  capabilities: MetadataCapability[] | null;
@@ -188,15 +217,18 @@ export interface MetadataResponse {
188
217
  currencyCode: string;
189
218
  };
190
219
  }
220
+ /** @internal */
191
221
  export type AddFundsResponse = {
192
222
  balance: {
193
223
  amount: number;
194
224
  currency: string;
195
225
  };
196
226
  };
227
+ /** @internal */
197
228
  export type FundingSourceTransactionsResponse = {
198
229
  transactions: FundingSourceTransaction[];
199
230
  } & PageableResult;
231
+ /** @internal */
200
232
  export type InsuranceFundingSourceAcceptedTermsResponse = {
201
233
  acceptedTerms: Term[];
202
234
  };
package/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from "./dimensions";
9
9
  export * from "./errors";
10
10
  export * from "./funding-sources";
11
11
  export * from "./insurance";
12
+ export * from "./invoice-address";
12
13
  export * from "./labels";
13
14
  export * from "./order-sources";
14
15
  export * from "./payments";
package/index.js CHANGED
@@ -975,7 +975,7 @@ var ipaddr = {
975
975
  }).call(commonjsGlobal);
976
976
  } (ipaddr));
977
977
 
978
- var __async$6 = (__this, __arguments, generator) => {
978
+ var __async$7 = (__this, __arguments, generator) => {
979
979
  return new Promise((resolve, reject) => {
980
980
  var fulfilled = (value) => {
981
981
  try {
@@ -995,7 +995,7 @@ var __async$6 = (__this, __arguments, generator) => {
995
995
  step((generator = generator.apply(__this, __arguments)).next());
996
996
  });
997
997
  };
998
- const getEndUserIpAddress = () => __async$6(void 0, null, function* () {
998
+ const getEndUserIpAddress = () => __async$7(void 0, null, function* () {
999
999
  try {
1000
1000
  const response = yield axios.get("https://api.ipify.org/?format=json");
1001
1001
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -1007,6 +1007,37 @@ const getEndUserIpAddress = () => __async$6(void 0, null, function* () {
1007
1007
  }
1008
1008
  });
1009
1009
 
1010
+ const camelizeKeys = (obj) => {
1011
+ if (Array.isArray(obj)) {
1012
+ return obj.map(camelizeKeys);
1013
+ } else if (obj !== null && typeof obj === "object") {
1014
+ const newObj = {};
1015
+ for (const key in obj) {
1016
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
1017
+ const newKey = key.replace(/_([a-z])/g, (match, letter) => letter.toUpperCase());
1018
+ newObj[newKey] = camelizeKeys(obj[key]);
1019
+ }
1020
+ }
1021
+ return newObj;
1022
+ }
1023
+ return obj;
1024
+ };
1025
+ const decamelizeKeys = (obj, separator = "_") => {
1026
+ if (Array.isArray(obj)) {
1027
+ return obj.map((item) => decamelizeKeys(item, separator));
1028
+ } else if (obj !== null && typeof obj === "object") {
1029
+ const newObj = {};
1030
+ for (const key in obj) {
1031
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
1032
+ const newKey = key.replace(/([A-Z])/g, (match) => separator + match.toLowerCase());
1033
+ newObj[newKey] = decamelizeKeys(obj[key], separator);
1034
+ }
1035
+ }
1036
+ return newObj;
1037
+ }
1038
+ return obj;
1039
+ };
1040
+
1010
1041
  var __defProp$4 = Object.defineProperty;
1011
1042
  var __defProps$1 = Object.defineProperties;
1012
1043
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
@@ -1038,7 +1069,7 @@ var __objRest$1 = (source, exclude) => {
1038
1069
  }
1039
1070
  return target;
1040
1071
  };
1041
- var __async$5 = (__this, __arguments, generator) => {
1072
+ var __async$6 = (__this, __arguments, generator) => {
1042
1073
  return new Promise((resolve, reject) => {
1043
1074
  var fulfilled = (value) => {
1044
1075
  try {
@@ -1078,7 +1109,7 @@ class CarriersAPI {
1078
1109
  /**
1079
1110
  * The `connect` method connects a carrier account to a user's ShipEngine account.
1080
1111
  */
1081
- this.connect = (_a) => __async$5(this, null, function* () {
1112
+ this.connect = (_a) => __async$6(this, null, function* () {
1082
1113
  var _b = _a, { carrierCode } = _b, connection = __objRest$1(_b, ["carrierCode"]);
1083
1114
  const endUserIpAddress = yield getEndUserIpAddress();
1084
1115
  if (!endUserIpAddress)
@@ -1169,7 +1200,7 @@ class CarriersAPI {
1169
1200
  }
1170
1201
  }
1171
1202
 
1172
- var __async$4 = (__this, __arguments, generator) => {
1203
+ var __async$5 = (__this, __arguments, generator) => {
1173
1204
  return new Promise((resolve, reject) => {
1174
1205
  var fulfilled = (value) => {
1175
1206
  try {
@@ -1211,7 +1242,7 @@ class ConnectionsAPI {
1211
1242
  /**
1212
1243
  * The `connectCarrier` method connects a carrier to account.
1213
1244
  */
1214
- this.connectCarrier = (carrierName, formData) => __async$4(this, null, function* () {
1245
+ this.connectCarrier = (carrierName, formData) => __async$5(this, null, function* () {
1215
1246
  return yield this.client.post(
1216
1247
  `/v1/connections/carriers/${carrierName}`,
1217
1248
  formData,
@@ -1259,144 +1290,6 @@ class ConnectionsAPI {
1259
1290
 
1260
1291
  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}();
1261
1292
 
1262
- var humpsExports = {};
1263
- var humps = {
1264
- get exports(){ return humpsExports; },
1265
- set exports(v){ humpsExports = v; },
1266
- };
1267
-
1268
- (function (module) {
1269
- (function(global) {
1270
-
1271
- var _processKeys = function(convert, obj, options) {
1272
- if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) {
1273
- return obj;
1274
- }
1275
-
1276
- var output,
1277
- i = 0,
1278
- l = 0;
1279
-
1280
- if(_isArray(obj)) {
1281
- output = [];
1282
- for(l=obj.length; i<l; i++) {
1283
- output.push(_processKeys(convert, obj[i], options));
1284
- }
1285
- }
1286
- else {
1287
- output = {};
1288
- for(var key in obj) {
1289
- if(Object.prototype.hasOwnProperty.call(obj, key)) {
1290
- output[convert(key, options)] = _processKeys(convert, obj[key], options);
1291
- }
1292
- }
1293
- }
1294
- return output;
1295
- };
1296
-
1297
- // String conversion methods
1298
-
1299
- var separateWords = function(string, options) {
1300
- options = options || {};
1301
- var separator = options.separator || '_';
1302
- var split = options.split || /(?=[A-Z])/;
1303
-
1304
- return string.split(split).join(separator);
1305
- };
1306
-
1307
- var camelize = function(string) {
1308
- if (_isNumerical(string)) {
1309
- return string;
1310
- }
1311
- string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) {
1312
- return chr ? chr.toUpperCase() : '';
1313
- });
1314
- // Ensure 1st char is always lowercase
1315
- return string.substr(0, 1).toLowerCase() + string.substr(1);
1316
- };
1317
-
1318
- var pascalize = function(string) {
1319
- var camelized = camelize(string);
1320
- // Ensure 1st char is always uppercase
1321
- return camelized.substr(0, 1).toUpperCase() + camelized.substr(1);
1322
- };
1323
-
1324
- var decamelize = function(string, options) {
1325
- return separateWords(string, options).toLowerCase();
1326
- };
1327
-
1328
- // Utilities
1329
- // Taken from Underscore.js
1330
-
1331
- var toString = Object.prototype.toString;
1332
-
1333
- var _isFunction = function(obj) {
1334
- return typeof(obj) === 'function';
1335
- };
1336
- var _isObject = function(obj) {
1337
- return obj === Object(obj);
1338
- };
1339
- var _isArray = function(obj) {
1340
- return toString.call(obj) == '[object Array]';
1341
- };
1342
- var _isDate = function(obj) {
1343
- return toString.call(obj) == '[object Date]';
1344
- };
1345
- var _isRegExp = function(obj) {
1346
- return toString.call(obj) == '[object RegExp]';
1347
- };
1348
- var _isBoolean = function(obj) {
1349
- return toString.call(obj) == '[object Boolean]';
1350
- };
1351
-
1352
- // Performant way to determine if obj coerces to a number
1353
- var _isNumerical = function(obj) {
1354
- obj = obj - 0;
1355
- return obj === obj;
1356
- };
1357
-
1358
- // Sets up function which handles processing keys
1359
- // allowing the convert function to be modified by a callback
1360
- var _processor = function(convert, options) {
1361
- var callback = options && 'process' in options ? options.process : options;
1362
-
1363
- if(typeof(callback) !== 'function') {
1364
- return convert;
1365
- }
1366
-
1367
- return function(string, options) {
1368
- return callback(string, convert, options);
1369
- }
1370
- };
1371
-
1372
- var humps = {
1373
- camelize: camelize,
1374
- decamelize: decamelize,
1375
- pascalize: pascalize,
1376
- depascalize: decamelize,
1377
- camelizeKeys: function(object, options) {
1378
- return _processKeys(_processor(camelize, options), object);
1379
- },
1380
- decamelizeKeys: function(object, options) {
1381
- return _processKeys(_processor(decamelize, options), object, options);
1382
- },
1383
- pascalizeKeys: function(object, options) {
1384
- return _processKeys(_processor(pascalize, options), object);
1385
- },
1386
- depascalizeKeys: function () {
1387
- return this.decamelizeKeys.apply(this, arguments);
1388
- }
1389
- };
1390
-
1391
- if (module.exports) {
1392
- module.exports = humps;
1393
- } else {
1394
- global.humps = humps;
1395
- }
1396
-
1397
- })(commonjsGlobal);
1398
- } (humps));
1399
-
1400
1293
  class InvalidTokenError extends Error {
1401
1294
  }
1402
1295
  InvalidTokenError.prototype.name = "InvalidTokenError";
@@ -3540,7 +3433,7 @@ var __spreadValues$3 = (a, b) => {
3540
3433
  }
3541
3434
  return a;
3542
3435
  };
3543
- var __async$3 = (__this, __arguments, generator) => {
3436
+ var __async$4 = (__this, __arguments, generator) => {
3544
3437
  return new Promise((resolve, reject) => {
3545
3438
  var fulfilled = (value) => {
3546
3439
  try {
@@ -3579,7 +3472,7 @@ class FundingSourcesAPI {
3579
3472
  * The `create` method creates a new funding source for a given user. This requires
3580
3473
  * payment information to be collected from the user.
3581
3474
  */
3582
- this.create = (createFundingSource) => __async$3(this, null, function* () {
3475
+ this.create = (createFundingSource) => __async$4(this, null, function* () {
3583
3476
  const endUserIpAddress = yield getEndUserIpAddress();
3584
3477
  if (!endUserIpAddress) {
3585
3478
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -3593,7 +3486,7 @@ class FundingSourcesAPI {
3593
3486
  * user to update the billing address or payment information associated with the
3594
3487
  * funding source.
3595
3488
  */
3596
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$3(this, null, function* () {
3489
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$4(this, null, function* () {
3597
3490
  const endUserIpAddress = yield getEndUserIpAddress();
3598
3491
  if (!endUserIpAddress) {
3599
3492
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -3611,7 +3504,7 @@ class FundingSourcesAPI {
3611
3504
  * The `registerCarrier` method registers a carrier account and associates
3612
3505
  * it with a given funding source.
3613
3506
  */
3614
- this.registerCarrier = (carrier) => __async$3(this, null, function* () {
3507
+ this.registerCarrier = (carrier) => __async$4(this, null, function* () {
3615
3508
  const endUserIpAddress = yield getEndUserIpAddress();
3616
3509
  if (!endUserIpAddress) {
3617
3510
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -3623,7 +3516,7 @@ class FundingSourcesAPI {
3623
3516
  /**
3624
3517
  * The `addFunds` method allows you to add funds to a funding source.
3625
3518
  */
3626
- this.addFunds = (amount, fundingSourceId) => __async$3(this, null, function* () {
3519
+ this.addFunds = (amount, fundingSourceId) => __async$4(this, null, function* () {
3627
3520
  return yield this.client.put(
3628
3521
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
3629
3522
  amount
@@ -3633,7 +3526,7 @@ class FundingSourcesAPI {
3633
3526
  * The `metadata` method returns seller-specific requirements for creating funding sources
3634
3527
  * and attaching carriers
3635
3528
  */
3636
- this.metadata = () => __async$3(this, null, function* () {
3529
+ this.metadata = () => __async$4(this, null, function* () {
3637
3530
  return yield this.client.get("/v1/funding_sources/metadata");
3638
3531
  });
3639
3532
  /**
@@ -3685,6 +3578,55 @@ class InsuranceAPI {
3685
3578
  }
3686
3579
  }
3687
3580
 
3581
+ var __async$3 = (__this, __arguments, generator) => {
3582
+ return new Promise((resolve, reject) => {
3583
+ var fulfilled = (value) => {
3584
+ try {
3585
+ step(generator.next(value));
3586
+ } catch (e) {
3587
+ reject(e);
3588
+ }
3589
+ };
3590
+ var rejected = (value) => {
3591
+ try {
3592
+ step(generator.throw(value));
3593
+ } catch (e) {
3594
+ reject(e);
3595
+ }
3596
+ };
3597
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
3598
+ step((generator = generator.apply(__this, __arguments)).next());
3599
+ });
3600
+ };
3601
+ class InvoiceAddressAPI {
3602
+ constructor(client) {
3603
+ this.client = client;
3604
+ /**
3605
+ * The `get` method retrieves the invoice address for a given user.
3606
+ */
3607
+ this.get = () => {
3608
+ return this.client.get("/v1/invoice_address");
3609
+ };
3610
+ /**
3611
+ * The `create` method creates a new invoice address for a given user.
3612
+ */
3613
+ this.create = (invoiceAddress) => __async$3(this, null, function* () {
3614
+ return yield this.client.post("/v1/invoice_address", {
3615
+ invoiceAddress
3616
+ });
3617
+ });
3618
+ /**
3619
+ * The `update` method updates a invoice address for a given user.
3620
+ */
3621
+ this.update = (invoiceAddress) => __async$3(this, null, function* () {
3622
+ return yield this.client.put("/v1/invoice_address", {
3623
+ invoiceAddress
3624
+ });
3625
+ });
3626
+ this.client = client;
3627
+ }
3628
+ }
3629
+
3688
3630
  class LabelsAPI {
3689
3631
  constructor(client) {
3690
3632
  this.client = client;
@@ -3897,10 +3839,14 @@ class SalesOrderShipmentsAPI {
3897
3839
  /**
3898
3840
  * The `list` method retrieves a list of sales order shipments for a given user.
3899
3841
  */
3900
- this.list = (body = {}, params) => {
3901
- return this.client.post("/v-beta/shipments/list", body, {
3902
- params
3903
- });
3842
+ this.list = (body) => {
3843
+ return this.client.post("/v-beta/shipments/list", body);
3844
+ };
3845
+ /**
3846
+ * The `listShipmentsByExternalOrderId` method retrieves a list of shipments associated to a sales order that matches `externalOrderId`
3847
+ */
3848
+ this.listShipmentsByExternalOrderId = (externalOrderId) => {
3849
+ return this.client.get(`/v-beta/shipments/external_order_id/${externalOrderId}`);
3904
3850
  };
3905
3851
  /**
3906
3852
  * The `get` method retrieves a specific sales order shipment by `shipmentId`.
@@ -3942,6 +3888,13 @@ class SalesOrdersAPI {
3942
3888
  this.get = (salesOrderId) => {
3943
3889
  return this.client.get(`/v-beta/sales_orders/${salesOrderId}`);
3944
3890
  };
3891
+ /**
3892
+ * The `getByExternalId` method retrieves a specific sales order by its `externalOrderId`.
3893
+ * @param externalOrderId Id that matches that of the desired sales order.
3894
+ */
3895
+ this.getByExternalId = (externalOrderId) => {
3896
+ return this.client.get(`/v-beta/sales_orders/external_order_id/${externalOrderId}`);
3897
+ };
3945
3898
  /**
3946
3899
  * The `notifyShipped` method notifies order source that the order has been
3947
3900
  * shipped. Typically, the order source will then notify the user based on
@@ -21611,11 +21564,11 @@ class ShipEngineAPI {
21611
21564
  headers: __spreadProps(__spreadValues({}, headers), {
21612
21565
  "Content-Type": "application/json"
21613
21566
  }),
21614
- paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
21567
+ paramsSerializer: (params) => lib.stringify(decamelizeKeys(params), { arrayFormat: "brackets" }),
21615
21568
  transformRequest: [
21616
21569
  (data) => {
21617
21570
  if (data && !(data instanceof FormData))
21618
- return humpsExports.decamelizeKeys(data);
21571
+ return decamelizeKeys(data);
21619
21572
  else
21620
21573
  return data;
21621
21574
  },
@@ -21635,7 +21588,7 @@ class ShipEngineAPI {
21635
21588
  },
21636
21589
  (data) => {
21637
21590
  if (data && !(data instanceof Blob))
21638
- return humpsExports.camelizeKeys(data);
21591
+ return camelizeKeys(data);
21639
21592
  else
21640
21593
  return data;
21641
21594
  }
@@ -21808,6 +21761,15 @@ class ShipEngineAPI {
21808
21761
  get insurance() {
21809
21762
  return new InsuranceAPI(this.client);
21810
21763
  }
21764
+ /**
21765
+ * The `invoiceAddress` method provides access to the Invoice Address endpoints
21766
+ * in ShipEngine API.
21767
+ *
21768
+ * @see {@link InvoiceAddress | The Invoice Address API module}
21769
+ */
21770
+ get invoiceAddress() {
21771
+ return new InvoiceAddressAPI(this.client);
21772
+ }
21811
21773
  /**
21812
21774
  * The `labels` method provides access to the Label endpoints in ShipEngine API.
21813
21775
  * e.g. Create Label, Get Label, Void Label, etc.
@@ -21937,6 +21899,7 @@ exports.CustomsNonDeliveryType = CustomsNonDeliveryType;
21937
21899
  exports.FundingSourcesAPI = FundingSourcesAPI;
21938
21900
  exports.InsuranceAPI = InsuranceAPI;
21939
21901
  exports.InsuranceProviderType = InsuranceProviderType;
21902
+ exports.InvoiceAddressAPI = InvoiceAddressAPI;
21940
21903
  exports.LabelsAPI = LabelsAPI;
21941
21904
  exports.MetadataCapability = MetadataCapability;
21942
21905
  exports.MetadataRequirement = MetadataRequirement;
@@ -21957,6 +21920,8 @@ exports.ShippingRulesAPI = ShippingRulesAPI;
21957
21920
  exports.ThemesAPI = ThemesAPI;
21958
21921
  exports.WarehousesAPI = WarehousesAPI;
21959
21922
  exports.WebhooksAPI = WebhooksAPI;
21923
+ exports.camelizeKeys = camelizeKeys;
21924
+ exports.decamelizeKeys = decamelizeKeys;
21960
21925
  exports.getEndUserIpAddress = getEndUserIpAddress;
21961
21926
  exports.isCodedError = isCodedError;
21962
21927
  exports.isCodedErrors = isCodedErrors;
package/index.mjs CHANGED
@@ -971,7 +971,7 @@ var ipaddr = {
971
971
  }).call(commonjsGlobal);
972
972
  } (ipaddr));
973
973
 
974
- var __async$6 = (__this, __arguments, generator) => {
974
+ var __async$7 = (__this, __arguments, generator) => {
975
975
  return new Promise((resolve, reject) => {
976
976
  var fulfilled = (value) => {
977
977
  try {
@@ -991,7 +991,7 @@ var __async$6 = (__this, __arguments, generator) => {
991
991
  step((generator = generator.apply(__this, __arguments)).next());
992
992
  });
993
993
  };
994
- const getEndUserIpAddress = () => __async$6(void 0, null, function* () {
994
+ const getEndUserIpAddress = () => __async$7(void 0, null, function* () {
995
995
  try {
996
996
  const response = yield axios.get("https://api.ipify.org/?format=json");
997
997
  if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
@@ -1003,6 +1003,37 @@ const getEndUserIpAddress = () => __async$6(void 0, null, function* () {
1003
1003
  }
1004
1004
  });
1005
1005
 
1006
+ const camelizeKeys = (obj) => {
1007
+ if (Array.isArray(obj)) {
1008
+ return obj.map(camelizeKeys);
1009
+ } else if (obj !== null && typeof obj === "object") {
1010
+ const newObj = {};
1011
+ for (const key in obj) {
1012
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
1013
+ const newKey = key.replace(/_([a-z])/g, (match, letter) => letter.toUpperCase());
1014
+ newObj[newKey] = camelizeKeys(obj[key]);
1015
+ }
1016
+ }
1017
+ return newObj;
1018
+ }
1019
+ return obj;
1020
+ };
1021
+ const decamelizeKeys = (obj, separator = "_") => {
1022
+ if (Array.isArray(obj)) {
1023
+ return obj.map((item) => decamelizeKeys(item, separator));
1024
+ } else if (obj !== null && typeof obj === "object") {
1025
+ const newObj = {};
1026
+ for (const key in obj) {
1027
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
1028
+ const newKey = key.replace(/([A-Z])/g, (match) => separator + match.toLowerCase());
1029
+ newObj[newKey] = decamelizeKeys(obj[key], separator);
1030
+ }
1031
+ }
1032
+ return newObj;
1033
+ }
1034
+ return obj;
1035
+ };
1036
+
1006
1037
  var __defProp$4 = Object.defineProperty;
1007
1038
  var __defProps$1 = Object.defineProperties;
1008
1039
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
@@ -1034,7 +1065,7 @@ var __objRest$1 = (source, exclude) => {
1034
1065
  }
1035
1066
  return target;
1036
1067
  };
1037
- var __async$5 = (__this, __arguments, generator) => {
1068
+ var __async$6 = (__this, __arguments, generator) => {
1038
1069
  return new Promise((resolve, reject) => {
1039
1070
  var fulfilled = (value) => {
1040
1071
  try {
@@ -1074,7 +1105,7 @@ class CarriersAPI {
1074
1105
  /**
1075
1106
  * The `connect` method connects a carrier account to a user's ShipEngine account.
1076
1107
  */
1077
- this.connect = (_a) => __async$5(this, null, function* () {
1108
+ this.connect = (_a) => __async$6(this, null, function* () {
1078
1109
  var _b = _a, { carrierCode } = _b, connection = __objRest$1(_b, ["carrierCode"]);
1079
1110
  const endUserIpAddress = yield getEndUserIpAddress();
1080
1111
  if (!endUserIpAddress)
@@ -1165,7 +1196,7 @@ class CarriersAPI {
1165
1196
  }
1166
1197
  }
1167
1198
 
1168
- var __async$4 = (__this, __arguments, generator) => {
1199
+ var __async$5 = (__this, __arguments, generator) => {
1169
1200
  return new Promise((resolve, reject) => {
1170
1201
  var fulfilled = (value) => {
1171
1202
  try {
@@ -1207,7 +1238,7 @@ class ConnectionsAPI {
1207
1238
  /**
1208
1239
  * The `connectCarrier` method connects a carrier to account.
1209
1240
  */
1210
- this.connectCarrier = (carrierName, formData) => __async$4(this, null, function* () {
1241
+ this.connectCarrier = (carrierName, formData) => __async$5(this, null, function* () {
1211
1242
  return yield this.client.post(
1212
1243
  `/v1/connections/carriers/${carrierName}`,
1213
1244
  formData,
@@ -1255,144 +1286,6 @@ class ConnectionsAPI {
1255
1286
 
1256
1287
  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}();
1257
1288
 
1258
- var humpsExports = {};
1259
- var humps = {
1260
- get exports(){ return humpsExports; },
1261
- set exports(v){ humpsExports = v; },
1262
- };
1263
-
1264
- (function (module) {
1265
- (function(global) {
1266
-
1267
- var _processKeys = function(convert, obj, options) {
1268
- if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) {
1269
- return obj;
1270
- }
1271
-
1272
- var output,
1273
- i = 0,
1274
- l = 0;
1275
-
1276
- if(_isArray(obj)) {
1277
- output = [];
1278
- for(l=obj.length; i<l; i++) {
1279
- output.push(_processKeys(convert, obj[i], options));
1280
- }
1281
- }
1282
- else {
1283
- output = {};
1284
- for(var key in obj) {
1285
- if(Object.prototype.hasOwnProperty.call(obj, key)) {
1286
- output[convert(key, options)] = _processKeys(convert, obj[key], options);
1287
- }
1288
- }
1289
- }
1290
- return output;
1291
- };
1292
-
1293
- // String conversion methods
1294
-
1295
- var separateWords = function(string, options) {
1296
- options = options || {};
1297
- var separator = options.separator || '_';
1298
- var split = options.split || /(?=[A-Z])/;
1299
-
1300
- return string.split(split).join(separator);
1301
- };
1302
-
1303
- var camelize = function(string) {
1304
- if (_isNumerical(string)) {
1305
- return string;
1306
- }
1307
- string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) {
1308
- return chr ? chr.toUpperCase() : '';
1309
- });
1310
- // Ensure 1st char is always lowercase
1311
- return string.substr(0, 1).toLowerCase() + string.substr(1);
1312
- };
1313
-
1314
- var pascalize = function(string) {
1315
- var camelized = camelize(string);
1316
- // Ensure 1st char is always uppercase
1317
- return camelized.substr(0, 1).toUpperCase() + camelized.substr(1);
1318
- };
1319
-
1320
- var decamelize = function(string, options) {
1321
- return separateWords(string, options).toLowerCase();
1322
- };
1323
-
1324
- // Utilities
1325
- // Taken from Underscore.js
1326
-
1327
- var toString = Object.prototype.toString;
1328
-
1329
- var _isFunction = function(obj) {
1330
- return typeof(obj) === 'function';
1331
- };
1332
- var _isObject = function(obj) {
1333
- return obj === Object(obj);
1334
- };
1335
- var _isArray = function(obj) {
1336
- return toString.call(obj) == '[object Array]';
1337
- };
1338
- var _isDate = function(obj) {
1339
- return toString.call(obj) == '[object Date]';
1340
- };
1341
- var _isRegExp = function(obj) {
1342
- return toString.call(obj) == '[object RegExp]';
1343
- };
1344
- var _isBoolean = function(obj) {
1345
- return toString.call(obj) == '[object Boolean]';
1346
- };
1347
-
1348
- // Performant way to determine if obj coerces to a number
1349
- var _isNumerical = function(obj) {
1350
- obj = obj - 0;
1351
- return obj === obj;
1352
- };
1353
-
1354
- // Sets up function which handles processing keys
1355
- // allowing the convert function to be modified by a callback
1356
- var _processor = function(convert, options) {
1357
- var callback = options && 'process' in options ? options.process : options;
1358
-
1359
- if(typeof(callback) !== 'function') {
1360
- return convert;
1361
- }
1362
-
1363
- return function(string, options) {
1364
- return callback(string, convert, options);
1365
- }
1366
- };
1367
-
1368
- var humps = {
1369
- camelize: camelize,
1370
- decamelize: decamelize,
1371
- pascalize: pascalize,
1372
- depascalize: decamelize,
1373
- camelizeKeys: function(object, options) {
1374
- return _processKeys(_processor(camelize, options), object);
1375
- },
1376
- decamelizeKeys: function(object, options) {
1377
- return _processKeys(_processor(decamelize, options), object, options);
1378
- },
1379
- pascalizeKeys: function(object, options) {
1380
- return _processKeys(_processor(pascalize, options), object);
1381
- },
1382
- depascalizeKeys: function () {
1383
- return this.decamelizeKeys.apply(this, arguments);
1384
- }
1385
- };
1386
-
1387
- if (module.exports) {
1388
- module.exports = humps;
1389
- } else {
1390
- global.humps = humps;
1391
- }
1392
-
1393
- })(commonjsGlobal);
1394
- } (humps));
1395
-
1396
1289
  class InvalidTokenError extends Error {
1397
1290
  }
1398
1291
  InvalidTokenError.prototype.name = "InvalidTokenError";
@@ -3536,7 +3429,7 @@ var __spreadValues$3 = (a, b) => {
3536
3429
  }
3537
3430
  return a;
3538
3431
  };
3539
- var __async$3 = (__this, __arguments, generator) => {
3432
+ var __async$4 = (__this, __arguments, generator) => {
3540
3433
  return new Promise((resolve, reject) => {
3541
3434
  var fulfilled = (value) => {
3542
3435
  try {
@@ -3575,7 +3468,7 @@ class FundingSourcesAPI {
3575
3468
  * The `create` method creates a new funding source for a given user. This requires
3576
3469
  * payment information to be collected from the user.
3577
3470
  */
3578
- this.create = (createFundingSource) => __async$3(this, null, function* () {
3471
+ this.create = (createFundingSource) => __async$4(this, null, function* () {
3579
3472
  const endUserIpAddress = yield getEndUserIpAddress();
3580
3473
  if (!endUserIpAddress) {
3581
3474
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -3589,7 +3482,7 @@ class FundingSourcesAPI {
3589
3482
  * user to update the billing address or payment information associated with the
3590
3483
  * funding source.
3591
3484
  */
3592
- this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$3(this, null, function* () {
3485
+ this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$4(this, null, function* () {
3593
3486
  const endUserIpAddress = yield getEndUserIpAddress();
3594
3487
  if (!endUserIpAddress) {
3595
3488
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -3607,7 +3500,7 @@ class FundingSourcesAPI {
3607
3500
  * The `registerCarrier` method registers a carrier account and associates
3608
3501
  * it with a given funding source.
3609
3502
  */
3610
- this.registerCarrier = (carrier) => __async$3(this, null, function* () {
3503
+ this.registerCarrier = (carrier) => __async$4(this, null, function* () {
3611
3504
  const endUserIpAddress = yield getEndUserIpAddress();
3612
3505
  if (!endUserIpAddress) {
3613
3506
  return Promise.reject([new CodedError("Unable to get IP address")]);
@@ -3619,7 +3512,7 @@ class FundingSourcesAPI {
3619
3512
  /**
3620
3513
  * The `addFunds` method allows you to add funds to a funding source.
3621
3514
  */
3622
- this.addFunds = (amount, fundingSourceId) => __async$3(this, null, function* () {
3515
+ this.addFunds = (amount, fundingSourceId) => __async$4(this, null, function* () {
3623
3516
  return yield this.client.put(
3624
3517
  `/v1/funding_sources/${fundingSourceId}/add_funds`,
3625
3518
  amount
@@ -3629,7 +3522,7 @@ class FundingSourcesAPI {
3629
3522
  * The `metadata` method returns seller-specific requirements for creating funding sources
3630
3523
  * and attaching carriers
3631
3524
  */
3632
- this.metadata = () => __async$3(this, null, function* () {
3525
+ this.metadata = () => __async$4(this, null, function* () {
3633
3526
  return yield this.client.get("/v1/funding_sources/metadata");
3634
3527
  });
3635
3528
  /**
@@ -3681,6 +3574,55 @@ class InsuranceAPI {
3681
3574
  }
3682
3575
  }
3683
3576
 
3577
+ var __async$3 = (__this, __arguments, generator) => {
3578
+ return new Promise((resolve, reject) => {
3579
+ var fulfilled = (value) => {
3580
+ try {
3581
+ step(generator.next(value));
3582
+ } catch (e) {
3583
+ reject(e);
3584
+ }
3585
+ };
3586
+ var rejected = (value) => {
3587
+ try {
3588
+ step(generator.throw(value));
3589
+ } catch (e) {
3590
+ reject(e);
3591
+ }
3592
+ };
3593
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
3594
+ step((generator = generator.apply(__this, __arguments)).next());
3595
+ });
3596
+ };
3597
+ class InvoiceAddressAPI {
3598
+ constructor(client) {
3599
+ this.client = client;
3600
+ /**
3601
+ * The `get` method retrieves the invoice address for a given user.
3602
+ */
3603
+ this.get = () => {
3604
+ return this.client.get("/v1/invoice_address");
3605
+ };
3606
+ /**
3607
+ * The `create` method creates a new invoice address for a given user.
3608
+ */
3609
+ this.create = (invoiceAddress) => __async$3(this, null, function* () {
3610
+ return yield this.client.post("/v1/invoice_address", {
3611
+ invoiceAddress
3612
+ });
3613
+ });
3614
+ /**
3615
+ * The `update` method updates a invoice address for a given user.
3616
+ */
3617
+ this.update = (invoiceAddress) => __async$3(this, null, function* () {
3618
+ return yield this.client.put("/v1/invoice_address", {
3619
+ invoiceAddress
3620
+ });
3621
+ });
3622
+ this.client = client;
3623
+ }
3624
+ }
3625
+
3684
3626
  class LabelsAPI {
3685
3627
  constructor(client) {
3686
3628
  this.client = client;
@@ -3893,10 +3835,14 @@ class SalesOrderShipmentsAPI {
3893
3835
  /**
3894
3836
  * The `list` method retrieves a list of sales order shipments for a given user.
3895
3837
  */
3896
- this.list = (body = {}, params) => {
3897
- return this.client.post("/v-beta/shipments/list", body, {
3898
- params
3899
- });
3838
+ this.list = (body) => {
3839
+ return this.client.post("/v-beta/shipments/list", body);
3840
+ };
3841
+ /**
3842
+ * The `listShipmentsByExternalOrderId` method retrieves a list of shipments associated to a sales order that matches `externalOrderId`
3843
+ */
3844
+ this.listShipmentsByExternalOrderId = (externalOrderId) => {
3845
+ return this.client.get(`/v-beta/shipments/external_order_id/${externalOrderId}`);
3900
3846
  };
3901
3847
  /**
3902
3848
  * The `get` method retrieves a specific sales order shipment by `shipmentId`.
@@ -3938,6 +3884,13 @@ class SalesOrdersAPI {
3938
3884
  this.get = (salesOrderId) => {
3939
3885
  return this.client.get(`/v-beta/sales_orders/${salesOrderId}`);
3940
3886
  };
3887
+ /**
3888
+ * The `getByExternalId` method retrieves a specific sales order by its `externalOrderId`.
3889
+ * @param externalOrderId Id that matches that of the desired sales order.
3890
+ */
3891
+ this.getByExternalId = (externalOrderId) => {
3892
+ return this.client.get(`/v-beta/sales_orders/external_order_id/${externalOrderId}`);
3893
+ };
3941
3894
  /**
3942
3895
  * The `notifyShipped` method notifies order source that the order has been
3943
3896
  * shipped. Typically, the order source will then notify the user based on
@@ -21607,11 +21560,11 @@ class ShipEngineAPI {
21607
21560
  headers: __spreadProps(__spreadValues({}, headers), {
21608
21561
  "Content-Type": "application/json"
21609
21562
  }),
21610
- paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
21563
+ paramsSerializer: (params) => lib.stringify(decamelizeKeys(params), { arrayFormat: "brackets" }),
21611
21564
  transformRequest: [
21612
21565
  (data) => {
21613
21566
  if (data && !(data instanceof FormData))
21614
- return humpsExports.decamelizeKeys(data);
21567
+ return decamelizeKeys(data);
21615
21568
  else
21616
21569
  return data;
21617
21570
  },
@@ -21631,7 +21584,7 @@ class ShipEngineAPI {
21631
21584
  },
21632
21585
  (data) => {
21633
21586
  if (data && !(data instanceof Blob))
21634
- return humpsExports.camelizeKeys(data);
21587
+ return camelizeKeys(data);
21635
21588
  else
21636
21589
  return data;
21637
21590
  }
@@ -21804,6 +21757,15 @@ class ShipEngineAPI {
21804
21757
  get insurance() {
21805
21758
  return new InsuranceAPI(this.client);
21806
21759
  }
21760
+ /**
21761
+ * The `invoiceAddress` method provides access to the Invoice Address endpoints
21762
+ * in ShipEngine API.
21763
+ *
21764
+ * @see {@link InvoiceAddress | The Invoice Address API module}
21765
+ */
21766
+ get invoiceAddress() {
21767
+ return new InvoiceAddressAPI(this.client);
21768
+ }
21807
21769
  /**
21808
21770
  * The `labels` method provides access to the Label endpoints in ShipEngine API.
21809
21771
  * e.g. Create Label, Get Label, Void Label, etc.
@@ -21919,4 +21881,4 @@ class ShipEngineAPI {
21919
21881
  }
21920
21882
  }
21921
21883
 
21922
- export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, MovementIndicator, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, SellersAPI, ServicePointsAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, WebhooksAPI, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, parseError };
21884
+ export { AccountSettingsAPI, AddressesAPI, CarriersAPI, CodedError, ConfirmationType, ConnectionsAPI, CreditCardVendor, Currency, CustomPackagesAPI, CustomsContentsType, CustomsNonDeliveryType, FundingSourcesAPI, InsuranceAPI, InsuranceProviderType, InvoiceAddressAPI, LabelsAPI, MetadataCapability, MetadataRequirement, MetadataSatisfyingFormTypes, MovementIndicator, OrderSourcesAPI, RateCardStatus, RateCardsAPI, RatesAPI, types as SE, SalesOrderShipmentsAPI, SalesOrdersAPI, SellersAPI, ServicePointsAPI, ShipEngineAPI, ShipmentsAPI, ShippingRulesAPI, ThemesAPI, WarehousesAPI, WebhooksAPI, camelizeKeys, decamelizeKeys, getEndUserIpAddress, isCodedError, isCodedErrors, isDataCodedErrors, isInvalidTokenError, parseError };
@@ -0,0 +1,28 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { InvoiceAddress } from "./types";
3
+ /**
4
+ * @internal
5
+ * # Invoice Address API module - /v1/invoice_address
6
+ */
7
+ export declare class InvoiceAddressAPI {
8
+ private client;
9
+ constructor(client: AxiosInstance);
10
+ /**
11
+ * The `get` method retrieves the invoice address for a given user.
12
+ */
13
+ get: () => Promise<import("axios").AxiosResponse<{
14
+ invoiceAddress: InvoiceAddress;
15
+ }, any>>;
16
+ /**
17
+ * The `create` method creates a new invoice address for a given user.
18
+ */
19
+ create: (invoiceAddress: InvoiceAddress) => Promise<import("axios").AxiosResponse<{
20
+ invoiceAddress: InvoiceAddress;
21
+ }, any>>;
22
+ /**
23
+ * The `update` method updates a invoice address for a given user.
24
+ */
25
+ update: (invoiceAddress: InvoiceAddress) => Promise<import("axios").AxiosResponse<{
26
+ invoiceAddress: InvoiceAddress;
27
+ }, any>>;
28
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./types";
@@ -0,0 +1,13 @@
1
+ /** @internal */
2
+ export interface InvoiceAddress {
3
+ addressLine1: string;
4
+ addressLine2?: string;
5
+ cityLocality: string;
6
+ company?: string;
7
+ countryCode: string;
8
+ email: string;
9
+ fullName: string;
10
+ phone: string;
11
+ postalCode: string;
12
+ stateProvince: string;
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/js-api",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -60,15 +60,19 @@ export type ListSalesOrderShipmentsParams = {
60
60
  * # Sales Order Shipments - List Sales Order Shipments Body
61
61
  */
62
62
  export type ListSalesOrderShipmentBody = {
63
+ /**
64
+ * `externalOrderIds` is an array of non-unique external ids that match to a sales order
65
+ */
66
+ externalOrderIds?: string[];
63
67
  /**
64
68
  * `salesOrderIds` is an array of sales order IDs to be used when listing sales
65
69
  * orders.
66
70
  */
67
71
  salesOrderIds?: string[];
68
72
  /**
69
- * `shipments` is an array of shipments associated with the sales orders.
73
+ * `shipmentIds` is an array of shipments associated with the sales orders.
70
74
  */
71
- shipments?: SalesOrderShipment[];
75
+ shipmentIds?: string[];
72
76
  };
73
77
  /**
74
78
  * # Sales Order Shipments - List Sales Order Shipments Result
@@ -88,7 +92,11 @@ export declare class SalesOrderShipmentsAPI {
88
92
  /**
89
93
  * The `list` method retrieves a list of sales order shipments for a given user.
90
94
  */
91
- list: (body?: ListSalesOrderShipmentBody | undefined, params?: ListSalesOrderShipmentsParams) => Promise<import("axios").AxiosResponse<ListSalesOrderShipmentsResult, any>>;
95
+ list: (body: ListSalesOrderShipmentBody) => Promise<import("axios").AxiosResponse<ListSalesOrderShipmentsResult, any>>;
96
+ /**
97
+ * The `listShipmentsByExternalOrderId` method retrieves a list of shipments associated to a sales order that matches `externalOrderId`
98
+ */
99
+ listShipmentsByExternalOrderId: (externalOrderId: string) => Promise<import("axios").AxiosResponse<ListSalesOrderShipmentsResult, any>>;
92
100
  /**
93
101
  * The `get` method retrieves a specific sales order shipment by `shipmentId`.
94
102
  */
@@ -31,6 +31,11 @@ export declare class SalesOrdersAPI {
31
31
  * The `get` method retrieves a specific sales order by `salesOrderId`.
32
32
  */
33
33
  get: (salesOrderId: string) => Promise<import("axios").AxiosResponse<SalesOrder, any>>;
34
+ /**
35
+ * The `getByExternalId` method retrieves a specific sales order by its `externalOrderId`.
36
+ * @param externalOrderId Id that matches that of the desired sales order.
37
+ */
38
+ getByExternalId: (externalOrderId: string) => Promise<import("axios").AxiosResponse<SalesOrder, any>>;
34
39
  /**
35
40
  * The `notifyShipped` method notifies order source that the order has been
36
41
  * shipped. Typically, the order source will then notify the user based on
@@ -1,4 +1,4 @@
1
- import { Address, AddressValidation } from "../addresses";
1
+ import { Address, AddressValidation, ShippingAddress, ShippingAddressTo } from "../addresses";
2
2
  import { CarrierPackage } from "../carriers";
3
3
  import { CodedError } from "../errors";
4
4
  import { OrderSourceCode } from "../order-sources";
@@ -203,36 +203,47 @@ export interface Shipment {
203
203
  useUpsGroundFreightPricing?: boolean;
204
204
  windsorFrameworkDetails?: WindsorFrameworkDetails;
205
205
  };
206
+ amountPaid: Money;
207
+ assignedUser?: string | null;
206
208
  carrierId: string;
207
- comparisonRateType?: string;
209
+ comparisonRateType?: string | null;
208
210
  confirmation: ConfirmationType;
209
211
  createdAt: string;
210
212
  customs?: Customs;
211
- externalOrderId?: string;
212
- externalShipmentId?: string;
213
+ externalOrderId?: string | null;
214
+ externalShipmentId?: string | null;
215
+ holdUntilDate?: string | null;
213
216
  insuranceProvider: InsuranceProviderType;
217
+ isGift?: boolean;
214
218
  isReturn?: boolean;
215
219
  items: ShipmentItem[];
216
220
  modifiedAt: string;
221
+ notesForGift?: string | null;
222
+ notesFromBuyer?: string | null;
217
223
  orderSourceCode: OrderSourceCode | null;
218
224
  originType?: OriginTypes;
219
225
  packages: ShipmentPackage[];
220
- returnTo: Address | null;
226
+ requestedShipmentService?: string | null;
227
+ retailRate?: number | null;
228
+ returnTo: ShippingAddress | null;
221
229
  serviceCode: string | null;
230
+ shipByDate?: string | null;
222
231
  shipDate?: string;
223
- shipFrom: Address | null;
232
+ shipFrom: ShippingAddress;
224
233
  shipmentId: string;
225
234
  shipmentNumber?: string;
226
235
  shipmentStatus: ShipmentStatus;
227
- shippingRuleId?: string;
228
- shipTo: Address;
236
+ shippingPaid: Money;
237
+ shippingRuleId?: string | null;
238
+ shipTo: ShippingAddressTo;
229
239
  tags: {
230
240
  name: string;
231
241
  }[];
232
242
  taxIdentifiers?: TaxIdentifier[];
243
+ taxPaid: Money;
233
244
  totalWeight: WeightWithUnit;
234
245
  validateAddress?: AddressValidationOptions;
235
- warehouseId?: string;
246
+ warehouseId?: string | null;
236
247
  }
237
248
  export type ShipmentRateResponse = {
238
249
  createdAt: string;
package/types.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from "./dimensions/types";
9
9
  export * from "./errors/types";
10
10
  export * from "./funding-sources/types";
11
11
  export * from "./insurance/types";
12
+ export * from "./invoice-address/types";
12
13
  export * from "./labels/types";
13
14
  export * from "./order-sources/types";
14
15
  export * from "./payments/types";
@@ -0,0 +1,2 @@
1
+ export declare const camelizeKeys: (obj: any) => any;
2
+ export declare const decamelizeKeys: (obj: any, separator?: string) => any;
@@ -1 +1,2 @@
1
1
  export * from "./ip-address";
2
+ export * from "./casing";