@duffel/api 1.28.0 → 2.0.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,6 +1,6 @@
1
1
  import { OrderSlice } from 'types';
2
- export declare type AirlineInitiatedChangeActionTaken = 'accepted' | 'cancelled' | 'changed';
3
- export declare type AirlineInitiatedChangeAvailableAction = 'accept' | 'cancel' | 'change' | 'update';
2
+ export type AirlineInitiatedChangeActionTaken = 'accepted' | 'cancelled' | 'changed';
3
+ export type AirlineInitiatedChangeAvailableAction = 'accept' | 'cancel' | 'change' | 'update';
4
4
  export interface AirlineInitiatedChange {
5
5
  /**
6
6
  * The action taken in response to this airline-initiated change. Accepted,
@@ -75,7 +75,7 @@ interface CreateOfferRequestNonAdultPassenger extends CreateOfferRequestPassenge
75
75
  fare_type?: never;
76
76
  type?: never;
77
77
  }
78
- export declare type CreateOfferRequestPassengerFareType = 'accompanying_adult' | 'contract_bulk' | 'contract_bulk_child' | 'contract_bulk_infant_with_seat' | 'contract_bulk_infant_without_seat' | 'frequent_flyer' | 'group_inclusive_tour' | 'group_inclusive_tour_child' | 'humanitarian' | 'individual_inclusive_tour_child' | 'marine' | 'seat_only' | 'student' | 'teacher' | 'tour_operator_inclusive' | 'tour_operator_inclusive_infant' | 'unaccompanied_child' | 'visiting_friends_and_family';
78
+ export type CreateOfferRequestPassengerFareType = 'accompanying_adult' | 'contract_bulk' | 'contract_bulk_child' | 'contract_bulk_infant_with_seat' | 'contract_bulk_infant_without_seat' | 'frequent_flyer' | 'group_inclusive_tour' | 'group_inclusive_tour_child' | 'humanitarian' | 'individual_inclusive_tour_child' | 'marine' | 'seat_only' | 'student' | 'teacher' | 'tour_operator_inclusive' | 'tour_operator_inclusive_infant' | 'unaccompanied_child' | 'visiting_friends_and_family';
79
79
  interface CreateOfferRequestPassengerWithFareType extends CreateOfferRequestPassengerCommon {
80
80
  /**
81
81
  * The age of the passenger on the `departure_date` of the final slice. e.g.
@@ -94,7 +94,7 @@ interface CreateOfferRequestPassengerWithFareType extends CreateOfferRequestPass
94
94
  fare_type: CreateOfferRequestPassengerFareType;
95
95
  type?: never;
96
96
  }
97
- export declare type CreateOfferRequestPassenger = CreateOfferRequestAdultPassenger | CreateOfferRequestNonAdultPassenger | CreateOfferRequestPassengerWithFareType;
97
+ export type CreateOfferRequestPassenger = CreateOfferRequestAdultPassenger | CreateOfferRequestNonAdultPassenger | CreateOfferRequestPassengerWithFareType;
98
98
  export interface CreateOfferRequestPrivateFare {
99
99
  corporate_code: string;
100
100
  tracking_reference: string;
@@ -6,7 +6,7 @@ import { CabinClass, FlightsConditions, LoyaltyProgrammeAccount, PassengerIdenti
6
6
  export interface Offer {
7
7
  /**
8
8
  * The types of identity documents that may be provided for the passengers when creating an order based on this offer.
9
- * Currently, the only supported type is `passport`. If this is `[]`, then you must not provide identity documents.
9
+ * If this is `[]`, then you must not provide identity documents.
10
10
  */
11
11
  allowed_passenger_identity_document_types: PassengerIdentityDocumentType[];
12
12
  /**
@@ -208,7 +208,7 @@ export interface OfferAvailableServiceCFAR extends OfferAvailableServiceCommon {
208
208
  */
209
209
  type: 'cancel_for_any_reason';
210
210
  }
211
- export declare type OfferAvailableService = OfferAvailableServiceBaggage | OfferAvailableServiceCFAR;
211
+ export type OfferAvailableService = OfferAvailableServiceBaggage | OfferAvailableServiceCFAR;
212
212
  export interface PaymentRequirements {
213
213
  /**
214
214
  * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime by which
@@ -448,7 +448,7 @@ export interface OfferSliceSegmentPassenger {
448
448
  */
449
449
  fare_basis_code: string;
450
450
  }
