@commercelayer/sdk 5.19.2 → 5.20.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 (49) hide show
  1. package/lib/cjs/api.d.ts +1 -1
  2. package/lib/cjs/commercelayer.d.ts +2 -2
  3. package/lib/cjs/commercelayer.js +1 -1
  4. package/lib/cjs/resource.js +1 -1
  5. package/lib/cjs/resources/authorizations.d.ts +3 -3
  6. package/lib/cjs/resources/authorizations.js +4 -4
  7. package/lib/cjs/resources/axerve_payments.d.ts +2 -0
  8. package/lib/cjs/resources/captures.d.ts +3 -3
  9. package/lib/cjs/resources/captures.js +4 -4
  10. package/lib/cjs/resources/customer_payment_sources.d.ts +13 -1
  11. package/lib/cjs/resources/customer_payment_sources.js +4 -0
  12. package/lib/cjs/resources/imports.d.ts +0 -2
  13. package/lib/cjs/resources/line_items.d.ts +5 -0
  14. package/lib/cjs/resources/refunds.d.ts +3 -3
  15. package/lib/cjs/resources/refunds.js +4 -4
  16. package/lib/cjs/resources/shipments.d.ts +11 -1
  17. package/lib/cjs/resources/shipments.js +7 -0
  18. package/lib/cjs/resources/stock_line_items.d.ts +1 -0
  19. package/lib/cjs/resources/stock_transfers.d.ts +1 -0
  20. package/lib/cjs/resources/transactions.d.ts +3 -0
  21. package/lib/cjs/resources/transactions.js +4 -0
  22. package/lib/cjs/resources/voids.d.ts +3 -3
  23. package/lib/cjs/resources/voids.js +4 -4
  24. package/lib/esm/api.d.ts +1 -1
  25. package/lib/esm/commercelayer.d.ts +2 -2
  26. package/lib/esm/commercelayer.js +1 -1
  27. package/lib/esm/resource.js +1 -1
  28. package/lib/esm/resources/authorizations.d.ts +3 -3
  29. package/lib/esm/resources/authorizations.js +4 -4
  30. package/lib/esm/resources/axerve_payments.d.ts +2 -0
  31. package/lib/esm/resources/captures.d.ts +3 -3
  32. package/lib/esm/resources/captures.js +4 -4
  33. package/lib/esm/resources/customer_payment_sources.d.ts +13 -1
  34. package/lib/esm/resources/customer_payment_sources.js +4 -0
  35. package/lib/esm/resources/imports.d.ts +0 -2
  36. package/lib/esm/resources/line_items.d.ts +5 -0
  37. package/lib/esm/resources/refunds.d.ts +3 -3
  38. package/lib/esm/resources/refunds.js +4 -4
  39. package/lib/esm/resources/shipments.d.ts +11 -1
  40. package/lib/esm/resources/shipments.js +7 -0
  41. package/lib/esm/resources/stock_line_items.d.ts +1 -0
  42. package/lib/esm/resources/stock_transfers.d.ts +1 -0
  43. package/lib/esm/resources/transactions.d.ts +3 -0
  44. package/lib/esm/resources/transactions.js +4 -0
  45. package/lib/esm/resources/voids.d.ts +3 -3
  46. package/lib/esm/resources/voids.js +4 -4
  47. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  48. package/lib/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +9 -9
package/lib/cjs/api.d.ts CHANGED
@@ -146,7 +146,7 @@ export type DeletableResourceType = 'addresses' | 'adjustments' | 'adyen_gateway
146
146
  export type DeletableResource = Resource & {
147
147
  type: DeletableResourceType;
148
148
  };
