@gradientedge/commercetools-utils 4.14.0 → 4.16.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.
@@ -2,7 +2,7 @@ import { AxiosInstance } from 'axios';
2
2
  import { CommercetoolsApiConfig, CommercetoolsRetryConfig } from './types';
3
3
  import { CommercetoolsAuth } from '../';
4
4
  import { RegionEndpoints } from '../types';
5
- import type { Cart, CartDiscount, CartDiscountPagedQueryResponse, CartDraft, CartPagedQueryResponse, CartUpdateAction, Category, CategoryDraft, CategoryPagedQueryResponse, CategoryUpdate, Channel, ChannelPagedQueryResponse, Customer, CustomerCreatePasswordResetToken, CustomerDraft, CustomerGroup, CustomerGroupDraft, CustomerGroupPagedQueryResponse, CustomerGroupUpdate, CustomerPagedQueryResponse, CustomerResetPassword, CustomerSignin, CustomerSignInResult, CustomerToken, CustomerUpdate, CustomObject, CustomObjectDraft, DiscountCode, GraphQLRequest, GraphQLResponse, MyCartDraft, MyCustomerDraft, MyPayment, MyPaymentDraft, MyPaymentPagedQueryResponse, MyPaymentUpdate, Order, OrderImportDraft, OrderPagedQueryResponse, OrderUpdate, Payment, PaymentPagedQueryResponse, PaymentUpdate, Product, ProductDraft, ProductProjection, ProductProjectionPagedQueryResponse, ProductsInStorePagedQueryResponse, ProductSelection, ProductSelectionDraft, ProductSelectionPagedQueryResponse, ProductSelectionUpdateAction, ProductType, ProductUpdate, ShippingMethod, ShippingMethodPagedQueryResponse, Store, StoreDraft, StorePagedQueryResponse, StoreUpdate, Type } from '../models';
5
+ import type { Cart, CartDiscount, CartDiscountPagedQueryResponse, CartDraft, CartPagedQueryResponse, CartUpdateAction, Category, CategoryDraft, CategoryPagedQueryResponse, CategoryUpdate, Channel, ChannelPagedQueryResponse, Customer, CustomerCreatePasswordResetToken, CustomerDraft, CustomerGroup, CustomerGroupDraft, CustomerGroupPagedQueryResponse, CustomerGroupUpdate, CustomerPagedQueryResponse, CustomerResetPassword, CustomerSignin, CustomerSignInResult, CustomerToken, CustomerUpdate, CustomObject, CustomObjectDraft, DiscountCode, GraphQLRequest, GraphQLResponse, MyCartDraft, MyCartUpdateAction, MyCustomerDraft, MyPayment, MyPaymentDraft, MyPaymentPagedQueryResponse, MyPaymentUpdate, Order, OrderImportDraft, OrderPagedQueryResponse, OrderUpdate, Payment, PaymentPagedQueryResponse, PaymentUpdate, Product, ProductDraft, ProductProjection, ProductProjectionPagedQueryResponse, ProductsInStorePagedQueryResponse, ProductSelection, ProductSelectionDraft, ProductSelectionPagedQueryResponse, ProductSelectionUpdateAction, ProductType, ProductUpdate, ShippingMethod, ShippingMethodPagedQueryResponse, Store, StoreDraft, StorePagedQueryResponse, StoreUpdate, Type } from '../models';
6
6
  export interface FetchOptions<T = Record<string, any>> {
7
7
  path: string;
8
8
  headers?: Record<string, string>;
@@ -157,7 +157,7 @@ export declare class CommercetoolsApi {
157
157
  }): Promise<Cart>;
158
158
  updateMyActiveCart(options: CommonStoreEnabledRequestOptions & {
159
159
  accessToken: string;
160
- actions: CartUpdateAction[];
160
+ actions: MyCartUpdateAction[];
161
161
  }): Promise<Cart>;