451
- export declare type BaggageType = 'carry_on' | 'checked';
451
+ export type BaggageType = 'carry_on' | 'checked';
452
452
  export interface OfferSliceSegmentPassengerBaggage {
453
453
  /**
454
454
  * The type of the baggage allowance
@@ -22,7 +22,7 @@ export interface Seat {
22
22
  /**
23
23
  * An object containing metadata about the service, like the maximum weight and dimensions of the baggage.
24
24
  */
25
- export declare type OrderServiceBaggageMetadata = OfferAvailableServiceBaggageMetadata;
25
+ export type OrderServiceBaggageMetadata = OfferAvailableServiceBaggageMetadata;
26
26
  export interface OrderSegmentPassengerBaggage {
27
27
  /**
28
28
  * The number of this type of bag allowed on the segment. Note that this can currently be 0 in some cases.
@@ -147,7 +147,7 @@ export interface OrderPassenger {
147
147
  }
148
148
  export interface OrderPassengerIdentityDocument {
149
149
  /**
150
- * The type of the identity document. Currently, the only supported type is passport. This must be one of the allowed_passenger_identity_document_types on the offer.
150
+ * The type of the identity document. This must be one of the allowed_passenger_identity_document_types on the offer.
151
151
  */
152
152
  type: PassengerIdentityDocumentType;
153
153
  /**
@@ -319,7 +319,7 @@ export interface OrderPaymentStatus {
319
319
  * The type of document
320
320
  * @returns "electronic_ticket", "electronic_miscellaneous_document_associated", or "electronic_miscellaneous_document_standalone"
321
321
  */
322
- export declare type OrderDocumentsType = 'electronic_ticket' | 'electronic_miscellaneous_document_associated' | 'electronic_miscellaneous_document_standalone';
322
+ export type OrderDocumentsType = 'electronic_ticket' | 'electronic_miscellaneous_document_associated' | 'electronic_miscellaneous_document_standalone';
323
323
  export interface OrderDocument {
324
324
  /**
325
325
  * The identifier for the document, in the case of electronic
@@ -497,4 +497,4 @@ export interface AddServices {
497
497
  payment: OrderPayment;
498
498
  add_services: Pick<OrderService, 'id' | 'quantity'>[];
499
499
  }
500
- export declare type OrderAvailableService = OfferAvailableServiceBaggage;
500
+ export type OrderAvailableService = OfferAvailableServiceBaggage;
@@ -185,6 +185,6 @@ export interface SeatMapCabinRowSectionElementStairs {
185
185
  */
186
186
  type: 'stairs';
187
187
  }
188
- export declare type SeatMapCabinRowSectionElement = SeatMapCabinRowSectionElementSeat | SeatMapCabinRowSectionElementBassinet | SeatMapCabinRowSectionElementEmpty | SeatMapCabinRowSectionElementExitRow | SeatMapCabinRowSectionElementLavatory | SeatMapCabinRowSectionElementGalley | SeatMapCabinRowSectionElementCloset | SeatMapCabinRowSectionElementStairs;
189
- export declare type SeatMapCabinRowSectionElementType = SeatMapCabinRowSectionElement['type'];
190
- export declare type SeatMapCabinRowSectionElementAmenity = Exclude<SeatMapCabinRowSectionElementType, 'empty' | 'seat'>;
188
+ export type SeatMapCabinRowSectionElement = SeatMapCabinRowSectionElementSeat | SeatMapCabinRowSectionElementBassinet | SeatMapCabinRowSectionElementEmpty | SeatMapCabinRowSectionElementExitRow | SeatMapCabinRowSectionElementLavatory | SeatMapCabinRowSectionElementGalley | SeatMapCabinRowSectionElementCloset | SeatMapCabinRowSectionElementStairs;
189
+ export type SeatMapCabinRowSectionElementType = SeatMapCabinRowSectionElement['type'];
190
+ export type SeatMapCabinRowSectionElementAmenity = Exclude<SeatMapCabinRowSectionElementType, 'empty' | 'seat'>;
package/dist/index.es.js CHANGED
@@ -1,2 +1,2 @@
1
- import t from"node-fetch";import{URL as e,URLSearchParams as s}from"url";function i(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(i=Object.getOwnPropertySymbols(t);h<i.length;h++)e.indexOf(i[h])<0&&Object.prototype.propertyIsEnumerable.call(t,i[h])&&(s[i[h]]=t[i[h]])}return s}function h(t,e,s,i){return new(s||(s=Promise))((function(h,r){function a(t){try{o(i.next(t))}catch(t){r(t)}}function n(t){try{o(i.throw(t))}catch(t){r(t)}}function o(t){var e;t.done?h(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function r(t){return this instanceof r?(this.v=t,this):new r(t)}function a(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,h=s.apply(t,e||[]),a=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){h[t]&&(i[t]=function(e){return new Promise((function(s,i){a.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=h[t](e)).value instanceof r?Promise.resolve(s.value.v).then(u,d):c(a[0][2],s)}catch(t){c(a[0][3],t)}var s}function u(t){o("next",t)}function d(t){o("throw",t)}function c(t,e){t(e),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"1.27.0"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class n{constructor(t){this.request=({method:t,path:e,data:s,params:i})=>h(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class o extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class u extends n{constructor(t){super(t),this.update=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{action_taken:e}})})),this.accept=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/accept`})})),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:{order_id:t}})})),this.path="air/airline_initiated_changes"}}class d extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>h(this,void 0,void 0,(function*(){const{return_offers:e}=t,s=i(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:s,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class c extends n{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=i(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,s=i(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>h(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class p extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class f extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.getAvailableServices=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:e})})),this.path="air/orders"}}class l extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class v extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class m extends n{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class q extends n{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class g extends n{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:e})})),this.path="air/partial_offer_requests"}}class $ extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}class T extends Error{constructor({meta:t,errors:e,headers:s}){super(),this.meta=t,this.errors=e,this.headers=s}}class y{constructor({token:i,basePath:r,apiVersion:a,debug:n,source:o}){this.request=({method:i,path:r,data:a,params:n,compress:o=!0})=>h(this,void 0,void 0,(function*(){var h,u;let d,c;const p=new e(r,this.basePath),f={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(n){const t=new s;Object.entries(n).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),p.search=t.toString()}a&&(d=JSON.stringify({data:Object.assign({},a)})),(null===(h=this.debug)||void 0===h?void 0:h.verbose)&&(console.info("Endpoint: ",p.href),console.info("Method: ",i),a&&console.info("Body Parameters: ",a),n&&console.info("Query Parameters: ",n));const l=yield t(p.href,{method:i,headers:f,body:d,compress:o});(null===(u=this.debug)||void 0===u?void 0:u.verbose)&&l.headers.get("x-request-id")&&console.info("Request ID: ",l.headers.get("x-request-id"));const v=l.headers.get("content-type");if(c=v&&v.includes("json")?yield l.json():yield l.text(),!l.ok||"errors"in c&&c.errors)throw new T(Object.assign(Object.assign({},c),{headers:l.headers}));return Object.assign(Object.assign({},c),{headers:l.headers})})),this.token=i,this.basePath=r||"https://api.duffel.com",this.apiVersion=a||"v1",this.debug=n,this.source=o}paginatedRequest({path:t,params:e}){return a(this,arguments,(function*(){let s=yield r(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield r({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield r(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield r({data:t})}}))}}class O extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class b extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class E extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class G extends n{constructor(t){super(t),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}class w extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/refunds"}}class _ extends n{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="links/sessions"}}class P extends n{constructor(t){super(t),this.redeliver=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/events/${t}/actions/redeliver`})})),this.ping=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/ping`})})),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/events/${t}`})})),this.listDeliveries=t=>h(this,void 0,void 0,(function*(){var e=i(t,[]);return this.request({method:"GET",path:`${this.path}/deliveries`,params:Object.assign({},e)})})),this.delete=t=>h(this,void 0,void 0,(function*(){return this.request({method:"DELETE",path:`${this.path}/${t}`})})),this.update=(t,{active:e,events:s,url:i})=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{active:e,events:s,url:i}})})),this.list=t=>h(this,void 0,void 0,(function*(){var e=i(t,[]);return this.request({method:"GET",path:this.path,params:Object.assign({},e)})})),this.create=({events:t,url:e})=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{events:t,url:e}})})),this.path="air/webhooks"}}class x{constructor(t){this.client=new y(t),this.aircraft=new O(this.client),this.airlines=new b(this.client),this.airports=new E(this.client),this.airlineInitiatedChanges=new u(this.client),this.links=new _(this.client),this.offerRequests=new d(this.client),this.offers=new c(this.client),this.orders=new f(this.client),this.orderChangeRequests=new l(this.client),this.orderChangeOffers=new v(this.client),this.orderChanges=new m(this.client),this.orderCancellations=new p(this.client),this.payments=new q(this.client),this.seatMaps=new $(this.client),this.paymentIntents=new o(this.client),this.partialOfferRequests=new g(this.client),this.suggestions=new G(this.client),this.refunds=new w(this.client),this.webhooks=new P(this.client)}}const S=T;export{x as Duffel,S as DuffelError};
1
+ import t from"node-fetch";import{URL as e,URLSearchParams as s}from"url";function i(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(i=Object.getOwnPropertySymbols(t);h<i.length;h++)e.indexOf(i[h])<0&&Object.prototype.propertyIsEnumerable.call(t,i[h])&&(s[i[h]]=t[i[h]])}return s}function h(t,e,s,i){return new(s||(s=Promise))((function(h,r){function a(t){try{o(i.next(t))}catch(t){r(t)}}function n(t){try{o(i.throw(t))}catch(t){r(t)}}function o(t){var e;t.done?h(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function r(t){return this instanceof r?(this.v=t,this):new r(t)}function a(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,h=s.apply(t,e||[]),a=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){h[t]&&(i[t]=function(e){return new Promise((function(s,i){a.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=h[t](e)).value instanceof r?Promise.resolve(s.value.v).then(u,d):c(a[0][2],s)}catch(t){c(a[0][3],t)}var s}function u(t){o("next",t)}function d(t){o("throw",t)}function c(t,e){t(e),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"1.29.0"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class n{constructor(t){this.request=({method:t,path:e,data:s,params:i})=>h(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class o extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class u extends n{constructor(t){super(t),this.update=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{action_taken:e}})})),this.accept=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/accept`})})),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:{order_id:t}})})),this.path="air/airline_initiated_changes"}}class d extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>h(this,void 0,void 0,(function*(){const{return_offers:e}=t,s=i(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:s,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class c extends n{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=i(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,s=i(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>h(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class p extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class f extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.getAvailableServices=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:e})})),this.path="air/orders"}}class l extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class v extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class m extends n{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class q extends n{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class g extends n{constructor(t){super(t),this.get=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,e)=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:e})})),this.path="air/partial_offer_requests"}}class $ extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}let T=class extends Error{constructor({meta:t,errors:e,headers:s}){super(),this.meta=t,this.errors=e,this.headers=s}};class y{constructor({token:i,basePath:r,apiVersion:a,debug:n,source:o}){this.request=({method:i,path:r,data:a,params:n,compress:o=!0})=>h(this,void 0,void 0,(function*(){var h,u;let d,c;const p=new e(r,this.basePath),f={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(n){const t=new s;Object.entries(n).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),p.search=t.toString()}a&&(d=JSON.stringify({data:Object.assign({},a)})),(null===(h=this.debug)||void 0===h?void 0:h.verbose)&&(console.info("Endpoint: ",p.href),console.info("Method: ",i),a&&console.info("Body Parameters: ",a),n&&console.info("Query Parameters: ",n));const l=yield t(p.href,{method:i,headers:f,body:d,compress:o});(null===(u=this.debug)||void 0===u?void 0:u.verbose)&&l.headers.get("x-request-id")&&console.info("Request ID: ",l.headers.get("x-request-id"));const v=l.headers.get("content-type");if(c=v&&v.includes("json")?yield l.json():yield l.text(),!l.ok||"errors"in c&&c.errors)throw new T(Object.assign(Object.assign({},c),{headers:l.headers}));return Object.assign(Object.assign({},c),{headers:l.headers})})),this.token=i,this.basePath=r||"https://api.duffel.com",this.apiVersion=a||"v1",this.debug=n,this.source=o}paginatedRequest({path:t,params:e}){return a(this,arguments,(function*(){let s=yield r(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield r({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield r(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield r({data:t})}}))}}class O extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class b extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class E extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class G extends n{constructor(t){super(t),this.list=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}class w extends n{constructor(t){super(t),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/refunds"}}class _ extends n{constructor(t){super(t),this.create=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="links/sessions"}}class P extends n{constructor(t){super(t),this.redeliver=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/events/${t}/actions/redeliver`})})),this.ping=t=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/ping`})})),this.get=t=>h(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/events/${t}`})})),this.listDeliveries=t=>h(this,void 0,void 0,(function*(){var e=i(t,[]);return this.request({method:"GET",path:`${this.path}/deliveries`,params:Object.assign({},e)})})),this.delete=t=>h(this,void 0,void 0,(function*(){return this.request({method:"DELETE",path:`${this.path}/${t}`})})),this.update=(t,{active:e,events:s,url:i})=>h(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{active:e,events:s,url:i}})})),this.list=t=>h(this,void 0,void 0,(function*(){var e=i(t,[]);return this.request({method:"GET",path:this.path,params:Object.assign({},e)})})),this.create=({events:t,url:e})=>h(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{events:t,url:e}})})),this.path="air/webhooks"}}class x{constructor(t){this.client=new y(t),this.aircraft=new O(this.client),this.airlines=new b(this.client),this.airports=new E(this.client),this.airlineInitiatedChanges=new u(this.client),this.links=new _(this.client),this.offerRequests=new d(this.client),this.offers=new c(this.client),this.orders=new f(this.client),this.orderChangeRequests=new l(this.client),this.orderChangeOffers=new v(this.client),this.orderChanges=new m(this.client),this.orderCancellations=new p(this.client),this.payments=new q(this.client),this.seatMaps=new $(this.client),this.paymentIntents=new o(this.client),this.partialOfferRequests=new g(this.client),this.suggestions=new G(this.client),this.refunds=new w(this.client),this.webhooks=new P(this.client)}}const S=T;export{x as Duffel,S as DuffelError};
2
2
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../node_modules/tslib/tslib.es6.js"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n"],"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","rejected","result","done","then","apply","__await","v","this","__asyncGenerator","Symbol","asyncIterator","TypeError","g","q","verb","n","a","b","push","resume","r","fulfill","settle","f","shift"],"mappings":"yEA0CO,SAASA,EAAOC,EAAGC,GACtB,IAAIC,EAAI,CAAA,EACR,IAAK,IAAIC,KAAKH,EAAOI,OAAOC,UAAUC,eAAeC,KAAKP,EAAGG,IAAMF,EAAEO,QAAQL,GAAK,IAC9ED,EAAEC,GAAKH,EAAEG,IACb,GAAS,MAALH,GAAqD,mBAAjCI,OAAOK,sBACtB,KAAIC,EAAI,EAAb,IAAgBP,EAAIC,OAAOK,sBAAsBT,GAAIU,EAAIP,EAAEQ,OAAQD,IAC3DT,EAAEO,QAAQL,EAAEO,IAAM,GAAKN,OAAOC,UAAUO,qBAAqBL,KAAKP,EAAGG,EAAEO,MACvER,EAAEC,EAAEO,IAAMV,EAAEG,EAAEO,IAF4B,CAItD,OAAOR,CACX,CAiBO,SAASW,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKN,EAAUO,KAAKF,IAAW,MAAOrB,GAAKmB,EAAOnB,GAAO,CAC3F,SAASwB,EAASH,GAAS,IAAMC,EAAKN,EAAiB,MAAEK,IAAW,MAAOrB,GAAKmB,EAAOnB,GAAO,CAC9F,SAASsB,EAAKG,GAJlB,IAAeJ,EAIaI,EAAOC,KAAOR,EAAQO,EAAOJ,QAJ1CA,EAIyDI,EAAOJ,MAJhDA,aAAiBN,EAAIM,EAAQ,IAAIN,GAAE,SAAUG,GAAWA,EAAQG,EAAO,KAIhBM,KAAKP,EAAWI,EAAY,CAC9GF,GAAMN,EAAYA,EAAUY,MAAMf,EAASC,GAAc,KAAKS,OACtE,GACA,CAqGO,SAASM,EAAQC,GACpB,OAAOC,gBAAgBF,GAAWE,KAAKD,EAAIA,EAAGC,MAAQ,IAAIF,EAAQC,EACtE,CAEO,SAASE,EAAiBnB,EAASC,EAAYE,GAClD,IAAKiB,OAAOC,cAAe,MAAM,IAAIC,UAAU,wCAC/C,IAAoD1B,EAAhD2B,EAAIpB,EAAUY,MAAMf,EAASC,GAAc,IAAQuB,EAAI,GAC3D,OAAO5B,EAAI,CAAA,EAAI6B,EAAK,QAASA,EAAK,SAAUA,EAAK,UAAW7B,EAAEwB,OAAOC,eAAiB,WAAc,OAAOH,IAAO,EAAEtB,EACpH,SAAS6B,EAAKC,GAASH,EAAEG,KAAI9B,EAAE8B,GAAK,SAAUT,GAAK,OAAO,IAAIb,SAAQ,SAAUuB,EAAGC,GAAKJ,EAAEK,KAAK,CAACH,EAAGT,EAAGU,EAAGC,IAAM,GAAKE,EAAOJ,EAAGT,EAAG,GAAM,EAAG,CAC1I,SAASa,EAAOJ,EAAGT,GAAK,KACVc,EADqBR,EAAEG,GAAGT,IACnBT,iBAAiBQ,EAAUZ,QAAQC,QAAQ0B,EAAEvB,MAAMS,GAAGH,KAAKkB,EAAS1B,GAAU2B,EAAOT,EAAE,GAAG,GAAIO,GADpE,MAAO5C,GAAK8C,EAAOT,EAAE,GAAG,GAAIrC,GAC3E,IAAc4C,CADoE,CAElF,SAASC,EAAQxB,GAASsB,EAAO,OAAQtB,EAAS,CAClD,SAASF,EAAOE,GAASsB,EAAO,QAAStB,EAAS,CAClD,SAASyB,EAAOC,EAAGjB,GAASiB,EAAEjB,GAAIO,EAAEW,QAASX,EAAE3B,QAAQiC,EAAON,EAAE,GAAG,GAAIA,EAAE,GAAG,GAAM,CACtF"}
1
+ {"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("node-fetch"),e=require("url");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=s(t);function h(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(i=Object.getOwnPropertySymbols(t);h<i.length;h++)e.indexOf(i[h])<0&&Object.prototype.propertyIsEnumerable.call(t,i[h])&&(s[i[h]]=t[i[h]])}return s}function r(t,e,s,i){return new(s||(s=Promise))((function(h,r){function a(t){try{o(i.next(t))}catch(t){r(t)}}function n(t){try{o(i.throw(t))}catch(t){r(t)}}function o(t){var e;t.done?h(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function n(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,h=s.apply(t,e||[]),r=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){h[t]&&(i[t]=function(e){return new Promise((function(s,i){r.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=h[t](e)).value instanceof a?Promise.resolve(s.value.v).then(u,d):c(r[0][2],s)}catch(t){c(r[0][3],t)}var s}function u(t){o("next",t)}function d(t){o("throw",t)}function c(t,e){t(e),r.shift(),r.length&&o(r[0][0],r[0][1])}}!function(){const t={npm_package_version:"1.27.0"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class o{constructor(t){this.request=({method:t,path:e,data:s,params:i})=>r(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:i})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class u extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class d extends o{constructor(t){super(t),this.update=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{action_taken:e}})})),this.accept=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/accept`})})),this.list=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:{order_id:t}})})),this.path="air/airline_initiated_changes"}}class c extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>r(this,void 0,void 0,(function*(){const{return_offers:e}=t,s=h(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:s,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class p extends o{constructor(t){super(t),this.get=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,s=h(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,s=h(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},s),{offer_request_id:e})})},this.update=(t,e,s)=>r(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class f extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class l extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.getAvailableServices=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:e})})),this.path="air/orders"}}class v extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class m extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class q extends o{constructor(t){super(t),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class g extends o{constructor(t){super(t),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class $ extends o{constructor(t){super(t),this.get=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,e)=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:e})})),this.path="air/partial_offer_requests"}}class T extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}class y extends Error{constructor({meta:t,errors:e,headers:s}){super(),this.meta=t,this.errors=e,this.headers=s}}class O{constructor({token:t,basePath:s,apiVersion:h,debug:a,source:n}){this.request=({method:t,path:s,data:h,params:a,compress:n=!0})=>r(this,void 0,void 0,(function*(){var r,o;let u,d;const c=new e.URL(s,this.basePath),p={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(a){const t=new e.URLSearchParams;Object.entries(a).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),c.search=t.toString()}h&&(u=JSON.stringify({data:Object.assign({},h)})),(null===(r=this.debug)||void 0===r?void 0:r.verbose)&&(console.info("Endpoint: ",c.href),console.info("Method: ",t),h&&console.info("Body Parameters: ",h),a&&console.info("Query Parameters: ",a));const f=yield i.default(c.href,{method:t,headers:p,body:u,compress:n});(null===(o=this.debug)||void 0===o?void 0:o.verbose)&&f.headers.get("x-request-id")&&console.info("Request ID: ",f.headers.get("x-request-id"));const l=f.headers.get("content-type");if(d=l&&l.includes("json")?yield f.json():yield f.text(),!f.ok||"errors"in d&&d.errors)throw new y(Object.assign(Object.assign({},d),{headers:f.headers}));return Object.assign(Object.assign({},d),{headers:f.headers})})),this.token=t,this.basePath=s||"https://api.duffel.com",this.apiVersion=h||"v1",this.debug=a,this.source=n}paginatedRequest({path:t,params:e}){return n(this,arguments,(function*(){let s=yield a(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield a({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield a(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield a({data:t})}}))}}class b extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class E extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class G extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class _ extends o{constructor(t){super(t),this.list=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}class w extends o{constructor(t){super(t),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/refunds"}}class P extends o{constructor(t){super(t),this.create=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="links/sessions"}}class x extends o{constructor(t){super(t),this.redeliver=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/events/${t}/actions/redeliver`})})),this.ping=t=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/ping`})})),this.get=t=>r(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/events/${t}`})})),this.listDeliveries=t=>r(this,void 0,void 0,(function*(){var e=h(t,[]);return this.request({method:"GET",path:`${this.path}/deliveries`,params:Object.assign({},e)})})),this.delete=t=>r(this,void 0,void 0,(function*(){return this.request({method:"DELETE",path:`${this.path}/${t}`})})),this.update=(t,{active:e,events:s,url:i})=>r(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{active:e,events:s,url:i}})})),this.list=t=>r(this,void 0,void 0,(function*(){var e=h(t,[]);return this.request({method:"GET",path:this.path,params:Object.assign({},e)})})),this.create=({events:t,url:e})=>r(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{events:t,url:e}})})),this.path="air/webhooks"}}const S=y;exports.Duffel=class{constructor(t){this.client=new O(t),this.aircraft=new b(this.client),this.airlines=new E(this.client),this.airports=new G(this.client),this.airlineInitiatedChanges=new d(this.client),this.links=new P(this.client),this.offerRequests=new c(this.client),this.offers=new p(this.client),this.orders=new l(this.client),this.orderChangeRequests=new v(this.client),this.orderChangeOffers=new m(this.client),this.orderChanges=new q(this.client),this.orderCancellations=new f(this.client),this.payments=new g(this.client),this.seatMaps=new T(this.client),this.paymentIntents=new u(this.client),this.partialOfferRequests=new $(this.client),this.suggestions=new _(this.client),this.refunds=new w(this.client),this.webhooks=new x(this.client)}},exports.DuffelError=S;
1
+ "use strict";var t=require("node-fetch"),e=require("url");function s(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(i=Object.getOwnPropertySymbols(t);h<i.length;h++)e.indexOf(i[h])<0&&Object.prototype.propertyIsEnumerable.call(t,i[h])&&(s[i[h]]=t[i[h]])}return s}function i(t,e,s,i){return new(s||(s=Promise))((function(h,r){function a(t){try{o(i.next(t))}catch(t){r(t)}}function n(t){try{o(i.throw(t))}catch(t){r(t)}}function o(t){var e;t.done?h(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,n)}o((i=i.apply(t,e||[])).next())}))}function h(t){return this instanceof h?(this.v=t,this):new h(t)}function r(t,e,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=s.apply(t,e||[]),a=[];return i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i;function n(t){r[t]&&(i[t]=function(e){return new Promise((function(s,i){a.push([t,e,s,i])>1||o(t,e)}))})}function o(t,e){try{(s=r[t](e)).value instanceof h?Promise.resolve(s.value.v).then(u,d):c(a[0][2],s)}catch(t){c(a[0][3],t)}var s}function u(t){o("next",t)}function d(t){o("throw",t)}function c(t,e){t(e),a.shift(),a.length&&o(a[0][0],a[0][1])}}!function(){const t={npm_package_version:"1.29.0"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();class a{constructor(t){this.request=({method:t,path:e,data:s,params:h})=>i(this,void 0,void 0,(function*(){return this.client.request({method:t,path:e,data:s,params:h})})),this.paginatedRequest=({path:t,params:e})=>this.client.paginatedRequest({path:t,params:e}),this.client=t}}class n extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/payment_intents"}}class o extends a{constructor(t){super(t),this.update=(t,e)=>i(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{action_taken:e}})})),this.accept=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/accept`})})),this.list=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:{order_id:t}})})),this.path="air/airline_initiated_changes"}}class u extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.create=t=>i(this,void 0,void 0,(function*(){const{return_offers:e}=t,i=s(t,["return_offers"]);return this.request({method:"POST",path:`${this.path}/`,data:i,params:Object.assign({},null!=e&&{return_offers:e})})})),this.path="air/offer_requests"}}class d extends a{constructor(t){super(t),this.get=(t,e)=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.list=t=>{var{offer_request_id:e}=t,i=s(t,["offer_request_id"]);return this.request({method:"GET",path:this.path,params:Object.assign(Object.assign({},i),{offer_request_id:e})})},this.listWithGenerator=t=>{var{offer_request_id:e}=t,i=s(t,["offer_request_id"]);return this.paginatedRequest({path:this.path,params:Object.assign(Object.assign({},i),{offer_request_id:e})})},this.update=(t,e,s)=>i(this,void 0,void 0,(function*(){return this.request(Object.assign({method:"PATCH",path:`${this.path}/${t}/passengers/${e}`},s&&{data:s}))})),this.path="air/offers"}}class c extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=t=>this.paginatedRequest({path:this.path,params:t}),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.confirm=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`})})),this.path="air/order_cancellations"}}class p extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:this.path,params:t})})),this.listWithGenerator=t=>this.paginatedRequest({path:"air/orders",params:t}),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.update=(t,e)=>i(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{options:e}})})),this.getAvailableServices=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/available_services`})})),this.addServices=(t,e)=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/services`,data:e})})),this.path="air/orders"}}class f extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/order_change_requests"}}class l extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/order_change_offers"}}class v extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.confirm=(t,e)=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/confirm`,data:e})})),this.path="air/order_changes"}}class m extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="air/payments"}}class q extends a{constructor(t){super(t),this.get=(t,e)=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`,params:e})})),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/`,data:t})})),this.getFaresById=(t,e)=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}/fares`,params:e})})),this.path="air/partial_offer_requests"}}class g extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="air/seat_maps"}}let $=class extends Error{constructor({meta:t,errors:e,headers:s}){super(),this.meta=t,this.errors=e,this.headers=s}};class T{constructor({token:s,basePath:h,apiVersion:r,debug:a,source:n}){this.request=({method:s,path:h,data:r,params:a,compress:n=!0})=>i(this,void 0,void 0,(function*(){var i,o;let u,d;const c=new e.URL(h,this.basePath),p={"User-Agent":[`Duffel/${this.apiVersion}`,`duffel_api_javascript/${process.env.npm_package_version}`,this.source?`source/${this.source}`:""].join(" ").trim(),Accept:"application/json","Accept-Encoding":"gzip","Content-Type":"application/json","Duffel-Version":this.apiVersion,Authorization:`Bearer ${this.token}`};if(a){const t=new e.URLSearchParams;Object.entries(a).sort().filter((t=>null!==t[0])).forEach((([e,s])=>{Array.isArray(s)?s.forEach((s=>t.append(e,s.toString()))):t.append(e,s.toString())})),c.search=t.toString()}r&&(u=JSON.stringify({data:Object.assign({},r)})),(null===(i=this.debug)||void 0===i?void 0:i.verbose)&&(console.info("Endpoint: ",c.href),console.info("Method: ",s),r&&console.info("Body Parameters: ",r),a&&console.info("Query Parameters: ",a));const f=yield t(c.href,{method:s,headers:p,body:u,compress:n});(null===(o=this.debug)||void 0===o?void 0:o.verbose)&&f.headers.get("x-request-id")&&console.info("Request ID: ",f.headers.get("x-request-id"));const l=f.headers.get("content-type");if(d=l&&l.includes("json")?yield f.json():yield f.text(),!f.ok||"errors"in d&&d.errors)throw new $(Object.assign(Object.assign({},d),{headers:f.headers}));return Object.assign(Object.assign({},d),{headers:f.headers})})),this.token=s,this.basePath=h||"https://api.duffel.com",this.apiVersion=r||"v1",this.debug=a,this.source=n}paginatedRequest({path:t,params:e}){return r(this,arguments,(function*(){let s=yield h(this.request({method:"GET",path:t,params:e}));for(const t of s.data)yield yield h({data:t});for(;s.meta&&"after"in s.meta&&s.meta.after;){s=yield h(this.request({method:"GET",path:t,params:{limit:s.meta.limit,after:s.meta.after}}));for(const t of s.data)yield yield h({data:t})}}))}}class y extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/aircraft"}}class O extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airlines"}}class E extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.list=t=>this.request({method:"GET",path:this.path,params:t}),this.listWithGenerator=()=>this.paginatedRequest({path:this.path}),this.path="air/airports"}}class b extends a{constructor(t){super(t),this.list=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}`,params:t})})),this.path="places/suggestions"}}class G extends a{constructor(t){super(t),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/${t}`})})),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="payments/refunds"}}class w extends a{constructor(t){super(t),this.create=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:t})})),this.path="links/sessions"}}class _ extends a{constructor(t){super(t),this.redeliver=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/events/${t}/actions/redeliver`})})),this.ping=t=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:`${this.path}/${t}/actions/ping`})})),this.get=t=>i(this,void 0,void 0,(function*(){return this.request({method:"GET",path:`${this.path}/events/${t}`})})),this.listDeliveries=t=>i(this,void 0,void 0,(function*(){var e=s(t,[]);return this.request({method:"GET",path:`${this.path}/deliveries`,params:Object.assign({},e)})})),this.delete=t=>i(this,void 0,void 0,(function*(){return this.request({method:"DELETE",path:`${this.path}/${t}`})})),this.update=(t,{active:e,events:s,url:h})=>i(this,void 0,void 0,(function*(){return this.request({method:"PATCH",path:`${this.path}/${t}`,data:{active:e,events:s,url:h}})})),this.list=t=>i(this,void 0,void 0,(function*(){var e=s(t,[]);return this.request({method:"GET",path:this.path,params:Object.assign({},e)})})),this.create=({events:t,url:e})=>i(this,void 0,void 0,(function*(){return this.request({method:"POST",path:this.path,data:{events:t,url:e}})})),this.path="air/webhooks"}}const P=$;exports.Duffel=class{constructor(t){this.client=new T(t),this.aircraft=new y(this.client),this.airlines=new O(this.client),this.airports=new E(this.client),this.airlineInitiatedChanges=new o(this.client),this.links=new w(this.client),this.offerRequests=new u(this.client),this.offers=new d(this.client),this.orders=new p(this.client),this.orderChangeRequests=new f(this.client),this.orderChangeOffers=new l(this.client),this.orderChanges=new v(this.client),this.orderCancellations=new c(this.client),this.payments=new m(this.client),this.seatMaps=new g(this.client),this.paymentIntents=new n(this.client),this.partialOfferRequests=new q(this.client),this.suggestions=new b(this.client),this.refunds=new G(this.client),this.webhooks=new _(this.client)}},exports.DuffelError=P;
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../node_modules/tslib/tslib.es6.js"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n"],"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","rejected","result","done","then","apply","__await","v","this","__asyncGenerator","Symbol","asyncIterator","TypeError","g","q","verb","n","a","b","push","resume","r","fulfill","settle","f","shift"],"mappings":"oMA0CO,SAASA,EAAOC,EAAGC,GACtB,IAAIC,EAAI,CAAA,EACR,IAAK,IAAIC,KAAKH,EAAOI,OAAOC,UAAUC,eAAeC,KAAKP,EAAGG,IAAMF,EAAEO,QAAQL,GAAK,IAC9ED,EAAEC,GAAKH,EAAEG,IACb,GAAS,MAALH,GAAqD,mBAAjCI,OAAOK,sBACtB,KAAIC,EAAI,EAAb,IAAgBP,EAAIC,OAAOK,sBAAsBT,GAAIU,EAAIP,EAAEQ,OAAQD,IAC3DT,EAAEO,QAAQL,EAAEO,IAAM,GAAKN,OAAOC,UAAUO,qBAAqBL,KAAKP,EAAGG,EAAEO,MACvER,EAAEC,EAAEO,IAAMV,EAAEG,EAAEO,IAF4B,CAItD,OAAOR,CACX,CAiBO,SAASW,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKN,EAAUO,KAAKF,IAAW,MAAOrB,GAAKmB,EAAOnB,GAAO,CAC3F,SAASwB,EAASH,GAAS,IAAMC,EAAKN,EAAiB,MAAEK,IAAW,MAAOrB,GAAKmB,EAAOnB,GAAO,CAC9F,SAASsB,EAAKG,GAJlB,IAAeJ,EAIaI,EAAOC,KAAOR,EAAQO,EAAOJ,QAJ1CA,EAIyDI,EAAOJ,MAJhDA,aAAiBN,EAAIM,EAAQ,IAAIN,GAAE,SAAUG,GAAWA,EAAQG,EAAO,KAIhBM,KAAKP,EAAWI,EAAY,CAC9GF,GAAMN,EAAYA,EAAUY,MAAMf,EAASC,GAAc,KAAKS,OACtE,GACA,CAqGO,SAASM,EAAQC,GACpB,OAAOC,gBAAgBF,GAAWE,KAAKD,EAAIA,EAAGC,MAAQ,IAAIF,EAAQC,EACtE,CAEO,SAASE,EAAiBnB,EAASC,EAAYE,GAClD,IAAKiB,OAAOC,cAAe,MAAM,IAAIC,UAAU,wCAC/C,IAAoD1B,EAAhD2B,EAAIpB,EAAUY,MAAMf,EAASC,GAAc,IAAQuB,EAAI,GAC3D,OAAO5B,EAAI,CAAA,EAAI6B,EAAK,QAASA,EAAK,SAAUA,EAAK,UAAW7B,EAAEwB,OAAOC,eAAiB,WAAc,OAAOH,IAAO,EAAEtB,EACpH,SAAS6B,EAAKC,GAASH,EAAEG,KAAI9B,EAAE8B,GAAK,SAAUT,GAAK,OAAO,IAAIb,SAAQ,SAAUuB,EAAGC,GAAKJ,EAAEK,KAAK,CAACH,EAAGT,EAAGU,EAAGC,IAAM,GAAKE,EAAOJ,EAAGT,EAAG,GAAM,EAAG,CAC1I,SAASa,EAAOJ,EAAGT,GAAK,KACVc,EADqBR,EAAEG,GAAGT,IACnBT,iBAAiBQ,EAAUZ,QAAQC,QAAQ0B,EAAEvB,MAAMS,GAAGH,KAAKkB,EAAS1B,GAAU2B,EAAOT,EAAE,GAAG,GAAIO,GADpE,MAAO5C,GAAK8C,EAAOT,EAAE,GAAG,GAAIrC,GAC3E,IAAc4C,CADoE,CAElF,SAASC,EAAQxB,GAASsB,EAAO,OAAQtB,EAAS,CAClD,SAASF,EAAOE,GAASsB,EAAO,QAAStB,EAAS,CAClD,SAASyB,EAAOC,EAAGjB,GAASiB,EAAEjB,GAAIO,EAAEW,QAASX,EAAE3B,QAAQiC,EAAON,EAAE,GAAG,GAAIA,EAAE,GAAG,GAAM,CACtF"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}