Skip to content

Commit dba5b3f

Browse files
committed
feat(migrate): replace import * as with proper imports
1 parent d864820 commit dba5b3f

File tree

13 files changed

+82
-102
lines changed

13 files changed

+82
-102
lines changed

packages/sync-actions/src/customers.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ import type {
44
SyncActionConfig,
55
UpdateAction,
66
} from '@commercetools/sdk-client-v2'
7-
import * as customerActions from './customer-actions'
7+
import {
8+
actionsMapAddresses,
9+
actionsMapAuthenticationModes,
10+
actionsMapBase,
11+
actionsMapBillingAddresses,
12+
actionsMapReferences,
13+
actionsMapSetDefaultBase,
14+
actionsMapShippingAddresses,
15+
} from './customer-actions'
816
import { SyncAction } from './types/update-actions'
917
import actionsMapCustom from './utils/action-map-custom'
1018
import copyEmptyArrayProps from './utils/copy-empty-array-props'
@@ -35,52 +43,45 @@ function createCustomerMapActions(
3543
mapActionGroup(
3644
'base',
3745
(): Array<UpdateAction> =>
38-
customerActions.actionsMapBase(diff, oldObj, newObj, syncActionConfig)
46+
actionsMapBase(diff, oldObj, newObj, syncActionConfig)
3947
)
4048
)
4149

4250
allActions.push(
4351
mapActionGroup(
4452
'references',
45-
(): Array<UpdateAction> =>
46-
customerActions.actionsMapReferences(diff, oldObj, newObj)
53+
(): Array<UpdateAction> => actionsMapReferences(diff, oldObj, newObj)
4754
)
4855
)
4956

5057
allActions.push(
5158
mapActionGroup(
5259
'addresses',
53-
(): Array<UpdateAction> =>
54-
customerActions.actionsMapAddresses(diff, oldObj, newObj)
60+
(): Array<UpdateAction> => actionsMapAddresses(diff, oldObj, newObj)
5561
)
5662
)
5763

5864
allActions.push(
5965
mapActionGroup(
6066
'base',
6167
(): Array<UpdateAction> =>
62-
customerActions.actionsMapSetDefaultBase(
63-
diff,
64-
oldObj,
65-
newObj,
66-
syncActionConfig
67-
)
68+
actionsMapSetDefaultBase(diff, oldObj, newObj, syncActionConfig)
6869
)
6970
)
7071

7172
allActions.push(
7273
mapActionGroup(
7374
'billingAddressIds',
7475
(): Array<UpdateAction> =>
75-
customerActions.actionsMapBillingAddresses(diff, oldObj, newObj)
76+
actionsMapBillingAddresses(diff, oldObj, newObj)
7677
)
7778
)
7879

7980
allActions.push(
8081
mapActionGroup(
8182
'shippingAddressIds',
8283
(): Array<UpdateAction> =>
83-
customerActions.actionsMapShippingAddresses(diff, oldObj, newObj)
84+
actionsMapShippingAddresses(diff, oldObj, newObj)
8485
)
8586
)
8687

@@ -95,7 +96,7 @@ function createCustomerMapActions(
9596
mapActionGroup(
9697
'authenticationModes',
9798
(): Array<UpdateAction> =>
98-
customerActions.actionsMapAuthenticationModes(diff, oldObj, newObj)
99+
actionsMapAuthenticationModes(diff, oldObj, newObj)
99100
)
100101
)
101102

packages/sync-actions/src/inventories.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import type {
44
SyncActionConfig,
55
UpdateAction,
66
} from '@commercetools/sdk-client-v2'
7-
import * as inventoryActions from './inventory-actions'
87
import { SyncAction } from './types/update-actions'
98
import actionsMapCustom from './utils/action-map-custom'
109
import createBuildActions from './utils/create-build-actions'
1110
import createMapActionGroup from './utils/create-map-action-group'
1211
import { diff } from './utils/diffpatcher'
12+
import { actionsMapBase, actionsMapReferences } from './inventory-actions'
1313

1414
export const actionGroups = ['base', 'references']
1515