149
- export type TaggableResourceType = 'addresses' | 'bundles' | 'buy_x_pay_y_promotions' | 'coupons' | 'customers' | 'external_promotions' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_cards' | 'line_item_options' | 'line_items' | 'orders' | 'percentage_discount_promotions' | 'promotions' | 'returns' | 'sku_options' | 'skus';
149
+ export type TaggableResourceType = 'addresses' | 'bundles' | 'buy_x_pay_y_promotions' | 'coupons' | 'customers' | 'external_promotions' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_cards' | 'line_item_options' | 'line_items' | 'orders' | 'percentage_discount_promotions' | 'promotions' | 'returns' | 'shipments' | 'sku_options' | 'skus';
150
150
  export type TaggableResource = Resource & {
151
151
  type: TaggableResourceType;
152
152
  tags?: Array<ResourceRel & {
@@ -2,14 +2,14 @@ import * as api from './api';
2
2
  import type { ApiError } from './error';
3
3
  import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
4
4
  import { type ResourcesInitConfig } from './resource';
5
- declare const OPEN_API_SCHEMA_VERSION = "4.16.0";
5
+ declare const OPEN_API_SCHEMA_VERSION = "4.18.0";
6
6
  export { OPEN_API_SCHEMA_VERSION };
7
7
  type SdkConfig = {};
8
8
  type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
9
9
  type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
10
10
  declare class CommerceLayerClient {
11
11
  #private;
12
- readonly openApiSchemaVersion = "4.16.0";
12
+ readonly openApiSchemaVersion = "4.18.0";
13
13
  addresses: api.Addresses;
14
14
  adjustments: api.Adjustments;
15
15
  adyen_gateways: api.AdyenGateways;
@@ -45,7 +45,7 @@ const resource_1 = __importDefault(require("./resource"));
45
45
  const debug_1 = __importDefault(require("./debug"));
46
46
  const debug = (0, debug_1.default)('commercelayer');
47
47
  // Autogenerated schema version number, do not remove this line
48
- const OPEN_API_SCHEMA_VERSION = '4.16.0';
48
+ const OPEN_API_SCHEMA_VERSION = '4.18.0';
49
49
  exports.OPEN_API_SCHEMA_VERSION = OPEN_API_SCHEMA_VERSION;
50
50
  class CommerceLayerClient {
51
51
  // ##__CL_RESOURCES_DEF_STOP__##
@@ -20,8 +20,8 @@ const client_1 = __importDefault(require("./client"));
20
20
  const jsonapi_1 = require("./jsonapi");
21
21
  const query_1 = require("./query");
22
22
  const config_1 = __importDefault(require("./config"));
23
- const debug_1 = __importDefault(require("./debug"));
24
23
  const error_1 = require("./error");
24
+ const debug_1 = __importDefault(require("./debug"));
25
25
  const debug = (0, debug_1.default)('resource');
26
26
  class ListResponse extends Array {
27
27
  constructor(meta, data) {
@@ -3,10 +3,10 @@ import type { Resource, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Capture } from './captures';
8
9
  import type { Void } from './voids';
9
- import type { Event } from './events';
10
10
  type AuthorizationType = 'authorizations';
11
11
  type AuthorizationRel = ResourceRel & {
12
12
  type: AuthorizationType;
@@ -40,10 +40,10 @@ interface Authorization extends Resource {
40
40
  formatted_void_balance?: string | null;
41
41
  order?: Order | null;
42
42
  attachments?: Attachment[] | null;
43
+ events?: Event[] | null;
43
44
  versions?: Version[] | null;
44
45
  captures?: Capture[] | null;
45
46
  voids?: Void[] | null;
46
- events?: Event[] | null;
47
47
  }
48
48
  interface AuthorizationUpdate extends ResourceUpdate {
49
49
  _capture?: boolean | null;
@@ -55,10 +55,10 @@ declare class Authorizations extends ApiResource<Authorization> {
55
55
  update(resource: AuthorizationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
56
56
  order(authorizationId: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
57
57
  attachments(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
58
+ events(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
58
59
  versions(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
59
60
  captures(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Capture>>;
60
61
  voids(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Void>>;
61
- events(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
62
62
  _capture(id: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
63
63
  _capture_amount_cents(id: string | Authorization, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
64
64
  _void(id: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
@@ -13,6 +13,10 @@ class Authorizations extends resource_1.ApiResource {
13
13
  const _authorizationId = authorizationId.id || authorizationId;
14
14
  return this.resources.fetch({ type: 'attachments' }, `authorizations/${_authorizationId}/attachments`, params, options);
15
15
  }
16
+ async events(authorizationId, params, options) {
17
+ const _authorizationId = authorizationId.id || authorizationId;
18
+ return this.resources.fetch({ type: 'events' }, `authorizations/${_authorizationId}/events`, params, options);
19
+ }
16
20
  async versions(authorizationId, params, options) {
17
21
  const _authorizationId = authorizationId.id || authorizationId;
18
22
  return this.resources.fetch({ type: 'versions' }, `authorizations/${_authorizationId}/versions`, params, options);
@@ -25,10 +29,6 @@ class Authorizations extends resource_1.ApiResource {
25
29
  const _authorizationId = authorizationId.id || authorizationId;
26
30
  return this.resources.fetch({ type: 'voids' }, `authorizations/${_authorizationId}/voids`, params, options);
27
31
  }
28
- async events(authorizationId, params, options) {
29
- const _authorizationId = authorizationId.id || authorizationId;
30
- return this.resources.fetch({ type: 'events' }, `authorizations/${_authorizationId}/events`, params, options);
31
- }
32
32
  async _capture(id, params, options) {
33
33
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Authorizations.TYPE, _capture: true }, params, options);
34
34
  }
@@ -18,6 +18,7 @@ interface AxervePayment extends Resource {
18
18
  payment_request_data?: Record<string, any> | null;
19
19
  client_ip?: string | null;
20
20
  buyer_details?: Record<string, any> | null;
21
+ request_token?: boolean | null;
21
22
  mismatched_amounts?: boolean | null;
22
23
  intent_amount_cents: number;
23
24
  intent_amount_float?: number | null;
@@ -31,6 +32,7 @@ interface AxervePaymentCreate extends ResourceCreate {
31
32
  return_url: string;
32
33
  client_ip?: string | null;
33
34
  buyer_details?: Record<string, any> | null;
35
+ request_token?: boolean | null;
34
36
  order: OrderRel;
35
37
  }
36
38
  interface AxervePaymentUpdate extends ResourceUpdate {
@@ -3,10 +3,10 @@ import type { Resource, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Authorization } from './authorizations';
8
9
  import type { Refund } from './refunds';
9
- import type { Event } from './events';
10
10
  type CaptureType = 'captures';
11
11
  type CaptureRel = ResourceRel & {
12
12
  type: CaptureType;
@@ -32,10 +32,10 @@ interface Capture extends Resource {
32
32
  formatted_refund_balance?: string | null;
33
33
  order?: Order | null;
34
34
  attachments?: Attachment[] | null;
35
+ events?: Event[] | null;
35
36
  versions?: Version[] | null;
36
37
  reference_authorization?: Authorization | null;
37
38
  refunds?: Refund[] | null;
38
- events?: Event[] | null;
39
39
  }
40
40
  interface CaptureUpdate extends ResourceUpdate {
41
41
  _refund?: boolean | null;
@@ -46,10 +46,10 @@ declare class Captures extends ApiResource<Capture> {
46
46
  update(resource: CaptureUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
47
47
  order(captureId: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
48
48
  attachments(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
49
+ events(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
49
50
  versions(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
50
51
  reference_authorization(captureId: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
51
52
  refunds(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Refund>>;
52
- events(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
53
53
  _refund(id: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
54
54
  _refund_amount_cents(id: string | Capture, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
55
55
  isCapture(resource: any): resource is Capture;
@@ -13,6 +13,10 @@ class Captures extends resource_1.ApiResource {
13
13
  const _captureId = captureId.id || captureId;
14
14
  return this.resources.fetch({ type: 'attachments' }, `captures/${_captureId}/attachments`, params, options);
15
15
  }
16
+ async events(captureId, params, options) {
17
+ const _captureId = captureId.id || captureId;
18
+ return this.resources.fetch({ type: 'events' }, `captures/${_captureId}/events`, params, options);
19
+ }
16
20
  async versions(captureId, params, options) {
17
21
  const _captureId = captureId.id || captureId;
18
22
  return this.resources.fetch({ type: 'versions' }, `captures/${_captureId}/versions`, params, options);
@@ -25,10 +29,6 @@ class Captures extends resource_1.ApiResource {
25
29
  const _captureId = captureId.id || captureId;
26
30
  return this.resources.fetch({ type: 'refunds' }, `captures/${_captureId}/refunds`, params, options);
27
31
  }
28
- async events(captureId, params, options) {
29
- const _captureId = captureId.id || captureId;
30
- return this.resources.fetch({ type: 'events' }, `captures/${_captureId}/events`, params, options);
31
- }
32
32
  async _refund(id, params, options) {
33
33
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Captures.TYPE, _refund: true }, params, options);
34
34
  }
@@ -2,6 +2,7 @@ import { ApiResource } from '../resource';
2
2
  import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Customer, CustomerType } from './customers';
5
+ import type { PaymentMethod, PaymentMethodType } from './payment_methods';
5
6
  import type { AdyenPayment, AdyenPaymentType } from './adyen_payments';
6
7
  import type { AxervePayment, AxervePaymentType } from './axerve_payments';
7
8
  import type { BraintreePayment, BraintreePaymentType } from './braintree_payments';
@@ -18,6 +19,9 @@ type CustomerPaymentSourceRel = ResourceRel & {
18
19
  type CustomerRel = ResourceRel & {
19
20
  type: CustomerType;
20
21
  };
22
+ type PaymentMethodRel = ResourceRel & {
23
+ type: PaymentMethodType;
24
+ };
21
25
  type AdyenPaymentRel = ResourceRel & {
22
26
  type: AdyenPaymentType;
23
27
  };
@@ -48,15 +52,22 @@ interface CustomerPaymentSource extends Resource {
48
52
  customer_token?: string | null;
49
53
  payment_source_token?: string | null;
50
54
  customer?: Customer | null;
55
+ payment_method?: PaymentMethod | null;
51
56
  payment_source?: AdyenPayment | AxervePayment | BraintreePayment | CheckoutComPayment | ExternalPayment | KlarnaPayment | SatispayPayment | StripePayment | null;
52
57
  versions?: Version[] | null;
53
58
  }
54
59
  interface CustomerPaymentSourceCreate extends ResourceCreate {
60
+ customer_token?: string | null;
61
+ payment_source_token?: string | null;
55
62
  customer: CustomerRel;
56
- payment_source: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | SatispayPaymentRel | StripePaymentRel;
63
+ payment_method?: PaymentMethodRel | null;
64
+ payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | SatispayPaymentRel | StripePaymentRel | null;
57
65
  }
58
66
  interface CustomerPaymentSourceUpdate extends ResourceUpdate {
67
+ customer_token?: string | null;
68
+ payment_source_token?: string | null;
59
69
  customer?: CustomerRel | null;
70
+ payment_method?: PaymentMethodRel | null;
60
71
  payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | SatispayPaymentRel | StripePaymentRel | null;
61
72
  }
62
73
  declare class CustomerPaymentSources extends ApiResource<CustomerPaymentSource> {
@@ -65,6 +76,7 @@ declare class CustomerPaymentSources extends ApiResource<CustomerPaymentSource>
65
76
  update(resource: CustomerPaymentSourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomerPaymentSource>;
66
77
  delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
67
78
  customer(customerPaymentSourceId: string | CustomerPaymentSource, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Customer>;
79
+ payment_method(customerPaymentSourceId: string | CustomerPaymentSource, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentMethod>;
68
80
  versions(customerPaymentSourceId: string | CustomerPaymentSource, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
69
81
  isCustomerPaymentSource(resource: any): resource is CustomerPaymentSource;
70
82
  relationship(id: string | ResourceId | null): CustomerPaymentSourceRel;
@@ -15,6 +15,10 @@ class CustomerPaymentSources extends resource_1.ApiResource {
15
15
  const _customerPaymentSourceId = customerPaymentSourceId.id || customerPaymentSourceId;
16
16
  return this.resources.fetch({ type: 'customers' }, `customer_payment_sources/${_customerPaymentSourceId}/customer`, params, options);
17
17
  }
18
+ async payment_method(customerPaymentSourceId, params, options) {
19
+ const _customerPaymentSourceId = customerPaymentSourceId.id || customerPaymentSourceId;
20
+ return this.resources.fetch({ type: 'payment_methods' }, `customer_payment_sources/${_customerPaymentSourceId}/payment_method`, params, options);
21
+ }
18
22
  async versions(customerPaymentSourceId, params, options) {
19
23
  const _customerPaymentSourceId = customerPaymentSourceId.id || customerPaymentSourceId;
20
24
  return this.resources.fetch({ type: 'versions' }, `customer_payment_sources/${_customerPaymentSourceId}/versions`, params, options);
@@ -22,7 +22,6 @@ interface Import extends Resource {
22
22
  processed_count?: number | null;
23
23
  errors_log?: Record<string, any> | null;
24
24
  warnings_log?: Record<string, any> | null;
25
- cleanup_records?: boolean | null;
26
25
  attachment_url?: string | null;
27
26
  events?: Event[] | null;
28
27
  }
@@ -31,7 +30,6 @@ interface ImportCreate extends ResourceCreate {
31
30
  format?: string | null;
32
31
  parent_resource_id?: string | null;
33
32
  inputs: Array<Record<string, any>>;
34
- cleanup_records?: boolean | null;
35
33
  }
36
34
  declare class Imports extends ApiResource<Import> {
37
35
  static readonly TYPE: ImportType;
@@ -67,6 +67,9 @@ interface LineItem extends Resource {
67
67
  unit_amount_cents?: number | null;
68
68
  unit_amount_float?: number | null;
69
69
  formatted_unit_amount?: string | null;
70
+ compare_at_amount_cents: number;
71
+ compare_at_amount_float: number;
72
+ formatted_compare_at_amount: string;
70
73
  options_amount_cents?: number | null;
71
74
  options_amount_float?: number | null;
72
75
  formatted_options_amount?: string | null;
@@ -110,6 +113,7 @@ interface LineItemCreate extends ResourceCreate {
110
113
  _update_quantity?: boolean | null;
111
114
  _reserve_stock?: boolean | null;
112
115
  unit_amount_cents?: number | null;
116
+ compare_at_amount_cents: number;
113
117
  name?: string | null;
114
118
  image_url?: string | null;
115
119
  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;
@@ -126,6 +130,7 @@ interface LineItemUpdate extends ResourceUpdate {
126
130
  quantity?: number | null;
127
131
  _external_price?: boolean | null;
128
132
  _reserve_stock?: boolean | null;
133
+ compare_at_amount_cents?: number | null;
129
134
  name?: string | null;
130
135
  image_url?: string | null;
131
136
  frequency?: string | null;
@@ -3,9 +3,9 @@ import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse }
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Capture } from './captures';
8
- import type { Event } from './events';
9
9
  type RefundType = 'refunds';
10
10
  type RefundRel = ResourceRel & {
11
11
  type: RefundType;
@@ -25,17 +25,17 @@ interface Refund extends Resource {
25
25
  gateway_transaction_id?: string | null;
26
26
  order?: Order | null;
27
27
  attachments?: Attachment[] | null;
28
+ events?: Event[] | null;
28
29
  versions?: Version[] | null;
29
30
  reference_capture?: Capture | null;
30
- events?: Event[] | null;
31
31
  }
32
32
  declare class Refunds extends ApiResource<Refund> {
33
33
  static readonly TYPE: RefundType;
34
34
  order(refundId: string | Refund, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
35
35
  attachments(refundId: string | Refund, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
36
+ events(refundId: string | Refund, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
36
37
  versions(refundId: string | Refund, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
37
38
  reference_capture(refundId: string | Refund, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
38
- events(refundId: string | Refund, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
39
39
  isRefund(resource: any): resource is Refund;
40
40
  relationship(id: string | ResourceId | null): RefundRel;
41
41
  type(): RefundType;
@@ -10,6 +10,10 @@ class Refunds extends resource_1.ApiResource {
10
10
  const _refundId = refundId.id || refundId;
11
11
  return this.resources.fetch({ type: 'attachments' }, `refunds/${_refundId}/attachments`, params, options);
12
12
  }
13
+ async events(refundId, params, options) {
14
+ const _refundId = refundId.id || refundId;
15
+ return this.resources.fetch({ type: 'events' }, `refunds/${_refundId}/events`, params, options);
16
+ }
13
17
  async versions(refundId, params, options) {
14
18
  const _refundId = refundId.id || refundId;
15
19
  return this.resources.fetch({ type: 'versions' }, `refunds/${_refundId}/versions`, params, options);
@@ -18,10 +22,6 @@ class Refunds extends resource_1.ApiResource {
18
22
  const _refundId = refundId.id || refundId;
19
23
  return this.resources.fetch({ type: 'captures' }, `refunds/${_refundId}/reference_capture`, params, options);
20
24
  }
21
- async events(refundId, params, options) {
22
- const _refundId = refundId.id || refundId;
23
- return this.resources.fetch({ type: 'events' }, `refunds/${_refundId}/events`, params, options);
24
- }
25
25
  isRefund(resource) {
26
26
  return resource.type && (resource.type === Refunds.TYPE);
27
27
  }
@@ -14,6 +14,7 @@ import type { CarrierAccount } from './carrier_accounts';
14
14
  import type { Parcel } from './parcels';
15
15
  import type { Attachment } from './attachments';
16
16
  import type { Event } from './events';
17
+ import type { Tag, TagType } from './tags';
17
18
  import type { Version } from './versions';
18
19
  type ShipmentType = 'shipments';
19
20
  type ShipmentRel = ResourceRel & {
@@ -34,6 +35,9 @@ type AddressRel = ResourceRel & {
34
35
  type ShippingMethodRel = ResourceRel & {
35
36
  type: ShippingMethodType;
36
37
  };
38
+ type TagRel = ResourceRel & {
39
+ type: TagType;
40
+ };
37
41
  interface Shipment extends Resource {
38
42
  readonly type: ShipmentType;
39
43
  number?: string | null;
@@ -77,16 +81,19 @@ interface Shipment extends Resource {
77
81
  parcels?: Parcel[] | null;
78
82
  attachments?: Attachment[] | null;
79
83
  events?: Event[] | null;
84
+ tags?: Tag[] | null;
80
85
  versions?: Version[] | null;
81
86
  }
82
87
  interface ShipmentCreate extends ResourceCreate {
83
88
  order: OrderRel;
84
89
  shipping_category?: ShippingCategoryRel | null;
85
- inventory_stock_location?: InventoryStockLocationRel | null;
90
+ inventory_stock_location: InventoryStockLocationRel;
86
91
  shipping_address?: AddressRel | null;
87
92
  shipping_method?: ShippingMethodRel | null;
93
+ tags?: TagRel[] | null;
88
94
  }
89
95
  interface ShipmentUpdate extends ResourceUpdate {
96
+ _upcoming?: boolean | null;
90
97
  _on_hold?: boolean | null;
91
98
  _picking?: boolean | null;
92
99
  _packing?: boolean | null;
@@ -102,6 +109,7 @@ interface ShipmentUpdate extends ResourceUpdate {
102
109
  inventory_stock_location?: InventoryStockLocationRel | null;
103
110
  shipping_address?: AddressRel | null;
104
111
  shipping_method?: ShippingMethodRel | null;
112
+ tags?: TagRel[] | null;
105
113
  }
106
114
  declare class Shipments extends ApiResource<Shipment> {
107
115
  static readonly TYPE: ShipmentType;
@@ -123,7 +131,9 @@ declare class Shipments extends ApiResource<Shipment> {
123
131
  parcels(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Parcel>>;
124
132
  attachments(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
125
133
  events(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
134
+ tags(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
126
135
  versions(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
136
+ _upcoming(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
127
137
  _on_hold(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
128
138
  _picking(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
129
139
  _packing(id: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Shipment>;
@@ -71,10 +71,17 @@ class Shipments extends resource_1.ApiResource {
71
71
  const _shipmentId = shipmentId.id || shipmentId;
72
72
  return this.resources.fetch({ type: 'events' }, `shipments/${_shipmentId}/events`, params, options);
73
73
  }
74
+ async tags(shipmentId, params, options) {
75
+ const _shipmentId = shipmentId.id || shipmentId;
76
+ return this.resources.fetch({ type: 'tags' }, `shipments/${_shipmentId}/tags`, params, options);
77
+ }
74
78
  async versions(shipmentId, params, options) {
75
79
  const _shipmentId = shipmentId.id || shipmentId;
76
80
  return this.resources.fetch({ type: 'versions' }, `shipments/${_shipmentId}/versions`, params, options);
77
81
  }
82
+ async _upcoming(id, params, options) {
83
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _upcoming: true }, params, options);
84
+ }
78
85
  async _on_hold(id, params, options) {
79
86
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Shipments.TYPE, _on_hold: true }, params, options);
80
87
  }
@@ -25,6 +25,7 @@ type SkuRel = ResourceRel & {
25
25
  interface StockLineItem extends Resource {
26
26
  readonly type: StockLineItemType;
27
27
  sku_code?: string | null;
28
+ bundle_code?: string | null;
28
29
  quantity: number;
29
30
  shipment?: Shipment | null;
30
31
  line_item?: LineItem | null;
@@ -25,6 +25,7 @@ type LineItemRel = ResourceRel & {
25
25
  };
26
26
  interface StockTransfer extends Resource {
27
27
  readonly type: StockTransferType;
28
+ number?: number | null;
28
29
  sku_code?: string | null;
29
30
  status: 'draft' | 'upcoming' | 'on_hold' | 'picking' | 'in_transit' | 'completed' | 'cancelled';
30
31
  quantity: number;
@@ -3,6 +3,7 @@ import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse }
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  type TransactionType = 'transactions';
8
9
  type TransactionRel = ResourceRel & {
@@ -23,12 +24,14 @@ interface Transaction extends Resource {
23
24
  gateway_transaction_id?: string | null;
24
25
  order?: Order | null;
25
26
  attachments?: Attachment[] | null;
27
+ events?: Event[] | null;
26
28
  versions?: Version[] | null;
27
29
  }
28
30
  declare class Transactions extends ApiResource<Transaction> {
29
31
  static readonly TYPE: TransactionType;
30
32
  order(transactionId: string | Transaction, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
31
33
  attachments(transactionId: string | Transaction, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
34
+ events(transactionId: string | Transaction, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
32
35
  versions(transactionId: string | Transaction, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
33
36
  isTransaction(resource: any): resource is Transaction;
34
37
  relationship(id: string | ResourceId | null): TransactionRel;
@@ -10,6 +10,10 @@ class Transactions extends resource_1.ApiResource {
10
10
  const _transactionId = transactionId.id || transactionId;
11
11
  return this.resources.fetch({ type: 'attachments' }, `transactions/${_transactionId}/attachments`, params, options);
12
12
  }
13
+ async events(transactionId, params, options) {
14
+ const _transactionId = transactionId.id || transactionId;
15
+ return this.resources.fetch({ type: 'events' }, `transactions/${_transactionId}/events`, params, options);
16
+ }
13
17
  async versions(transactionId, params, options) {
14
18
  const _transactionId = transactionId.id || transactionId;
15
19
  return this.resources.fetch({ type: 'versions' }, `transactions/${_transactionId}/versions`, params, options);
@@ -3,9 +3,9 @@ import type { Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse }
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Authorization } from './authorizations';
8
- import type { Event } from './events';
9
9
  type VoidType = 'voids';
10
10
  type VoidRel = ResourceRel & {
11
11
  type: VoidType;
@@ -25,17 +25,17 @@ interface Void extends Resource {
25
25
  gateway_transaction_id?: string | null;
26
26
  order?: Order | null;
27
27
  attachments?: Attachment[] | null;
28
+ events?: Event[] | null;
28
29
  versions?: Version[] | null;
29
30
  reference_authorization?: Authorization | null;
30
- events?: Event[] | null;
31
31
  }
32
32
  declare class Voids extends ApiResource<Void> {
33
33
  static readonly TYPE: VoidType;
34
34
  order(voidId: string | Void, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
35
35
  attachments(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
36
+ events(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
36
37
  versions(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
37
38
  reference_authorization(voidId: string | Void, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
38
- events(voidId: string | Void, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
39
39
  isVoid(resource: any): resource is Void;
40
40
  relationship(id: string | ResourceId | null): VoidRel;
41
41
  type(): VoidType;
@@ -10,6 +10,10 @@ class Voids extends resource_1.ApiResource {
10
10
  const _voidId = voidId.id || voidId;
11
11
  return this.resources.fetch({ type: 'attachments' }, `voids/${_voidId}/attachments`, params, options);
12
12
  }
13
+ async events(voidId, params, options) {
14
+ const _voidId = voidId.id || voidId;
15
+ return this.resources.fetch({ type: 'events' }, `voids/${_voidId}/events`, params, options);
16
+ }
13
17
  async versions(voidId, params, options) {
14
18
  const _voidId = voidId.id || voidId;
15
19
  return this.resources.fetch({ type: 'versions' }, `voids/${_voidId}/versions`, params, options);
@@ -18,10 +22,6 @@ class Voids extends resource_1.ApiResource {
18
22
  const _voidId = voidId.id || voidId;
19
23
  return this.resources.fetch({ type: 'authorizations' }, `voids/${_voidId}/reference_authorization`, params, options);
20
24
  }
21
- async events(voidId, params, options) {
22
- const _voidId = voidId.id || voidId;
23
- return this.resources.fetch({ type: 'events' }, `voids/${_voidId}/events`, params, options);
24
- }
25
25
  isVoid(resource) {
26
26
  return resource.type && (resource.type === Voids.TYPE);
27
27
  }
package/lib/esm/api.d.ts CHANGED
@@ -146,7 +146,7 @@ export type DeletableResourceType = 'addresses' | 'adjustments' | 'adyen_gateway
146
146
  export type DeletableResource = Resource & {
147
147
  type: DeletableResourceType;
148
148
  };
149
- export type TaggableResourceType = 'addresses' | 'bundles' | 'buy_x_pay_y_promotions' | 'coupons' | 'customers' | 'external_promotions' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_cards' | 'line_item_options' | 'line_items' | 'orders' | 'percentage_discount_promotions' | 'promotions' | 'returns' | 'sku_options' | 'skus';
149
+ export type TaggableResourceType = 'addresses' | 'bundles' | 'buy_x_pay_y_promotions' | 'coupons' | 'customers' | 'external_promotions' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_cards' | 'line_item_options' | 'line_items' | 'orders' | 'percentage_discount_promotions' | 'promotions' | 'returns' | 'shipments' | 'sku_options' | 'skus';
150
150
  export type TaggableResource = Resource & {
151
151
  type: TaggableResourceType;
152
152
  tags?: Array<ResourceRel & {
@@ -2,14 +2,14 @@ import * as api from './api';
2
2
  import type { ApiError } from './error';
3
3
  import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
4
4
  import { type ResourcesInitConfig } from './resource';
5
- declare const OPEN_API_SCHEMA_VERSION = "4.16.0";
5
+ declare const OPEN_API_SCHEMA_VERSION = "4.18.0";
6
6
  export { OPEN_API_SCHEMA_VERSION };
7
7
  type SdkConfig = {};
8
8
  type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
9
9
  type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
10
10
  declare class CommerceLayerClient {
11
11
  #private;
12
- readonly openApiSchemaVersion = "4.16.0";
12
+ readonly openApiSchemaVersion = "4.18.0";
13
13
  addresses: api.Addresses;
14
14
  adjustments: api.Adjustments;
15
15
  adyen_gateways: api.AdyenGateways;
@@ -16,7 +16,7 @@ import ResourceAdapter from './resource';
16
16
  import Debug from './debug';
17
17
  const debug = Debug('commercelayer');
18
18
  // Autogenerated schema version number, do not remove this line
19
- const OPEN_API_SCHEMA_VERSION = '4.16.0';
19
+ const OPEN_API_SCHEMA_VERSION = '4.18.0';
20
20
  export { OPEN_API_SCHEMA_VERSION };
21
21
  class CommerceLayerClient {
22
22
  // ##__CL_RESOURCES_DEF_STOP__##
@@ -14,8 +14,8 @@ import ApiClient from './client';
14
14
  import { denormalize, normalize } from './jsonapi';
15
15
  import { generateQueryStringParams, isParamsList } from './query';
16
16
  import config from './config';
17
- import Debug from './debug';
18
17
  import { ErrorType, SdkError } from './error';
18
+ import Debug from './debug';
19
19
  const debug = Debug('resource');
20
20
  class ListResponse extends Array {
21
21
  constructor(meta, data) {
@@ -3,10 +3,10 @@ import type { Resource, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Capture } from './captures';
8
9
  import type { Void } from './voids';
9
- import type { Event } from './events';
10
10
  type AuthorizationType = 'authorizations';
11
11
  type AuthorizationRel = ResourceRel & {
12
12
  type: AuthorizationType;
@@ -40,10 +40,10 @@ interface Authorization extends Resource {
40
40
  formatted_void_balance?: string | null;
41
41
  order?: Order | null;
42
42
  attachments?: Attachment[] | null;
43
+ events?: Event[] | null;
43
44
  versions?: Version[] | null;
44
45
  captures?: Capture[] | null;
45
46
  voids?: Void[] | null;
46
- events?: Event[] | null;
47
47
  }
48
48
  interface AuthorizationUpdate extends ResourceUpdate {
49
49
  _capture?: boolean | null;
@@ -55,10 +55,10 @@ declare class Authorizations extends ApiResource<Authorization> {
55
55
  update(resource: AuthorizationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
56
56
  order(authorizationId: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
57
57
  attachments(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
58
+ events(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
58
59
  versions(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
59
60
  captures(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Capture>>;
60
61
  voids(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Void>>;
61
- events(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
62
62
  _capture(id: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
63
63
  _capture_amount_cents(id: string | Authorization, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
64
64
  _void(id: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;