@myparcel-dev/sdk 4.1.0 → 4.1.1
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.
- package/lib/endpoints/private/accounts/Account.types.d.ts +1 -1
- package/lib/endpoints/private/carrier-options/CarrierOption.types.d.ts +1 -1
- package/lib/endpoints/private/shipments/Shipment.types.d.ts +1 -1
- package/lib/endpoints/private/system-country-codes/SystemCountryCodes.types.d.ts +1 -1
- package/lib/endpoints/private/track-traces/TrackTraces.types.d.ts +1 -1
- package/lib/endpoints/public/carriers/Carrier.types.d.ts +1 -1
- package/lib/endpoints/public/carriers/GetCarrier.d.ts +1 -1
- package/lib/endpoints/public/delivery-options/DeliveryOption.types.d.ts +1 -1
- package/lib/endpoints/public/delivery-options/GetDeliveryOptions.d.ts +1 -1
- package/lib/endpoints/public/pickup-locations/PickupLocation.types.d.ts +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.js +74 -72
- package/lib/model/endpoint/AbstractEndpoint.types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PlatformId } from '@myparcel/constants';
|
|
1
|
+
import { type PlatformId } from '@myparcel-dev/constants';
|
|
2
2
|
import { type Address } from '../../../types/common.types';
|
|
3
3
|
import { type PaginationParameters, type IntBoolean, type Price } from '../../../types';
|
|
4
4
|
import { type MyParcelShop } from '../shops/Shop.types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CarrierId, type CustomsDeclarationContents, type DeliveryTypeId, type PackageTypeId, type ShipmentStatus } from '@myparcel/constants';
|
|
1
|
+
import { type CarrierId, type CustomsDeclarationContents, type DeliveryTypeId, type PackageTypeId, type ShipmentStatus } from '@myparcel-dev/constants';
|
|
2
2
|
import { type Address, type AddressWithContactDetails, type RetailLocation } from '../../../types';
|
|
3
3
|
import { type IntBoolean, type Price, type WithRequired } from '../../../types';
|
|
4
4
|
export interface PostedShipmentReference {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address, type AddressWithContactDetails } from '../../../types';
|
|
2
|
-
import { type CarrierId } from '@myparcel/constants';
|
|
2
|
+
import { type CarrierId } from '@myparcel-dev/constants';
|
|
3
3
|
import { type PickupLocation } from '../../public';
|
|
4
4
|
import { type ShipmentOptions } from '../shipments';
|
|
5
5
|
export interface PartnerTrackTraceLink {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CarrierNameOrId } from '@myparcel/constants';
|
|
1
|
+
import { type CarrierNameOrId } from '@myparcel-dev/constants';
|
|
2
2
|
import { AbstractPublicEndpoint } from '../../../model/endpoint/AbstractPublicEndpoint';
|
|
3
3
|
import { type CreateDefinition } from '../../../model/endpoint/AbstractEndpoint.types';
|
|
4
4
|
import { type Carrier } from './Carrier.types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DeliveryTypeName, type PackageTypeName, type ShipmentOptionName } from '@myparcel/constants';
|
|
1
|
+
import { type DeliveryTypeName, type PackageTypeName, type ShipmentOptionName } from '@myparcel-dev/constants';
|
|
2
2
|
import { type EnumSchema, type Timestamp } from '../../../types';
|
|
3
3
|
interface PossibleShipmentOption {
|
|
4
4
|
name: ShipmentOptionName;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CarrierNameOrId, type DeliveryTypeId, type PackageTypeName, type PlatformNameOrId } from '@myparcel/constants';
|
|
1
|
+
import { type CarrierNameOrId, type DeliveryTypeId, type PackageTypeName, type PlatformNameOrId } from '@myparcel-dev/constants';
|
|
2
2
|
import { type RequestHeaders } from '../../../types/request.types';
|
|
3
3
|
import { type WithRequired } from '../../../types/global.types';
|
|
4
4
|
import { AbstractPublicEndpoint } from '../../../model/endpoint/AbstractPublicEndpoint';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DeliveryTypeId, type DeliveryTypeName } from '@myparcel/constants';
|
|
1
|
+
import { type DeliveryTypeId, type DeliveryTypeName } from '@myparcel-dev/constants';
|
|
2
2
|
import { type StartEndDate, type Timestamp, type Weekday } from '../../../types';
|
|
3
3
|
export interface PickupLocation {
|
|
4
4
|
address: {
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var C=Object.defineProperty;var G=(s,t,r)=>t in s?C(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var e=(s,t,r)=>(G(s,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("@myparcel/ts-utils");class c extends Error{constructor(r){super(r);e(this,"name","user");Object.setPrototypeOf(this,c.prototype),this.name="UserException"}}class l extends Error{constructor(r){super(r.message);e(this,"data");Object.setPrototypeOf(this,l.prototype),this.name="ApiException",this.data=r}}const x=(s,t)=>{if(t){const r=Object.entries(t).map(([a,i])=>`${a}=${i}`);r.length&&(s+=`?${r.join("&")}`)}return s},O="https://api.myparcel.nl",_=["POST","PUT"];class T{constructor(t){e(this,"baseUrl");e(this,"headers");e(this,"parameters");e(this,"options");e(this,"_requiredHeaders",[]);this.baseUrl=((t==null?void 0:t.baseUrl)??O).replace(/\/+$/,""),this.headers=(t==null?void 0:t.headers)??{},this.parameters=(t==null?void 0:t.parameters)??{},this.options=(t==null?void 0:t.options)??{}}get requiredHeaders(){return this._requiredHeaders}set requiredHeaders(t){this._requiredHeaders=t}async doRequest(t,r){const a=this.normalizeOptions(t,{...r,...this.options});this.validateHeaders(t,a);const i=await this.request(t,a);if(m.isOfType(i,"errors"))throw new l(i);return this.getResponseBody(t,i)}getResponseBody(t,r){if(!m.isOfType(r,"data"))return r;const a=t.getResponseProperty();if(!a)return r.data;const{page:i,size:n,results:p}=r.data;return i===void 0&&n===void 0&&p===void 0?r.data[a]:{[a]:r.data[a],...i!==void 0&&{page:i},...n!==void 0&&{size:n},...p!==void 0&&{results:p}}}getHeaders(){return{Accept:"application/json",...this.headers}}createUrl(t,r){let a=t.getPath();if(a.length&&!a.startsWith("/")&&(a=`/${a}`),r!=null&&r.path&&(a=this.substitutePath(a,r.path)),a.includes("/:"))throw new c(`One or more path variables are missing in ${a}`);return r!=null&&r.parameters&&(a=x(a,r.parameters)),this.baseUrl+a}substitutePath(t,r){if(r&&Object.entries(r).forEach(([a,i])=>{t=t.replace(`:${a}`,String(i))}),t.includes(":")){const a=t.match(/:\w+?\?/g);a==null||a.forEach(i=>{t=t.replace(`/${i}`,"")})}return t}validateHeaders(t,r){const a=Object.entries(r.headers).reduce((n,[p,d])=>({...n,[p.toLowerCase()]:d}),{}),i=this.requiredHeaders.filter(n=>!(n.toLowerCase()in a));if(i.length)throw new c(`Required headers are missing: ${i.join(", ")}`)}normalizeOptions(t,r){const a={...r,parameters:{...this.parameters,...r.parameters,...t.getParameters()},headers:{..._.includes(t.method)?{"Content-Type":"application/json"}:{},...this.getHeaders(),...r.headers,...t.getHeaders()}};if(m.isOfType(r,"body")){const i=t.getProperty();if(r.body instanceof FormData)return a.body=r.body,delete a.headers["Content-Type"],a;i===void 0?a.body={data:r.body}:a.body={data:{[i]:r.body}}}return a}}const A=s=>{try{return JSON.parse(s),!0}catch{return!1}};class k extends T{constructor(r){super(r);e(this,"request",async(r,a)=>{var P,g;const i=r.getTimeout()??a.timeout,n=new AbortController,p=setTimeout(()=>n.abort(),i),d={method:r.method,headers:a.headers,...i&&{signal:n.signal}};m.isOfType(a,"body")&&(a.body instanceof FormData?d.body=a.body:d.body=JSON.stringify(a.body));const h=await fetch(this.createUrl(r,a),d);if(clearTimeout(p),h.body){if((P=h.headers.get("Content-Disposition"))!=null&&P.includes("attachment"))return h.blob();const y=await h.text();return(g=h.headers.get("Content-Type"))!=null&&g.includes("application/json")&&A(y)?JSON.parse(y):y}})}}class b{constructor(t){e(this,"method","GET");e(this,"property");e(this,"responseProperty");e(this,"timeout");e(this,"headers");e(this,"parameters");this.headers=(t==null?void 0:t.headers)??{},this.parameters=(t==null?void 0:t.parameters)??{}}getHeaders(){return this.headers}getParameters(){return this.parameters}getPath(){return this.path}getProperty(){return this.property}getResponseProperty(){return this.responseProperty??this.property}getTimeout(){return this.timeout}}class o extends b{}class u extends b{}function S(s,t){if(!t.length)throw new c("At least one endpoint must be passed.");return t.reduce((r,a)=>({...r,[a.name]:async i=>s.doRequest(a,i??{})}),{})}const E=(s,t)=>(s.requiredHeaders=["Authorization"],S(s,t)),v=(s,t)=>S(s,t);class w extends o{constructor(){super(...arguments);e(this,"method","DELETE");e(this,"name","deleteAccountMessage");e(this,"path","account_messages/:id");e(this,"property","messages")}}class D extends o{constructor(){super(...arguments);e(this,"name","getAccountMessages");e(this,"path","account_messages");e(this,"property","messages")}}class H extends o{constructor(){super(...arguments);e(this,"name","getAccount");e(this,"path","accounts/:id");e(this,"property","accounts")}}class f extends o{constructor(){super(...arguments);e(this,"name","getAccounts");e(this,"path","accounts");e(this,"property","accounts")}}class U extends o{constructor(){super(...arguments);e(this,"method","PUT");e(this,"name","putAccount");e(this,"path","accounts");e(this,"property","accounts")}}class L extends o{constructor(){super(...arguments);e(this,"name","getApiKeys");e(this,"path","keys");e(this,"property","api_keys")}}class j extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postApiKeys");e(this,"path","keys");e(this,"property","api_keys")}}class q extends o{constructor(){super(...arguments);e(this,"method","DELETE");e(this,"name","deleteCarrierOption");e(this,"path","accounts/:account_id/carrier_options/:contract_id");e(this,"property","carrier_options")}}class M extends o{constructor(){super(...arguments);e(this,"name","getCarrierOptions");e(this,"path","carrier_management/accounts/:account_id/carrier_options");e(this,"property","carrier_options")}}class W extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postCarrierOptions");e(this,"path","accounts/:account_id/carrier_options");e(this,"property","carrier_options");e(this,"responseProperty","ids")}}class R extends o{constructor(){super(...arguments);e(this,"name","putCarrierOptions");e(this,"path","carrier_management/accounts/:account_id/carrier_options");e(this,"property","carrier_options");e(this,"method","PUT")}}class $ extends o{constructor(){super(...arguments);e(this,"name","getLocations");e(this,"path","locations");e(this,"property","locations")}}class K extends o{constructor(){super(...arguments);e(this,"name","getShipment");e(this,"path","shipments/:id");e(this,"property","shipments")}}class J extends o{constructor(){super(...arguments);e(this,"name","getShipments");e(this,"path","shipments");e(this,"property","shipments")}}class N extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postShipments");e(this,"path","shipments");e(this,"property","shipments");e(this,"responseProperty","ids")}getHeaders(){return{...super.getHeaders(),"Content-Type":"application/vnd.shipment+json;charset=utf-8;version=1.1"}}}class z extends o{constructor(){super(...arguments);e(this,"name","getShop");e(this,"path","shops/:id");e(this,"property","shops")}}class B extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postShop");e(this,"path","shops/duplicate");e(this,"property","shops");e(this,"responseProperty","ids")}}class F extends o{constructor(){super(...arguments);e(this,"method","PUT");e(this,"name","putShop");e(this,"path","shops");e(this,"property","shops")}}class I extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postShopDuplicate");e(this,"path","shops/duplicate");e(this,"property","ids")}}class Q extends o{constructor(){super(...arguments);e(this,"name","getSubscriptionsCapabilities");e(this,"path","subscriptions/capabilities");e(this,"property","capabilities")}}class X extends o{constructor(){super(...arguments);e(this,"method","DELETE");e(this,"name","deleteSubscription");e(this,"path","subscriptions/:id");e(this,"property","subscriptions")}}class Y extends o{constructor(){super(...arguments);e(this,"name","getSubscriptions");e(this,"path","subscriptions");e(this,"property","subscriptions")}}class Z extends o{constructor(){super(...arguments);e(this,"method","PATCH");e(this,"name","patchSubscriptions");e(this,"path","subscriptions");e(this,"property","subscriptions");e(this,"responseProperty","ids")}}class V extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postSubscriptions");e(this,"path","subscriptions");e(this,"property","subscriptions");e(this,"responseProperty","ids")}}class ee extends o{constructor(){super(...arguments);e(this,"name","getSystemCountryCodes");e(this,"path","system_country_codes");e(this,"property","countries")}}class te extends o{constructor(){super(...arguments);e(this,"name","getSystemMessages");e(this,"path","system_messages");e(this,"property","messages")}}class se extends o{constructor(){super(...arguments);e(this,"name","getTrackAndTrace");e(this,"path","tracktraces/:shipment_id");e(this,"property","tracktraces")}}class re extends o{constructor(){super(...arguments);e(this,"method","DELETE");e(this,"name","deleteWebhookSubscriptions");e(this,"path","webhook_subscriptions/:ids");e(this,"property","webhook_subscriptions")}}class ae extends o{constructor(){super(...arguments);e(this,"name","getWebhookSubscriptions");e(this,"path","webhook_subscriptions");e(this,"property","webhook_subscriptions")}}class oe extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postWebhookSubscriptions");e(this,"path","webhook_subscriptions");e(this,"property","webhook_subscriptions");e(this,"responseProperty","ids")}}class ie extends u{constructor(){super(...arguments);e(this,"name","getCarrier");e(this,"path","carriers/:carrier");e(this,"property","carriers")}}class ne extends u{constructor(){super(...arguments);e(this,"name","getCarriers");e(this,"path","carriers");e(this,"property","carriers")}}class pe extends u{constructor(){super(...arguments);e(this,"name","getDeliveryOptions");e(this,"path","delivery_options");e(this,"property","deliveries")}getHeaders(){return{...super.getHeaders(),Accept:"application/json;version=2.0"}}}class ce extends u{constructor(){super(...arguments);e(this,"name","getPickupLocations");e(this,"path","pickup_locations");e(this,"property","pickup_locations")}}exports.AbstractClient=T;exports.AbstractEndpoint=b;exports.AbstractPrivateEndpoint=o;exports.AbstractPublicEndpoint=u;exports.ApiException=l;exports.BASE_URL=O;exports.DeleteAccountMessage=w;exports.DeleteCarrierOptions=q;exports.DeleteSubscription=X;exports.DeleteWebhookSubscriptions=re;exports.FetchClient=k;exports.GetAccount=H;exports.GetAccountMessages=D;exports.GetAccounts=f;exports.GetApiKeys=L;exports.GetCarrier=ie;exports.GetCarrierOptions=M;exports.GetCarriers=ne;exports.GetDeliveryOptions=pe;exports.GetLocations=$;exports.GetPickupLocations=ce;exports.GetShipment=K;exports.GetShipments=J;exports.GetShop=z;exports.GetSubscriptions=Y;exports.GetSubscriptionsCapabilities=Q;exports.GetSystemCountryCodes=ee;exports.GetSystemMessages=te;exports.GetTrackAndTrace=se;exports.GetWebhookSubscriptions=ae;exports.PatchSubscriptions=Z;exports.PostApiKeys=j;exports.PostCarrierOptions=W;exports.PostShipments=N;exports.PostShop=B;exports.PostShopDuplicate=I;exports.PostSubscriptions=V;exports.PostWebhookSubscriptions=oe;exports.PutAccount=U;exports.PutCarrierOptions=R;exports.PutShop=F;exports.UserException=c;exports.addParameters=x;exports.createMyParcelSdk=S;exports.createPrivateSdk=E;exports.createPublicSdk=v;exports.isJson=A;
|
|
1
|
+
"use strict";var T=Object.defineProperty;var G=(s,t,r)=>t in s?T(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var e=(s,t,r)=>(G(s,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m(s,t){return(s==null?void 0:s[t])!==void 0}class c extends Error{constructor(r){super(r);e(this,"name","user");Object.setPrototypeOf(this,c.prototype),this.name="UserException"}}class l extends Error{constructor(r){super(r.message);e(this,"data");Object.setPrototypeOf(this,l.prototype),this.name="ApiException",this.data=r}}const x=(s,t)=>{if(t){const r=Object.entries(t).map(([a,i])=>`${a}=${i}`);r.length&&(s+=`?${r.join("&")}`)}return s},A="https://api.myparcel.nl",_=["POST","PUT"];class C{constructor(t){e(this,"baseUrl");e(this,"headers");e(this,"parameters");e(this,"options");e(this,"_requiredHeaders",[]);this.baseUrl=((t==null?void 0:t.baseUrl)??A).replace(/\/+$/,""),this.headers=(t==null?void 0:t.headers)??{},this.parameters=(t==null?void 0:t.parameters)??{},this.options=(t==null?void 0:t.options)??{}}get requiredHeaders(){return this._requiredHeaders}set requiredHeaders(t){this._requiredHeaders=t}async doRequest(t,r){const a=this.normalizeOptions(t,{...r,...this.options});this.validateHeaders(t,a);const i=await this.request(t,a);if(m(i,"errors"))throw new l(i);return this.getResponseBody(t,i)}getResponseBody(t,r){if(!m(r,"data"))return r;const a=t.getResponseProperty();if(!a)return r.data;const{page:i,size:n,results:p}=r.data;return i===void 0&&n===void 0&&p===void 0?r.data[a]:{[a]:r.data[a],...i!==void 0&&{page:i},...n!==void 0&&{size:n},...p!==void 0&&{results:p}}}getHeaders(){return{Accept:"application/json",...this.headers}}createUrl(t,r){let a=t.getPath();if(a.length&&!a.startsWith("/")&&(a=`/${a}`),r!=null&&r.path&&(a=this.substitutePath(a,r.path)),a.includes("/:"))throw new c(`One or more path variables are missing in ${a}`);return r!=null&&r.parameters&&(a=x(a,r.parameters)),this.baseUrl+a}substitutePath(t,r){if(r&&Object.entries(r).forEach(([a,i])=>{t=t.replace(`:${a}`,String(i))}),t.includes(":")){const a=t.match(/:\w+?\?/g);a==null||a.forEach(i=>{t=t.replace(`/${i}`,"")})}return t}validateHeaders(t,r){const a=Object.entries(r.headers).reduce((n,[p,d])=>({...n,[p.toLowerCase()]:d}),{}),i=this.requiredHeaders.filter(n=>!(n.toLowerCase()in a));if(i.length)throw new c(`Required headers are missing: ${i.join(", ")}`)}normalizeOptions(t,r){const a={...r,parameters:{...this.parameters,...r.parameters,...t.getParameters()},headers:{..._.includes(t.method)?{"Content-Type":"application/json"}:{},...this.getHeaders(),...r.headers,...t.getHeaders()}};if(m(r,"body")){const i=t.getProperty();if(r.body instanceof FormData)return a.body=r.body,delete a.headers["Content-Type"],a;i===void 0?a.body={data:r.body}:a.body={data:{[i]:r.body}}}return a}}const O=s=>{try{return JSON.parse(s),!0}catch{return!1}};class k extends C{constructor(r){super(r);e(this,"request",async(r,a)=>{var P,g;const i=r.getTimeout()??a.timeout,n=new AbortController,p=setTimeout(()=>n.abort(),i),d={method:r.method,headers:a.headers,...i&&{signal:n.signal}};m(a,"body")&&(a.body instanceof FormData?d.body=a.body:d.body=JSON.stringify(a.body));const h=await fetch(this.createUrl(r,a),d);if(clearTimeout(p),h.body){if((P=h.headers.get("Content-Disposition"))!=null&&P.includes("attachment"))return h.blob();const y=await h.text();return(g=h.headers.get("Content-Type"))!=null&&g.includes("application/json")&&O(y)?JSON.parse(y):y}})}}class b{constructor(t){e(this,"method","GET");e(this,"property");e(this,"responseProperty");e(this,"timeout");e(this,"headers");e(this,"parameters");this.headers=(t==null?void 0:t.headers)??{},this.parameters=(t==null?void 0:t.parameters)??{}}getHeaders(){return this.headers}getParameters(){return this.parameters}getPath(){return this.path}getProperty(){return this.property}getResponseProperty(){return this.responseProperty??this.property}getTimeout(){return this.timeout}}class o extends b{}class u extends b{}function S(s,t){if(!t.length)throw new c("At least one endpoint must be passed.");return t.reduce((r,a)=>({...r,[a.name]:async i=>s.doRequest(a,i??{})}),{})}const E=(s,t)=>(s.requiredHeaders=["Authorization"],S(s,t)),w=(s,t)=>S(s,t);class D extends o{constructor(){super(...arguments);e(this,"method","DELETE");e(this,"name","deleteAccountMessage");e(this,"path","account_messages/:id");e(this,"property","messages")}}class H extends o{constructor(){super(...arguments);e(this,"name","getAccountMessages");e(this,"path","account_messages");e(this,"property","messages")}}class v extends o{constructor(){super(...arguments);e(this,"name","getAccount");e(this,"path","accounts/:id");e(this,"property","accounts")}}class f extends o{constructor(){super(...arguments);e(this,"name","getAccounts");e(this,"path","accounts");e(this,"property","accounts")}}class L extends o{constructor(){super(...arguments);e(this,"method","PUT");e(this,"name","putAccount");e(this,"path","accounts");e(this,"property","accounts")}}class U extends o{constructor(){super(...arguments);e(this,"name","getApiKeys");e(this,"path","keys");e(this,"property","api_keys")}}class j extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postApiKeys");e(this,"path","keys");e(this,"property","api_keys")}}class M extends o{constructor(){super(...arguments);e(this,"method","DELETE");e(this,"name","deleteCarrierOption");e(this,"path","accounts/:account_id/carrier_options/:contract_id");e(this,"property","carrier_options")}}class q extends o{constructor(){super(...arguments);e(this,"name","getCarrierOptions");e(this,"path","carrier_management/accounts/:account_id/carrier_options");e(this,"property","carrier_options")}}class W extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postCarrierOptions");e(this,"path","accounts/:account_id/carrier_options");e(this,"property","carrier_options");e(this,"responseProperty","ids")}}class R extends o{constructor(){super(...arguments);e(this,"name","putCarrierOptions");e(this,"path","carrier_management/accounts/:account_id/carrier_options");e(this,"property","carrier_options");e(this,"method","PUT")}}class $ extends o{constructor(){super(...arguments);e(this,"name","getLocations");e(this,"path","locations");e(this,"property","locations")}}class K extends o{constructor(){super(...arguments);e(this,"name","getShipment");e(this,"path","shipments/:id");e(this,"property","shipments")}}class J extends o{constructor(){super(...arguments);e(this,"name","getShipments");e(this,"path","shipments");e(this,"property","shipments")}}class N extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postShipments");e(this,"path","shipments");e(this,"property","shipments");e(this,"responseProperty","ids")}getHeaders(){return{...super.getHeaders(),"Content-Type":"application/vnd.shipment+json;charset=utf-8;version=1.1"}}}class z extends o{constructor(){super(...arguments);e(this,"name","getShop");e(this,"path","shops/:id");e(this,"property","shops")}}class B extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postShop");e(this,"path","shops/duplicate");e(this,"property","shops");e(this,"responseProperty","ids")}}class F extends o{constructor(){super(...arguments);e(this,"method","PUT");e(this,"name","putShop");e(this,"path","shops");e(this,"property","shops")}}class I extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postShopDuplicate");e(this,"path","shops/duplicate");e(this,"property","ids")}}class Q extends o{constructor(){super(...arguments);e(this,"name","getSubscriptionsCapabilities");e(this,"path","subscriptions/capabilities");e(this,"property","capabilities")}}class X extends o{constructor(){super(...arguments);e(this,"method","DELETE");e(this,"name","deleteSubscription");e(this,"path","subscriptions/:id");e(this,"property","subscriptions")}}class Y extends o{constructor(){super(...arguments);e(this,"name","getSubscriptions");e(this,"path","subscriptions");e(this,"property","subscriptions")}}class Z extends o{constructor(){super(...arguments);e(this,"method","PATCH");e(this,"name","patchSubscriptions");e(this,"path","subscriptions");e(this,"property","subscriptions");e(this,"responseProperty","ids")}}class V extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postSubscriptions");e(this,"path","subscriptions");e(this,"property","subscriptions");e(this,"responseProperty","ids")}}class ee extends o{constructor(){super(...arguments);e(this,"name","getSystemCountryCodes");e(this,"path","system_country_codes");e(this,"property","countries")}}class te extends o{constructor(){super(...arguments);e(this,"name","getSystemMessages");e(this,"path","system_messages");e(this,"property","messages")}}class se extends o{constructor(){super(...arguments);e(this,"name","getTrackAndTrace");e(this,"path","tracktraces/:shipment_id");e(this,"property","tracktraces")}}class re extends o{constructor(){super(...arguments);e(this,"method","DELETE");e(this,"name","deleteWebhookSubscriptions");e(this,"path","webhook_subscriptions/:ids");e(this,"property","webhook_subscriptions")}}class ae extends o{constructor(){super(...arguments);e(this,"name","getWebhookSubscriptions");e(this,"path","webhook_subscriptions");e(this,"property","webhook_subscriptions")}}class oe extends o{constructor(){super(...arguments);e(this,"method","POST");e(this,"name","postWebhookSubscriptions");e(this,"path","webhook_subscriptions");e(this,"property","webhook_subscriptions");e(this,"responseProperty","ids")}}class ie extends u{constructor(){super(...arguments);e(this,"name","getCarrier");e(this,"path","carriers/:carrier");e(this,"property","carriers")}}class ne extends u{constructor(){super(...arguments);e(this,"name","getCarriers");e(this,"path","carriers");e(this,"property","carriers")}}class pe extends u{constructor(){super(...arguments);e(this,"name","getDeliveryOptions");e(this,"path","delivery_options");e(this,"property","deliveries")}getHeaders(){return{...super.getHeaders(),Accept:"application/json;version=2.0"}}}class ce extends u{constructor(){super(...arguments);e(this,"name","getPickupLocations");e(this,"path","pickup_locations");e(this,"property","pickup_locations")}}exports.AbstractClient=C;exports.AbstractEndpoint=b;exports.AbstractPrivateEndpoint=o;exports.AbstractPublicEndpoint=u;exports.ApiException=l;exports.BASE_URL=A;exports.DeleteAccountMessage=D;exports.DeleteCarrierOptions=M;exports.DeleteSubscription=X;exports.DeleteWebhookSubscriptions=re;exports.FetchClient=k;exports.GetAccount=v;exports.GetAccountMessages=H;exports.GetAccounts=f;exports.GetApiKeys=U;exports.GetCarrier=ie;exports.GetCarrierOptions=q;exports.GetCarriers=ne;exports.GetDeliveryOptions=pe;exports.GetLocations=$;exports.GetPickupLocations=ce;exports.GetShipment=K;exports.GetShipments=J;exports.GetShop=z;exports.GetSubscriptions=Y;exports.GetSubscriptionsCapabilities=Q;exports.GetSystemCountryCodes=ee;exports.GetSystemMessages=te;exports.GetTrackAndTrace=se;exports.GetWebhookSubscriptions=ae;exports.PatchSubscriptions=Z;exports.PostApiKeys=j;exports.PostCarrierOptions=W;exports.PostShipments=N;exports.PostShop=B;exports.PostShopDuplicate=I;exports.PostSubscriptions=V;exports.PostWebhookSubscriptions=oe;exports.PutAccount=L;exports.PutCarrierOptions=R;exports.PutShop=F;exports.UserException=c;exports.addParameters=x;exports.createMyParcelSdk=S;exports.createPrivateSdk=E;exports.createPublicSdk=w;exports.isJson=O;
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
var x = Object.defineProperty;
|
|
2
2
|
var T = (s, t, r) => t in s ? x(s, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[t] = r;
|
|
3
3
|
var e = (s, t, r) => (T(s, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
-
|
|
4
|
+
function u(s, t) {
|
|
5
|
+
return (s == null ? void 0 : s[t]) !== void 0;
|
|
6
|
+
}
|
|
5
7
|
class h extends Error {
|
|
6
8
|
constructor(r) {
|
|
7
9
|
super(r);
|
|
@@ -181,7 +183,7 @@ const k = (s) => {
|
|
|
181
183
|
return !1;
|
|
182
184
|
}
|
|
183
185
|
};
|
|
184
|
-
class
|
|
186
|
+
class w extends A {
|
|
185
187
|
constructor(r) {
|
|
186
188
|
super(r);
|
|
187
189
|
e(this, "request", async (r, a) => {
|
|
@@ -268,7 +270,7 @@ function P(s, t) {
|
|
|
268
270
|
{}
|
|
269
271
|
);
|
|
270
272
|
}
|
|
271
|
-
const
|
|
273
|
+
const H = (s, t) => (s.requiredHeaders = ["Authorization"], P(s, t)), G = (s, t) => P(s, t);
|
|
272
274
|
class f extends o {
|
|
273
275
|
constructor() {
|
|
274
276
|
super(...arguments);
|
|
@@ -278,7 +280,7 @@ class f extends o {
|
|
|
278
280
|
e(this, "property", "messages");
|
|
279
281
|
}
|
|
280
282
|
}
|
|
281
|
-
class
|
|
283
|
+
class v extends o {
|
|
282
284
|
constructor() {
|
|
283
285
|
super(...arguments);
|
|
284
286
|
e(this, "name", "getAccountMessages");
|
|
@@ -286,7 +288,7 @@ class D extends o {
|
|
|
286
288
|
e(this, "property", "messages");
|
|
287
289
|
}
|
|
288
290
|
}
|
|
289
|
-
class
|
|
291
|
+
class D extends o {
|
|
290
292
|
constructor() {
|
|
291
293
|
super(...arguments);
|
|
292
294
|
e(this, "name", "getAccount");
|
|
@@ -294,7 +296,7 @@ class j extends o {
|
|
|
294
296
|
e(this, "property", "accounts");
|
|
295
297
|
}
|
|
296
298
|
}
|
|
297
|
-
class
|
|
299
|
+
class j extends o {
|
|
298
300
|
constructor() {
|
|
299
301
|
super(...arguments);
|
|
300
302
|
e(this, "name", "getAccounts");
|
|
@@ -302,7 +304,7 @@ class q extends o {
|
|
|
302
304
|
e(this, "property", "accounts");
|
|
303
305
|
}
|
|
304
306
|
}
|
|
305
|
-
class
|
|
307
|
+
class q extends o {
|
|
306
308
|
constructor() {
|
|
307
309
|
super(...arguments);
|
|
308
310
|
e(this, "method", "PUT");
|
|
@@ -311,7 +313,7 @@ class U extends o {
|
|
|
311
313
|
e(this, "property", "accounts");
|
|
312
314
|
}
|
|
313
315
|
}
|
|
314
|
-
class
|
|
316
|
+
class U extends o {
|
|
315
317
|
constructor() {
|
|
316
318
|
super(...arguments);
|
|
317
319
|
e(this, "name", "getApiKeys");
|
|
@@ -319,7 +321,7 @@ class L extends o {
|
|
|
319
321
|
e(this, "property", "api_keys");
|
|
320
322
|
}
|
|
321
323
|
}
|
|
322
|
-
class
|
|
324
|
+
class L extends o {
|
|
323
325
|
constructor() {
|
|
324
326
|
super(...arguments);
|
|
325
327
|
e(this, "method", "POST");
|
|
@@ -328,7 +330,7 @@ class $ extends o {
|
|
|
328
330
|
e(this, "property", "api_keys");
|
|
329
331
|
}
|
|
330
332
|
}
|
|
331
|
-
class
|
|
333
|
+
class $ extends o {
|
|
332
334
|
constructor() {
|
|
333
335
|
super(...arguments);
|
|
334
336
|
e(this, "method", "DELETE");
|
|
@@ -337,7 +339,7 @@ class M extends o {
|
|
|
337
339
|
e(this, "property", "carrier_options");
|
|
338
340
|
}
|
|
339
341
|
}
|
|
340
|
-
class
|
|
342
|
+
class M extends o {
|
|
341
343
|
constructor() {
|
|
342
344
|
super(...arguments);
|
|
343
345
|
e(this, "name", "getCarrierOptions");
|
|
@@ -345,7 +347,7 @@ class R extends o {
|
|
|
345
347
|
e(this, "property", "carrier_options");
|
|
346
348
|
}
|
|
347
349
|
}
|
|
348
|
-
class
|
|
350
|
+
class R extends o {
|
|
349
351
|
constructor() {
|
|
350
352
|
super(...arguments);
|
|
351
353
|
e(this, "method", "POST");
|
|
@@ -355,7 +357,7 @@ class W extends o {
|
|
|
355
357
|
e(this, "responseProperty", "ids");
|
|
356
358
|
}
|
|
357
359
|
}
|
|
358
|
-
class
|
|
360
|
+
class W extends o {
|
|
359
361
|
constructor() {
|
|
360
362
|
super(...arguments);
|
|
361
363
|
e(this, "name", "putCarrierOptions");
|
|
@@ -364,7 +366,7 @@ class N extends o {
|
|
|
364
366
|
e(this, "method", "PUT");
|
|
365
367
|
}
|
|
366
368
|
}
|
|
367
|
-
class
|
|
369
|
+
class N extends o {
|
|
368
370
|
constructor() {
|
|
369
371
|
super(...arguments);
|
|
370
372
|
e(this, "name", "getLocations");
|
|
@@ -372,7 +374,7 @@ class z extends o {
|
|
|
372
374
|
e(this, "property", "locations");
|
|
373
375
|
}
|
|
374
376
|
}
|
|
375
|
-
class
|
|
377
|
+
class z extends o {
|
|
376
378
|
constructor() {
|
|
377
379
|
super(...arguments);
|
|
378
380
|
e(this, "name", "getShipment");
|
|
@@ -380,7 +382,7 @@ class J extends o {
|
|
|
380
382
|
e(this, "property", "shipments");
|
|
381
383
|
}
|
|
382
384
|
}
|
|
383
|
-
class
|
|
385
|
+
class J extends o {
|
|
384
386
|
constructor() {
|
|
385
387
|
super(...arguments);
|
|
386
388
|
e(this, "name", "getShipments");
|
|
@@ -388,7 +390,7 @@ class K extends o {
|
|
|
388
390
|
e(this, "property", "shipments");
|
|
389
391
|
}
|
|
390
392
|
}
|
|
391
|
-
class
|
|
393
|
+
class K extends o {
|
|
392
394
|
constructor() {
|
|
393
395
|
super(...arguments);
|
|
394
396
|
e(this, "method", "POST");
|
|
@@ -404,7 +406,7 @@ class B extends o {
|
|
|
404
406
|
};
|
|
405
407
|
}
|
|
406
408
|
}
|
|
407
|
-
class
|
|
409
|
+
class B extends o {
|
|
408
410
|
constructor() {
|
|
409
411
|
super(...arguments);
|
|
410
412
|
e(this, "name", "getShop");
|
|
@@ -412,7 +414,7 @@ class F extends o {
|
|
|
412
414
|
e(this, "property", "shops");
|
|
413
415
|
}
|
|
414
416
|
}
|
|
415
|
-
class
|
|
417
|
+
class F extends o {
|
|
416
418
|
constructor() {
|
|
417
419
|
super(...arguments);
|
|
418
420
|
e(this, "method", "POST");
|
|
@@ -422,7 +424,7 @@ class I extends o {
|
|
|
422
424
|
e(this, "responseProperty", "ids");
|
|
423
425
|
}
|
|
424
426
|
}
|
|
425
|
-
class
|
|
427
|
+
class I extends o {
|
|
426
428
|
constructor() {
|
|
427
429
|
super(...arguments);
|
|
428
430
|
e(this, "method", "PUT");
|
|
@@ -431,7 +433,7 @@ class Q extends o {
|
|
|
431
433
|
e(this, "property", "shops");
|
|
432
434
|
}
|
|
433
435
|
}
|
|
434
|
-
class
|
|
436
|
+
class Q extends o {
|
|
435
437
|
constructor() {
|
|
436
438
|
super(...arguments);
|
|
437
439
|
e(this, "method", "POST");
|
|
@@ -440,7 +442,7 @@ class X extends o {
|
|
|
440
442
|
e(this, "property", "ids");
|
|
441
443
|
}
|
|
442
444
|
}
|
|
443
|
-
class
|
|
445
|
+
class X extends o {
|
|
444
446
|
constructor() {
|
|
445
447
|
super(...arguments);
|
|
446
448
|
e(this, "name", "getSubscriptionsCapabilities");
|
|
@@ -448,7 +450,7 @@ class Y extends o {
|
|
|
448
450
|
e(this, "property", "capabilities");
|
|
449
451
|
}
|
|
450
452
|
}
|
|
451
|
-
class
|
|
453
|
+
class Y extends o {
|
|
452
454
|
constructor() {
|
|
453
455
|
super(...arguments);
|
|
454
456
|
e(this, "method", "DELETE");
|
|
@@ -457,7 +459,7 @@ class Z extends o {
|
|
|
457
459
|
e(this, "property", "subscriptions");
|
|
458
460
|
}
|
|
459
461
|
}
|
|
460
|
-
class
|
|
462
|
+
class Z extends o {
|
|
461
463
|
constructor() {
|
|
462
464
|
super(...arguments);
|
|
463
465
|
e(this, "name", "getSubscriptions");
|
|
@@ -465,7 +467,7 @@ class V extends o {
|
|
|
465
467
|
e(this, "property", "subscriptions");
|
|
466
468
|
}
|
|
467
469
|
}
|
|
468
|
-
class
|
|
470
|
+
class V extends o {
|
|
469
471
|
constructor() {
|
|
470
472
|
super(...arguments);
|
|
471
473
|
e(this, "method", "PATCH");
|
|
@@ -475,7 +477,7 @@ class ee extends o {
|
|
|
475
477
|
e(this, "responseProperty", "ids");
|
|
476
478
|
}
|
|
477
479
|
}
|
|
478
|
-
class
|
|
480
|
+
class ee extends o {
|
|
479
481
|
constructor() {
|
|
480
482
|
super(...arguments);
|
|
481
483
|
e(this, "method", "POST");
|
|
@@ -485,7 +487,7 @@ class te extends o {
|
|
|
485
487
|
e(this, "responseProperty", "ids");
|
|
486
488
|
}
|
|
487
489
|
}
|
|
488
|
-
class
|
|
490
|
+
class te extends o {
|
|
489
491
|
constructor() {
|
|
490
492
|
super(...arguments);
|
|
491
493
|
e(this, "name", "getSystemCountryCodes");
|
|
@@ -493,7 +495,7 @@ class se extends o {
|
|
|
493
495
|
e(this, "property", "countries");
|
|
494
496
|
}
|
|
495
497
|
}
|
|
496
|
-
class
|
|
498
|
+
class se extends o {
|
|
497
499
|
constructor() {
|
|
498
500
|
super(...arguments);
|
|
499
501
|
e(this, "name", "getSystemMessages");
|
|
@@ -501,7 +503,7 @@ class re extends o {
|
|
|
501
503
|
e(this, "property", "messages");
|
|
502
504
|
}
|
|
503
505
|
}
|
|
504
|
-
class
|
|
506
|
+
class re extends o {
|
|
505
507
|
constructor() {
|
|
506
508
|
super(...arguments);
|
|
507
509
|
e(this, "name", "getTrackAndTrace");
|
|
@@ -509,7 +511,7 @@ class ae extends o {
|
|
|
509
511
|
e(this, "property", "tracktraces");
|
|
510
512
|
}
|
|
511
513
|
}
|
|
512
|
-
class
|
|
514
|
+
class ae extends o {
|
|
513
515
|
constructor() {
|
|
514
516
|
super(...arguments);
|
|
515
517
|
e(this, "method", "DELETE");
|
|
@@ -518,7 +520,7 @@ class oe extends o {
|
|
|
518
520
|
e(this, "property", "webhook_subscriptions");
|
|
519
521
|
}
|
|
520
522
|
}
|
|
521
|
-
class
|
|
523
|
+
class oe extends o {
|
|
522
524
|
constructor() {
|
|
523
525
|
super(...arguments);
|
|
524
526
|
e(this, "name", "getWebhookSubscriptions");
|
|
@@ -526,7 +528,7 @@ class ie extends o {
|
|
|
526
528
|
e(this, "property", "webhook_subscriptions");
|
|
527
529
|
}
|
|
528
530
|
}
|
|
529
|
-
class
|
|
531
|
+
class ie extends o {
|
|
530
532
|
constructor() {
|
|
531
533
|
super(...arguments);
|
|
532
534
|
e(this, "method", "POST");
|
|
@@ -536,7 +538,7 @@ class ne extends o {
|
|
|
536
538
|
e(this, "responseProperty", "ids");
|
|
537
539
|
}
|
|
538
540
|
}
|
|
539
|
-
class
|
|
541
|
+
class ne extends m {
|
|
540
542
|
constructor() {
|
|
541
543
|
super(...arguments);
|
|
542
544
|
e(this, "name", "getCarrier");
|
|
@@ -544,7 +546,7 @@ class pe extends m {
|
|
|
544
546
|
e(this, "property", "carriers");
|
|
545
547
|
}
|
|
546
548
|
}
|
|
547
|
-
class
|
|
549
|
+
class pe extends m {
|
|
548
550
|
constructor() {
|
|
549
551
|
super(...arguments);
|
|
550
552
|
e(this, "name", "getCarriers");
|
|
@@ -552,7 +554,7 @@ class ce extends m {
|
|
|
552
554
|
e(this, "property", "carriers");
|
|
553
555
|
}
|
|
554
556
|
}
|
|
555
|
-
class
|
|
557
|
+
class ce extends m {
|
|
556
558
|
constructor() {
|
|
557
559
|
super(...arguments);
|
|
558
560
|
e(this, "name", "getDeliveryOptions");
|
|
@@ -563,7 +565,7 @@ class de extends m {
|
|
|
563
565
|
return { ...super.getHeaders(), Accept: "application/json;version=2.0" };
|
|
564
566
|
}
|
|
565
567
|
}
|
|
566
|
-
class
|
|
568
|
+
class de extends m {
|
|
567
569
|
constructor() {
|
|
568
570
|
super(...arguments);
|
|
569
571
|
e(this, "name", "getPickupLocations");
|
|
@@ -579,44 +581,44 @@ export {
|
|
|
579
581
|
y as ApiException,
|
|
580
582
|
O as BASE_URL,
|
|
581
583
|
f as DeleteAccountMessage,
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
584
|
+
$ as DeleteCarrierOptions,
|
|
585
|
+
Y as DeleteSubscription,
|
|
586
|
+
ae as DeleteWebhookSubscriptions,
|
|
587
|
+
w as FetchClient,
|
|
588
|
+
D as GetAccount,
|
|
589
|
+
v as GetAccountMessages,
|
|
590
|
+
j as GetAccounts,
|
|
591
|
+
U as GetApiKeys,
|
|
592
|
+
ne as GetCarrier,
|
|
593
|
+
M as GetCarrierOptions,
|
|
594
|
+
pe as GetCarriers,
|
|
595
|
+
ce as GetDeliveryOptions,
|
|
596
|
+
N as GetLocations,
|
|
597
|
+
de as GetPickupLocations,
|
|
598
|
+
z as GetShipment,
|
|
599
|
+
J as GetShipments,
|
|
600
|
+
B as GetShop,
|
|
601
|
+
Z as GetSubscriptions,
|
|
602
|
+
X as GetSubscriptionsCapabilities,
|
|
603
|
+
te as GetSystemCountryCodes,
|
|
604
|
+
se as GetSystemMessages,
|
|
605
|
+
re as GetTrackAndTrace,
|
|
606
|
+
oe as GetWebhookSubscriptions,
|
|
607
|
+
V as PatchSubscriptions,
|
|
608
|
+
L as PostApiKeys,
|
|
609
|
+
R as PostCarrierOptions,
|
|
610
|
+
K as PostShipments,
|
|
611
|
+
F as PostShop,
|
|
612
|
+
Q as PostShopDuplicate,
|
|
613
|
+
ee as PostSubscriptions,
|
|
614
|
+
ie as PostWebhookSubscriptions,
|
|
615
|
+
q as PutAccount,
|
|
616
|
+
W as PutCarrierOptions,
|
|
617
|
+
I as PutShop,
|
|
616
618
|
h as UserException,
|
|
617
619
|
_ as addParameters,
|
|
618
620
|
P as createMyParcelSdk,
|
|
619
|
-
|
|
620
|
-
|
|
621
|
+
H as createPrivateSdk,
|
|
622
|
+
G as createPublicSdk,
|
|
621
623
|
k as isJson
|
|
622
624
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RequestHeaders } from '../../types/request.types';
|
|
2
2
|
import { type NoInfer } from '../../types/global.types';
|
|
3
|
-
import { type OneOrMore } from '@myparcel/ts-utils';
|
|
3
|
+
import { type OneOrMore } from '@myparcel-dev/ts-utils';
|
|
4
4
|
type Pagination = {
|
|
5
5
|
page?: number;
|
|
6
6
|
size?: number;
|