@commercelayer/sdk 5.33.0 → 5.34.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.
Files changed (47) hide show
  1. package/lib/cjs/commercelayer.d.ts +2 -2
  2. package/lib/cjs/commercelayer.js +1 -1
  3. package/lib/cjs/resources/adjustments.d.ts +3 -0
  4. package/lib/cjs/resources/external_gateways.d.ts +5 -1
  5. package/lib/cjs/resources/external_gateways.js +3 -0
  6. package/lib/cjs/resources/external_promotions.d.ts +4 -0
  7. package/lib/cjs/resources/external_promotions.js +3 -0
  8. package/lib/cjs/resources/external_tax_calculators.d.ts +4 -0
  9. package/lib/cjs/resources/external_tax_calculators.js +3 -0
  10. package/lib/cjs/resources/line_items.d.ts +12 -4
  11. package/lib/cjs/resources/line_items.js +3 -0
  12. package/lib/cjs/resources/markets.d.ts +1 -1
  13. package/lib/cjs/resources/order_subscriptions.d.ts +0 -4
  14. package/lib/cjs/resources/orders.d.ts +4 -0
  15. package/lib/cjs/resources/orders.js +3 -0
  16. package/lib/cjs/resources/parcel_line_items.d.ts +0 -8
  17. package/lib/cjs/resources/payment_methods.d.ts +5 -5
  18. package/lib/cjs/resources/shipments.d.ts +0 -4
  19. package/lib/cjs/resources/shipping_methods.d.ts +9 -5
  20. package/lib/cjs/resources/shipping_methods.js +3 -0
  21. package/lib/cjs/resources/webhooks.d.ts +3 -3
  22. package/lib/cjs/resources/webhooks.js +3 -3
  23. package/lib/esm/commercelayer.d.ts +2 -2
  24. package/lib/esm/commercelayer.js +1 -1
  25. package/lib/esm/resources/adjustments.d.ts +3 -0
  26. package/lib/esm/resources/external_gateways.d.ts +5 -1
  27. package/lib/esm/resources/external_gateways.js +3 -0
  28. package/lib/esm/resources/external_promotions.d.ts +4 -0
  29. package/lib/esm/resources/external_promotions.js +3 -0
  30. package/lib/esm/resources/external_tax_calculators.d.ts +4 -0
  31. package/lib/esm/resources/external_tax_calculators.js +3 -0
  32. package/lib/esm/resources/line_items.d.ts +12 -4
  33. package/lib/esm/resources/line_items.js +3 -0
  34. package/lib/esm/resources/markets.d.ts +1 -1
  35. package/lib/esm/resources/order_subscriptions.d.ts +0 -4
  36. package/lib/esm/resources/orders.d.ts +4 -0
  37. package/lib/esm/resources/orders.js +3 -0
  38. package/lib/esm/resources/parcel_line_items.d.ts +0 -8
  39. package/lib/esm/resources/payment_methods.d.ts +5 -5
  40. package/lib/esm/resources/shipments.d.ts +0 -4
  41. package/lib/esm/resources/shipping_methods.d.ts +9 -5
  42. package/lib/esm/resources/shipping_methods.js +3 -0
  43. package/lib/esm/resources/webhooks.d.ts +3 -3
  44. package/lib/esm/resources/webhooks.js +3 -3
  45. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  46. package/lib/tsconfig.tsbuildinfo +1 -1
  47. package/package.json +4 -4
@@ -21,6 +21,9 @@ class ExternalTaxCalculators extends ApiResource {
21
21
  const _externalTaxCalculatorId = externalTaxCalculatorId.id || externalTaxCalculatorId;
22
22
  return this.resources.fetch({ type: 'versions' }, `external_tax_calculators/${_externalTaxCalculatorId}/versions`, params, options);
23
23
  }
24
+ async _reset_circuit(id, params, options) {
25
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalTaxCalculators.TYPE, _reset_circuit: true }, params, options);
26
+ }
24
27
  isExternalTaxCalculator(resource) {
25
28
  return resource.type && (resource.type === ExternalTaxCalculators.TYPE);
26
29
  }