162
162
  createMyOrderFromActiveCart(options: CommonStoreEnabledRequestOptions & {
163
163
  accessToken: string;
@@ -432,7 +432,6 @@ export declare class CommercetoolsApi {
432
432
  request<T = any, R = any>(options: FetchOptions<T>): Promise<R>;
433
433
  getRetryConfig(methodRetryConfig?: CommercetoolsRetryConfig): CommercetoolsRetryConfig;
434
434
  getRequestOptions(options: FetchOptions): Promise<any>;
435
- calculateDelay(retryCount: number, retryConfig?: CommercetoolsRetryConfig): number;
436
435
  isRetryableError(error: any): boolean;
437
436
  extractCommonRequestOptions(options?: CommonRequestOptions): CommonRequestOptions;
438
437
  applyStore(path: string, storeKey: string | undefined | null): string;
@@ -262,11 +262,13 @@ export interface TaxPortionDraft {
262
262
  export interface TaxedItemPrice {
263
263
  readonly totalNet: TypedMoney;
264
264
  readonly totalGross: TypedMoney;
265
+ readonly totalTax?: TypedMoney;
265
266
  }
266
267
  export interface TaxedPrice {
267
268
  readonly totalNet: TypedMoney;
268
269
  readonly totalGross: TypedMoney;
269
270
  readonly taxPortions: TaxPortion[];
271
+ readonly totalTax?: TypedMoney;
270
272
  }
271
273
  export interface TaxedPriceDraft {
272
274
  readonly totalNet: Money;
@@ -1,8 +1,9 @@
1
- import { DiscountCodeInfo, ExternalLineItemTotalPrice, ExternalTaxRateDraft, InventoryMode, ItemShippingDetailsDraft, ItemShippingTarget, TaxMode } from './cart';
1
+ import { CartReference, DiscountCodeInfo, ExternalLineItemTotalPrice, ExternalTaxRateDraft, InventoryMode, ItemShippingDetailsDraft, ItemShippingTarget, TaxMode } from './cart';
2
2
  import { ChannelResourceIdentifier } from './channel';
3
3
  import { BaseAddress, LocalizedString, Money, TypedMoney } from './common';
4
4
  import { CustomerReference } from './customer';
5
5
  import { DiscountCodeReference } from './discount-code';
6
+ import { OrderReference } from './order';
6
7
  import { PaymentMethodInfo, PaymentResourceIdentifier, Transaction, TransactionDraft, TransactionType } from './payment';
7
8
  import { ShippingMethodResourceIdentifier } from './shipping-method';
8
9
  import { ShoppingListLineItemDraft, TextLineItemDraft } from './shopping-list';
@@ -116,6 +117,9 @@ export interface MyTransactionDraft {
116
117
  readonly interactionId?: string;
117
118
  readonly custom?: CustomFieldsDraft;
118
119
  }
120
+ export interface ReplicaMyCartDraft {
121
+ readonly reference: CartReference | OrderReference;
122
+ }
119
123
  export interface MyCartAddDiscountCodeAction {
120
124
  readonly action: 'addDiscountCode';
121
125
  readonly code: string;
@@ -66,7 +66,8 @@ export interface StoreAddDistributionChannelAction {
66
66
  }
67
67
  export interface StoreAddProductSelectionAction {
68
68
  readonly action: 'addProductSelection';
69
- readonly productSelection: ProductSelectionSettingDraft;
69
+ readonly productSelection: ProductSelectionResourceIdentifier;
70
+ readonly active?: boolean;
70
71
  }
71
72
  export interface StoreAddSupplyChannelAction {
72
73
  readonly action: 'addSupplyChannel';
@@ -67,7 +67,7 @@ export interface CustomFieldStringType {
67
67
  export interface CustomFieldTimeType {
68
68
  readonly name: 'Time';
69
69
  }
70
- export declare type ResourceTypeId = 'address' | 'asset' | 'cart-discount' | 'category' | 'channel' | 'custom-line-item' | 'customer' | 'customer-group' | 'discount-code' | 'inventory-entry' | 'line-item' | 'order' | 'order-delivery' | 'order-edit' | 'payment' | 'payment-interface-interaction' | 'product-price' | 'product-selection' | 'review' | 'shipping-method' | 'shopping-list' | 'shopping-list-text-line-item' | 'store' | 'transaction';
70
+ export declare type ResourceTypeId = 'address' | 'asset' | 'cart-discount' | 'category' | 'channel' | 'custom-line-item' | 'customer' | 'customer-group' | 'discount-code' | 'inventory-entry' | 'line-item' | 'order' | 'order-delivery' | 'order-edit' | 'order-parcel' | 'order-return-item' | 'payment' | 'payment-interface-interaction' | 'product-price' | 'product-selection' | 'review' | 'shipping-method' | 'shopping-list' | 'shopping-list-text-line-item' | 'store' | 'transaction';
71
71
  export interface Type extends BaseResource {
72
72
  readonly id: string;
73
73
  readonly version: number;
@@ -0,0 +1,2 @@
1
+ import { CommercetoolsRetryConfig } from '../api';
2
+ export declare function calculateDelay(retryCount: number, retryConfig?: CommercetoolsRetryConfig): number;
@@ -1,3 +1,5 @@
1
+ export * from './calculate-delay';
1
2
  export * from './format';
2
- export * from './useragent';
3
3
  export * from './mask';
4
+ export * from './retry-on-conflict';
5
+ export * from './useragent';
@@ -0,0 +1,7 @@
1
+ export interface RetryOnConflictParams<T = any> {
2
+ executeFn: (...args: any) => Promise<T>;
3
+ delayMs?: number;
4
+ maxRetries?: number;
5
+ jitter?: boolean;
6
+ }
7
+ export declare function retryOnConflict<T = any>(options: RetryOnConflictParams): Promise<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/commercetools-utils",
3
- "version": "4.14.0",
3
+ "version": "4.16.0",
4
4
  "description": "Provide utility classes and functions for interacting with the commercetools API",
5
5
  "main": "./dist/ge-commercetools-utils-node.cjs.js",
6
6
  "module": "./dist/ge-commercetools-utils-node.esm.js",
@@ -87,6 +87,7 @@
87
87
  "webpack-cli": "4.9.2"
88
88
  },
89
89
  "dependencies": {
90
+ "@tshttp/status": "^2.0.0",
90
91
  "axios": "0.26.1",
91
92
  "json-stringify-safe": "5.0.1",
92
93
  "lodash.clonedeep": "4.5.0",