@@ -27,19 +27,14 @@ function createInventoryMapActions(
2727
mapActionGroup(
2828
'base',
2929
(): Array<UpdateAction> =>
30-
inventoryActions.actionsMapBase(
31-
diff,
32-
oldObj,
33-
newObj,
34-
syncActionConfig
35-
)
30+
actionsMapBase(diff, oldObj, newObj, syncActionConfig)
3631
)
3732
)
33+
3834
allActions.push(
3935
mapActionGroup(
4036
'references',
41-
(): Array<UpdateAction> =>
42-
inventoryActions.actionsMapReferences(diff, oldObj, newObj)
37+
(): Array<UpdateAction> => actionsMapReferences(diff, oldObj, newObj)
4338
)
4439
)
4540
allActions.push(

packages/sync-actions/src/orders.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ import type {
44
SyncActionConfig,
55
UpdateAction,
66
} from '@commercetools/sdk-client-v2'
7-
import * as orderActions from './order-actions'
7+
import {
8+
actionsMapBase,
9+
actionsMapDeliveries,
10+
actionsMapDeliveryItems,
11+
actionsMapParcels,
12+
actionsMapReturnsInfo,
13+
} from './order-actions'
814
import { SyncAction } from './types/update-actions'
915
import actionsMapCustom from './utils/action-map-custom'
1016
import createBuildActions from './utils/create-build-actions'
@@ -38,44 +44,37 @@ function createOrderMapActions(
3844
mapActionGroup(
3945
'base',
4046
(): Array<UpdateAction> =>
41-
orderActions.actionsMapBase(diff, oldObj, newObj, syncActionConfig)
47+
actionsMapBase(diff, oldObj, newObj, syncActionConfig)
4248
)
4349
)
4450

4551
allActions.push(
4652
mapActionGroup(
4753
'deliveries',
48-
(): Array<UpdateAction> =>
49-
orderActions.actionsMapDeliveries(diff, oldObj, newObj)
54+
(): Array<UpdateAction> => actionsMapDeliveries(diff, oldObj, newObj)
5055
)
5156
)
5257

5358
allActions.push(
5459
mapActionGroup(
5560
'parcels',
5661
(): Array<UpdateAction> =>
57-
orderActions.actionsMapParcels(diff, oldObj, newObj, deliveryHashMap)
62+
actionsMapParcels(diff, oldObj, newObj, deliveryHashMap)
5863
)
5964
)
6065

6166
allActions.push(
6267
mapActionGroup(
6368
'items',
6469
(): Array<UpdateAction> =>
65-
orderActions.actionsMapDeliveryItems(
66-
diff,
67-
oldObj,
68-
newObj,
69-
deliveryHashMap
70-
)
70+
actionsMapDeliveryItems(diff, oldObj, newObj, deliveryHashMap)
7171
)
7272
)
7373

7474
allActions.push(
7575
mapActionGroup(
7676
'returnInfo',
77-
(): Array<UpdateAction> =>
78-
orderActions.actionsMapReturnsInfo(diff, oldObj, newObj)
77+
(): Array<UpdateAction> => actionsMapReturnsInfo(diff, oldObj, newObj)
7978
).flat()
8079
)
8180

packages/sync-actions/src/prices.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
SyncActionConfig,
55
UpdateAction,
66
} from '@commercetools/sdk-client-v2'
7-
import * as pricesActions from './prices-actions'
7+
import { actionsMapBase } from './prices-actions'
88
import actionsMapCustom from './utils/action-map-custom'
99
import combineValidityActions from './utils/combine-validity-actions'
1010
import createBuildActions from './utils/create-build-actions'
@@ -25,7 +25,7 @@ function createPriceMapActions(
2525
const baseActions = mapActionGroup(
2626
'base',
2727
(): Array<UpdateAction> =>
28-
pricesActions.actionsMapBase(diff, oldObj, newObj, syncActionConfig)
28+
actionsMapBase(diff, oldObj, newObj, syncActionConfig)
2929
)
3030

3131
const customActions = mapActionGroup(

packages/sync-actions/src/product-selections.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ProductSelectionUpdateAction } from '@commercetools/platform-sdk'
22
import type { ActionGroup, UpdateAction } from '@commercetools/sdk-client-v2'
3-
import * as productSelectionsActions from './product-selections-actions'
3+
import { actionsMapBase } from './product-selections-actions'
44
import { SyncAction } from './types/update-actions'
55
import actionsMapCustom from './utils/action-map-custom'
66
import createBuildActions from './utils/create-build-actions'
@@ -24,8 +24,7 @@ function createProductSelectionsMapActions(
2424
allActions.push(
2525
mapActionGroup(
2626
'base',
27-
(): Array<UpdateAction> =>
28-
productSelectionsActions.actionsMapBase(diff, previous, next)
27+
(): Array<UpdateAction> => actionsMapBase(diff, previous, next)
2928
)
3029
)
3130
allActions.push(

packages/sync-actions/src/products.ts

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@ import type {
44
SyncActionConfig,
55
UpdateAction,
66
} from '@commercetools/sdk-client-v2'
7-
import * as productActions from './product-actions'
7+
import {
8+
actionsMapAddVariants,
9+
actionsMapAssets,
10+
actionsMapAttributes,
11+
actionsMapBase,
12+
actionsMapCategories,
13+
actionsMapCategoryOrderHints,
14+
actionsMapImages,
15+
actionsMapMasterVariant,
16+
actionsMapMeta,
17+
actionsMapPrices,
18+
actionsMapPricesCustom,
19+
actionsMapReferences,
20+
actionsMapRemoveVariants,
21+
} from './product-actions'
822
import { SyncAction } from './types/update-actions'
923
import copyEmptyArrayProps from './utils/copy-empty-array-props'
1024
import createBuildActions from './utils/create-build-actions'
@@ -49,7 +63,7 @@ function createProductMapActions(
4963
mapActionGroup(
5064
'attributes',
5165
(): Array<UpdateAction> =>
52-
productActions.actionsMapAttributes(
66+
actionsMapAttributes(
5367
diff,
5468
oldObj,
5569
newObj,
@@ -62,71 +76,63 @@ function createProductMapActions(
6276
allActions.push(
6377
mapActionGroup(
6478
'variants',
65-
(): Array<UpdateAction> =>
66-
productActions.actionsMapAddVariants(diff, oldObj, newObj)
79+
(): Array<UpdateAction> => actionsMapAddVariants(diff, oldObj, newObj)
6780
)
6881
)
6982

70-
allActions.push(productActions.actionsMapMasterVariant(oldObj, newObj))
83+
allActions.push(actionsMapMasterVariant(oldObj, newObj))
7184

7285
allActions.push(
7386
mapActionGroup(
7487
'variants',
7588
(): Array<UpdateAction> =>
76-
productActions.actionsMapRemoveVariants(diff, oldObj, newObj)
89+
actionsMapRemoveVariants(diff, oldObj, newObj)
7790
)
7891
)
7992

8093
allActions.push(
8194
mapActionGroup(
8295
'base',
8396
(): Array<UpdateAction> =>
84-
productActions.actionsMapBase(diff, oldObj, newObj, syncActionConfig)
97+
actionsMapBase(diff, oldObj, newObj, syncActionConfig)
8598
)
8699
)
87100

88101
allActions.push(
89102
mapActionGroup(
90103
'meta',
91-
(): Array<UpdateAction> =>
92-
productActions.actionsMapMeta(diff, oldObj, newObj)
104+
(): Array<UpdateAction> => actionsMapMeta(diff, oldObj, newObj)
93105
)
94106
)
95107

96108
allActions.push(
97109
mapActionGroup(
98110
'references',
99-
(): Array<UpdateAction> =>
100-
productActions.actionsMapReferences(diff, oldObj, newObj)
111+
(): Array<UpdateAction> => actionsMapReferences(diff, oldObj, newObj)
101112
)
102113
)
103114

104115
allActions.push(
105116
mapActionGroup(
106117
'images',
107118
(): Array<UpdateAction> =>
108-
productActions.actionsMapImages(diff, oldObj, newObj, variantHashMap)
119+
actionsMapImages(diff, oldObj, newObj, variantHashMap)
109120
)
110121
)
111122

112123
allActions.push(
113124
mapActionGroup(
114125
'pricesCustom',
115126
(): Array<UpdateAction> =>
116-
productActions.actionsMapPricesCustom(
117-
diff,
118-
oldObj,
119-
newObj,
120-
variantHashMap
121-
)
127+
actionsMapPricesCustom(diff, oldObj, newObj, variantHashMap)
122128
)
123129
)
124130

125131
allActions.push(
126132
mapActionGroup(
127133
'prices',
128134
(): Array<UpdateAction> =>
129-
productActions.actionsMapPrices(
135+
actionsMapPrices(
130136
diff,
131137
oldObj,
132138
newObj,
@@ -139,23 +145,22 @@ function createProductMapActions(
139145
allActions.push(
140146
mapActionGroup(
141147
'categories',
142-
(): Array<UpdateAction> => productActions.actionsMapCategories(diff)
148+
(): Array<UpdateAction> => actionsMapCategories(diff)
143149
)
144150
)
145151

146152
allActions.push(
147153
mapActionGroup(
148154
'categories',
149-
(): Array<UpdateAction> =>
150-
productActions.actionsMapCategoryOrderHints(diff)
155+
(): Array<UpdateAction> => actionsMapCategoryOrderHints(diff)
151156
)
152157
)
153158

154159
allActions.push(
155160
mapActionGroup(
156161
'assets',
157162
(): Array<UpdateAction> =>
158-
productActions.actionsMapAssets(diff, oldObj, newObj, variantHashMap)
163+
actionsMapAssets(diff, oldObj, newObj, variantHashMap)
159164
)
160165
)
161166

packages/sync-actions/src/quote-requests.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
SyncActionConfig,
55
UpdateAction,
66
} from '@commercetools/sdk-client-v2'
7-
import * as QuoteRequestsActions from './quote-requests-actions'
7+
import { actionsMapBase } from './quote-requests-actions'
88
import { SyncAction } from './types/update-actions'
99
import actionsMapCustom from './utils/action-map-custom'
1010
import createBuildActions from './utils/create-build-actions'
@@ -28,12 +28,7 @@ function createQuoteRequestsMapActions(
2828
mapActionGroup(
2929
'base',
3030
(): Array<UpdateAction> =>
31-
QuoteRequestsActions.actionsMapBase(
32-
diff,
33-
oldObj,
34-
newObj,
35-
syncActionConfig
36-
)
31+
actionsMapBase(diff, oldObj, newObj, syncActionConfig)
3732
)
3833
)
3934

0 commit comments

Comments
 (0)