@@ -92,16 +92,18 @@ interface LineItem extends Resource {
92
92
  item_type?: 'skus' | 'bundles' | 'shipments' | 'payment_methods' | 'adjustments' | 'gift_cards' | 'percentage_discount_promotions' | 'free_shipping_promotions' | 'free_gift_promotions' | 'fixed_price_promotions' | 'external_promotions' | 'fixed_amount_promotions' | null;
93
93
  frequency?: string | null;
94
94
  coupon_code?: string | null;
95
+ circuit_state?: string | null;
96
+ circuit_failure_count?: number | null;
95
97
  order?: Order | null;
96
98
  item?: Adjustment | Bundle | ExternalPromotion | FixedAmountPromotion | FreeShippingPromotion | GiftCard | PaymentMethod | PercentageDiscountPromotion | Shipment | Sku | null;
97
99
  sku?: Sku | null;
98
100
  bundle?: Bundle | null;
101
+ adjustment?: Adjustment | null;
102
+ gift_card?: GiftCard | null;
103
+ shipment?: Shipment | null;
104
+ payment_method?: PaymentMethod | null;
99
105
  line_item_options?: LineItemOption[] | null;
100
106
  return_line_items?: ReturnLineItem[] | null;
101
- /**
102
- * @deprecated This field should not be used as it may be removed in the future without notice
103
- */
104
- shipment_line_items?: object[];
105
107
  stock_reservations?: StockReservation[] | null;
106
108
  stock_line_items?: StockLineItem[] | null;
107
109
  stock_transfers?: StockTransfer[] | null;
@@ -125,6 +127,10 @@ interface LineItemCreate extends ResourceCreate {
125
127
  item?: AdjustmentRel | BundleRel | ExternalPromotionRel | FixedAmountPromotionRel | FreeShippingPromotionRel | GiftCardRel | PaymentMethodRel | PercentageDiscountPromotionRel | ShipmentRel | SkuRel | null;
126
128
  sku?: SkuRel | null;
127
129
  bundle?: BundleRel | null;
130
+ adjustment?: AdjustmentRel | null;
131
+ gift_card?: GiftCardRel | null;
132
+ shipment?: ShipmentRel | null;
133
+ payment_method?: PaymentMethodRel | null;
128
134
  tags?: TagRel[] | null;
129
135
  }
130
136
  interface LineItemUpdate extends ResourceUpdate {
@@ -137,6 +143,7 @@ interface LineItemUpdate extends ResourceUpdate {
137
143
  name?: string | null;
138
144
  image_url?: string | null;
139
145
  frequency?: string | null;
146
+ _reset_circuit?: boolean | null;
140
147
  tags?: TagRel[] | null;
141
148
  }
142
149
  declare class LineItems extends ApiResource<LineItem> {
@@ -154,6 +161,7 @@ declare class LineItems extends ApiResource<LineItem> {
154
161
  tags(lineItemId: string | LineItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
155
162
  _external_price(id: string | LineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
156
163
  _reserve_stock(id: string | LineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
164
+ _reset_circuit(id: string | LineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
157
165
  isLineItem(resource: any): resource is LineItem;
158
166
  relationship(id: string | ResourceId | null): LineItemRel;
159
167
  type(): LineItemType;
@@ -47,6 +47,9 @@ class LineItems extends ApiResource {
47
47
  async _reserve_stock(id, params, options) {
48
48
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: LineItems.TYPE, _reserve_stock: true }, params, options);
49
49
  }
50
+ async _reset_circuit(id, params, options) {
51
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: LineItems.TYPE, _reset_circuit: true }, params, options);
52
+ }
50
53
  isLineItem(resource) {
51
54
  return resource.type && (resource.type === LineItems.TYPE);
52
55
  }
@@ -40,9 +40,9 @@ interface Market extends Resource {
40
40
  checkout_url?: string | null;
41
41
  external_prices_url?: string | null;
42
42
  external_order_validation_url?: string | null;
43
- shared_secret: string;
44
43
  private?: boolean | null;
45
44
  disabled_at?: string | null;
45
+ shared_secret: string;
46
46
  merchant?: Merchant | null;
47
47
  price_list?: PriceList | null;
48
48
  inventory_model?: InventoryModel | null;
@@ -46,10 +46,6 @@ interface OrderSubscription extends Resource {
46
46
  customer_payment_source?: CustomerPaymentSource | null;
47
47
  order_subscription_items?: OrderSubscriptionItem[] | null;
48
48
  order_factories?: OrderFactory[] | null;
49
- /**
50
- * @deprecated This field should not be used as it may be removed in the future without notice
51
- */
52
- order_copies?: object[];
53
49
  recurring_order_copies?: RecurringOrderCopy[] | null;
54
50
  orders?: Order[] | null;
55
51
  events?: Event[] | null;
@@ -197,6 +197,8 @@ interface Order extends Resource {
197
197
  archived_at?: string | null;
198
198
  expires_at?: string | null;
199
199
  subscription_created_at?: string | null;
200
+ circuit_state?: string | null;
201
+ circuit_failure_count?: number | null;
200
202
  market?: Market | null;
201
203
  customer?: Customer | null;
202
204
  shipping_address?: Address | null;
@@ -305,6 +307,7 @@ interface OrderUpdate extends ResourceUpdate {
305
307
  _create_subscriptions?: boolean | null;
306
308
  _start_editing?: boolean | null;
307
309
  _stop_editing?: boolean | null;
310
+ _reset_circuit?: boolean | null;
308
311
  market?: MarketRel | null;
309
312
  customer?: CustomerRel | null;
310
313
  shipping_address?: AddressRel | null;
@@ -377,6 +380,7 @@ declare class Orders extends ApiResource<Order> {
377
380
  _create_subscriptions(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
378
381
  _start_editing(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
379
382
  _stop_editing(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
383
+ _reset_circuit(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
380
384
  isOrder(resource: any): resource is Order;
381
385
  relationship(id: string | ResourceId | null): OrderRel;
382
386
  type(): OrderType;
@@ -217,6 +217,9 @@ class Orders extends ApiResource {
217
217
  async _stop_editing(id, params, options) {
218
218
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _stop_editing: true }, params, options);
219
219
  }
220
+ async _reset_circuit(id, params, options) {
221
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _reset_circuit: true }, params, options);
222
+ }
220
223
  isOrder(resource) {
221
224
  return resource.type && (resource.type === Orders.TYPE);
222
225
  }
@@ -23,20 +23,12 @@ interface ParcelLineItem extends Resource {
23
23
  image_url?: string | null;
24
24
  parcel?: Parcel | null;
25
25
  stock_line_item?: StockLineItem | null;
26
- /**
27
- * @deprecated This field should not be used as it may be removed in the future without notice
28
- */
29
- shipment_line_item?: object;
30
26
  versions?: Version[] | null;
31
27
  }
32
28
  interface ParcelLineItemCreate extends ResourceCreate {
33
29
  quantity: number;
34
30
  parcel: ParcelRel;
35
31
  stock_line_item: StockLineItemRel;
36
- /**
37
- * @deprecated This field should not be used as it may be removed in the future without notice
38
- */
39
- shipment_line_item?: object;
40
32
  }
41
33
  type ParcelLineItemUpdate = ResourceUpdate;
42
34
  declare class ParcelLineItems extends ApiResource<ParcelLineItem> {
@@ -24,13 +24,13 @@ interface PaymentMethod extends Resource {
24
24
  require_capture?: boolean | null;
25
25
  auto_place?: boolean | null;
26
26
  auto_capture?: boolean | null;
27
- disabled_at?: string | null;
28
27
  price_amount_cents: number;
29
28
  price_amount_float?: number | null;
30
29
  formatted_price_amount?: string | null;
31
30
  auto_capture_max_amount_cents?: number | null;
32
31
  auto_capture_max_amount_float?: number | null;
33
32
  formatted_auto_capture_max_amount?: string | null;
33
+ disabled_at?: string | null;
34
34
  market?: Market | null;
35
35
  payment_gateway?: PaymentGateway | null;
36
36
  attachments?: Attachment[] | null;
@@ -43,10 +43,10 @@ interface PaymentMethodCreate extends ResourceCreate {
43
43
  require_capture?: boolean | null;
44
44
  auto_place?: boolean | null;
45
45
  auto_capture?: boolean | null;
46
- _disable?: boolean | null;
47
- _enable?: boolean | null;
48
46
  price_amount_cents: number;
49
47
  auto_capture_max_amount_cents?: number | null;
48
+ _disable?: boolean | null;
49
+ _enable?: boolean | null;
50
50
  market?: MarketRel | null;
51
51
  payment_gateway: PaymentGatewayRel;
52
52
  }
@@ -57,10 +57,10 @@ interface PaymentMethodUpdate extends ResourceUpdate {
57
57
  require_capture?: boolean | null;
58
58
  auto_place?: boolean | null;
59
59
  auto_capture?: boolean | null;
60
- _disable?: boolean | null;
61
- _enable?: boolean | null;
62
60
  price_amount_cents?: number | null;
63
61
  auto_capture_max_amount_cents?: number | null;
62
+ _disable?: boolean | null;
63
+ _enable?: boolean | null;
64
64
  market?: MarketRel | null;
65
65
  payment_gateway?: PaymentGatewayRel | null;
66
66
  }
@@ -70,10 +70,6 @@ interface Shipment extends Resource {
70
70
  shipping_address?: Address | null;
71
71
  shipping_method?: ShippingMethod | null;
72
72
  delivery_lead_time?: DeliveryLeadTime | null;
73
- /**
74
- * @deprecated This field should not be used as it may be removed in the future without notice
75
- */
76
- shipment_line_items?: object[];
77
73
  stock_line_items?: StockLineItem[] | null;
78
74
  stock_transfers?: StockTransfer[] | null;
79
75
  available_shipping_methods?: ShippingMethod[] | null;
@@ -35,7 +35,6 @@ interface ShippingMethod extends Resource {
35
35
  scheme?: string | null;
36
36
  currency_code?: string | null;
37
37
  external_prices_url?: string | null;
38
- disabled_at?: string | null;
39
38
  price_amount_cents: number;
40
39
  price_amount_float?: number | null;
41
40
  formatted_price_amount?: string | null;
@@ -49,6 +48,9 @@ interface ShippingMethod extends Resource {
49
48
  min_weight?: number | null;
50
49
  max_weight?: number | null;
51
50
  unit_of_weight?: string | null;
51
+ disabled_at?: string | null;
52
+ circuit_state?: string | null;
53
+ circuit_failure_count?: number | null;
52
54
  market?: Market | null;
53
55
  shipping_zone?: ShippingZone | null;
54
56
  shipping_category?: ShippingCategory | null;
@@ -64,14 +66,14 @@ interface ShippingMethodCreate extends ResourceCreate {
64
66
  scheme?: string | null;
65
67
  currency_code?: string | null;
66
68
  external_prices_url?: string | null;
67
- _disable?: boolean | null;
68
- _enable?: boolean | null;
69
69
  price_amount_cents: number;
70
70
  free_over_amount_cents?: number | null;
71
71
  use_subtotal?: boolean | null;
72
72
  min_weight?: number | null;
73
73
  max_weight?: number | null;
74
74
  unit_of_weight?: string | null;
75
+ _disable?: boolean | null;
76
+ _enable?: boolean | null;
75
77
  market?: MarketRel | null;
76
78
  shipping_zone?: ShippingZoneRel | null;
77
79
  shipping_category?: ShippingCategoryRel | null;
@@ -83,14 +85,15 @@ interface ShippingMethodUpdate extends ResourceUpdate {
83
85
  scheme?: string | null;
84
86
  currency_code?: string | null;
85
87
  external_prices_url?: string | null;
86
- _disable?: boolean | null;
87
- _enable?: boolean | null;
88
88
  price_amount_cents?: number | null;
89
89
  free_over_amount_cents?: number | null;
90
90
  use_subtotal?: boolean | null;
91
91
  min_weight?: number | null;
92
92
  max_weight?: number | null;
93
93
  unit_of_weight?: string | null;
94
+ _disable?: boolean | null;
95
+ _enable?: boolean | null;
96
+ _reset_circuit?: boolean | null;
94
97
  market?: MarketRel | null;
95
98
  shipping_zone?: ShippingZoneRel | null;
96
99
  shipping_category?: ShippingCategoryRel | null;
@@ -113,6 +116,7 @@ declare class ShippingMethods extends ApiResource<ShippingMethod> {
113
116
  versions(shippingMethodId: string | ShippingMethod, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
114
117
  _disable(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
115
118
  _enable(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
119
+ _reset_circuit(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
116
120
  isShippingMethod(resource: any): resource is ShippingMethod;
117
121
  relationship(id: string | ResourceId | null): ShippingMethodRel;
118
122
  type(): ShippingMethodType;
@@ -51,6 +51,9 @@ class ShippingMethods extends ApiResource {
51
51
  async _enable(id, params, options) {
52
52
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ShippingMethods.TYPE, _enable: true }, params, options);
53
53
  }
54
+ async _reset_circuit(id, params, options) {
55
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ShippingMethods.TYPE, _reset_circuit: true }, params, options);
56
+ }
54
57
  isShippingMethod(resource) {
55
58
  return resource.type && (resource.type === ShippingMethods.TYPE);
56
59
  }
@@ -13,10 +13,10 @@ interface Webhook extends Resource {
13
13
  topic: string;
14
14
  callback_url: string;
15
15
  include_resources?: string[] | null;
16
+ disabled_at?: string | null;
16
17
  circuit_state?: string | null;
17
18
  circuit_failure_count?: number | null;
18
19
  shared_secret: string;
19
- disabled_at?: string | null;
20
20
  last_event_callbacks?: EventCallback[] | null;
21
21
  versions?: Version[] | null;
22
22
  }
@@ -33,9 +33,9 @@ interface WebhookUpdate extends ResourceUpdate {
33
33
  topic?: string | null;
34
34
  callback_url?: string | null;
35
35
  include_resources?: string[] | null;
36
- _reset_circuit?: boolean | null;
37
36
  _disable?: boolean | null;
38
37
  _enable?: boolean | null;
38
+ _reset_circuit?: boolean | null;
39
39
  }
40
40
  declare class Webhooks extends ApiResource<Webhook> {
41
41
  static readonly TYPE: WebhookType;
@@ -44,9 +44,9 @@ declare class Webhooks extends ApiResource<Webhook> {
44
44
  delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
45
45
  last_event_callbacks(webhookId: string | Webhook, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<EventCallback>>;
46
46
  versions(webhookId: string | Webhook, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
47
- _reset_circuit(id: string | Webhook, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
48
47
  _disable(id: string | Webhook, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
49
48
  _enable(id: string | Webhook, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
49
+ _reset_circuit(id: string | Webhook, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
50
50
  isWebhook(resource: any): resource is Webhook;
51
51
  relationship(id: string | ResourceId | null): WebhookRel;
52
52
  type(): WebhookType;
@@ -17,15 +17,15 @@ class Webhooks extends ApiResource {
17
17
  const _webhookId = webhookId.id || webhookId;
18
18
  return this.resources.fetch({ type: 'versions' }, `webhooks/${_webhookId}/versions`, params, options);
19
19
  }
20
- async _reset_circuit(id, params, options) {
21
- return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _reset_circuit: true }, params, options);
22
- }
23
20
  async _disable(id, params, options) {
24
21
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _disable: true }, params, options);
25
22
  }
26
23
  async _enable(id, params, options) {
27
24
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _enable: true }, params, options);
28
25
  }
26
+ async _reset_circuit(id, params, options) {
27
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _reset_circuit: true }, params, options);
28
+ }
29
29
  isWebhook(resource) {
30
30
  return resource.type && (resource.type === Webhooks.TYPE);
31
31
  }