@medusajs/types 1.12.0-snapshot-20240405070935 → 1.12.0-snapshot-20240406075900
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth/common/auth-user.d.ts +21 -16
- package/dist/auth/common/auth-user.d.ts.map +1 -1
- package/dist/auth/common/provider.d.ts +28 -15
- package/dist/auth/common/provider.d.ts.map +1 -1
- package/dist/auth/service.d.ts +137 -75
- package/dist/auth/service.d.ts.map +1 -1
- package/dist/bundles.d.ts +2 -0
- package/dist/bundles.d.ts.map +1 -1
- package/dist/bundles.js +3 -1
- package/dist/bundles.js.map +1 -1
- package/dist/cart/common.d.ts +443 -62
- package/dist/cart/common.d.ts.map +1 -1
- package/dist/cart/mutations.d.ts +483 -0
- package/dist/cart/mutations.d.ts.map +1 -1
- package/dist/cart/mutations.js.map +1 -1
- package/dist/cart/service.d.ts +1607 -0
- package/dist/cart/service.d.ts.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/rule.d.ts +2 -0
- package/dist/common/rule.d.ts.map +1 -0
- package/dist/common/rule.js +3 -0
- package/dist/common/rule.js.map +1 -0
- package/dist/customer/service.d.ts +445 -197
- package/dist/customer/service.d.ts.map +1 -1
- package/dist/file/common.d.ts +14 -0
- package/dist/file/common.d.ts.map +1 -0
- package/dist/file/common.js +3 -0
- package/dist/file/common.js.map +1 -0
- package/dist/file/index.d.ts +4 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/file/index.js +20 -0
- package/dist/file/index.js.map +1 -0
- package/dist/file/mutations.d.ts +18 -0
- package/dist/file/mutations.d.ts.map +1 -0
- package/dist/file/mutations.js +3 -0
- package/dist/file/mutations.js.map +1 -0
- package/dist/file/service.d.ts +76 -0
- package/dist/file/service.d.ts.map +1 -0
- package/dist/file/service.js +3 -0
- package/dist/file/service.js.map +1 -0
- package/dist/fulfillment/mutations/shipping-option-rule.d.ts +2 -2
- package/dist/fulfillment/mutations/shipping-option-rule.d.ts.map +1 -1
- package/dist/http/fulfillment/admin/fulfillment-address.d.ts +22 -0
- package/dist/http/fulfillment/admin/fulfillment-address.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-address.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-address.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-item.d.ts +17 -0
- package/dist/http/fulfillment/admin/fulfillment-item.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-item.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-item.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-label.d.ts +14 -0
- package/dist/http/fulfillment/admin/fulfillment-label.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-label.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-label.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.d.ts +12 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-provider.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-set.d.ts +15 -0
- package/dist/http/fulfillment/admin/fulfillment-set.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment-set.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment-set.js.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment.d.ts +27 -0
- package/dist/http/fulfillment/admin/fulfillment.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/fulfillment.js +3 -0
- package/dist/http/fulfillment/admin/fulfillment.js.map +1 -0
- package/dist/http/fulfillment/admin/geo-zone.d.ts +17 -0
- package/dist/http/fulfillment/admin/geo-zone.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/geo-zone.js +3 -0
- package/dist/http/fulfillment/admin/geo-zone.js.map +1 -0
- package/dist/http/fulfillment/admin/index.d.ts +13 -0
- package/dist/http/fulfillment/admin/index.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/index.js +29 -0
- package/dist/http/fulfillment/admin/index.js.map +1 -0
- package/dist/http/fulfillment/admin/service-zone.d.ts +14 -0
- package/dist/http/fulfillment/admin/service-zone.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/service-zone.js +3 -0
- package/dist/http/fulfillment/admin/service-zone.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.d.ts +16 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option-rule.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-type.d.ts +14 -0
- package/dist/http/fulfillment/admin/shipping-option-type.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option-type.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option-type.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option.d.ts +31 -0
- package/dist/http/fulfillment/admin/shipping-option.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-option.js +3 -0
- package/dist/http/fulfillment/admin/shipping-option.js.map +1 -0
- package/dist/http/fulfillment/admin/shipping-profile.d.ts +13 -0
- package/dist/http/fulfillment/admin/shipping-profile.d.ts.map +1 -0
- package/dist/http/fulfillment/admin/shipping-profile.js +3 -0
- package/dist/http/fulfillment/admin/shipping-profile.js.map +1 -0
- package/dist/http/fulfillment/index.d.ts +2 -0
- package/dist/http/fulfillment/index.d.ts.map +1 -0
- package/dist/http/fulfillment/index.js +18 -0
- package/dist/http/fulfillment/index.js.map +1 -0
- package/dist/http/index.d.ts +3 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +19 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/stock-locations/common.d.ts +28 -0
- package/dist/http/stock-locations/common.d.ts.map +1 -0
- package/dist/http/stock-locations/common.js +3 -0
- package/dist/http/stock-locations/common.js.map +1 -0
- package/dist/http/stock-locations/index.d.ts +2 -0
- package/dist/http/stock-locations/index.d.ts.map +1 -0
- package/dist/http/stock-locations/index.js +18 -0
- package/dist/http/stock-locations/index.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/inventory/common/inventory-item.d.ts +55 -64
- package/dist/inventory/common/inventory-item.d.ts.map +1 -1
- package/dist/inventory/common/inventory-level.d.ts +37 -37
- package/dist/inventory/common/inventory-level.d.ts.map +1 -1
- package/dist/inventory/common/reservation-item.d.ts +34 -44
- package/dist/inventory/common/reservation-item.d.ts.map +1 -1
- package/dist/inventory/service-next.d.ts +596 -534
- package/dist/inventory/service-next.d.ts.map +1 -1
- package/dist/payment/common.d.ts +174 -53
- package/dist/payment/common.d.ts.map +1 -1
- package/dist/payment/common.js +3 -3
- package/dist/payment/common.js.map +1 -1
- package/dist/payment/mutations.d.ts +58 -17
- package/dist/payment/mutations.d.ts.map +1 -1
- package/dist/payment/provider.d.ts +128 -43
- package/dist/payment/provider.d.ts.map +1 -1
- package/dist/payment/provider.js.map +1 -1
- package/dist/payment/service.d.ts +460 -39
- package/dist/payment/service.d.ts.map +1 -1
- package/dist/pricing/common/price-list.d.ts +2 -2
- package/dist/pricing/common/price-set.d.ts +6 -4
- package/dist/pricing/common/price-set.d.ts.map +1 -1
- package/dist/pricing/service.d.ts +731 -1695
- package/dist/pricing/service.d.ts.map +1 -1
- package/dist/product/common.d.ts +4 -0
- package/dist/product/common.d.ts.map +1 -1
- package/dist/product-category/repository.d.ts +2 -1
- package/dist/product-category/repository.d.ts.map +1 -1
- package/dist/promotion/common/application-method.d.ts +153 -0
- package/dist/promotion/common/application-method.d.ts.map +1 -1
- package/dist/promotion/common/campaign-budget.d.ts +37 -0
- package/dist/promotion/common/campaign-budget.d.ts.map +1 -1
- package/dist/promotion/common/campaign.d.ts +36 -0
- package/dist/promotion/common/campaign.d.ts.map +1 -1
- package/dist/promotion/common/compute-actions.d.ts +135 -0
- package/dist/promotion/common/compute-actions.d.ts.map +1 -1
- package/dist/promotion/common/promotion-rule-value.d.ts +30 -0
- package/dist/promotion/common/promotion-rule-value.d.ts.map +1 -1
- package/dist/promotion/common/promotion-rule.d.ts +77 -0
- package/dist/promotion/common/promotion-rule.d.ts.map +1 -1
- package/dist/promotion/common/promotion.d.ts +100 -0
- package/dist/promotion/common/promotion.d.ts.map +1 -1
- package/dist/promotion/mutations.d.ts +84 -0
- package/dist/promotion/mutations.d.ts.map +1 -1
- package/dist/promotion/service.d.ts +786 -0
- package/dist/promotion/service.d.ts.map +1 -1
- package/dist/region/common.d.ts +9 -0
- package/dist/region/common.d.ts.map +1 -1
- package/dist/region/mutations.d.ts +11 -3
- package/dist/region/mutations.d.ts.map +1 -1
- package/dist/region/service.d.ts +210 -85
- package/dist/region/service.d.ts.map +1 -1
- package/dist/stock-location/common.d.ts +14 -0
- package/dist/stock-location/common.d.ts.map +1 -1
- package/dist/stock-location/service-next.d.ts +178 -186
- package/dist/stock-location/service-next.d.ts.map +1 -1
- package/dist/store/common/store.d.ts +42 -0
- package/dist/store/common/store.d.ts.map +1 -1
- package/dist/store/mutations/store.d.ts +75 -0
- package/dist/store/mutations/store.d.ts.map +1 -1
- package/dist/store/service.d.ts +113 -75
- package/dist/store/service.d.ts.map +1 -1
- package/dist/tax/common.d.ts +298 -10
- package/dist/tax/common.d.ts.map +1 -1
- package/dist/tax/mutations.d.ts +157 -0
- package/dist/tax/mutations.d.ts.map +1 -1
- package/dist/tax/provider.d.ts +126 -0
- package/dist/tax/provider.d.ts.map +1 -1
- package/dist/tax/service.d.ts +600 -0
- package/dist/tax/service.d.ts.map +1 -1
- package/dist/workflows/index.d.ts +2 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +18 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/stock-locations/index.d.ts +2 -0
- package/dist/workflows/stock-locations/index.d.ts.map +1 -0
- package/dist/workflows/stock-locations/index.js +18 -0
- package/dist/workflows/stock-locations/index.js.map +1 -0
- package/dist/workflows/stock-locations/mutations.d.ts +8 -0
- package/dist/workflows/stock-locations/mutations.d.ts.map +1 -0
- package/dist/workflows/stock-locations/mutations.js +3 -0
- package/dist/workflows/stock-locations/mutations.js.map +1 -0
- package/package.json +1 -1
@@ -4,231 +4,311 @@ import { FindConfig } from "../common";
|
|
4
4
|
import { IModuleService } from "../modules-sdk";
|
5
5
|
import { InventoryNext } from ".";
|
6
6
|
/**
|
7
|
-
* The main service interface for the
|
7
|
+
* The main service interface for the Inventory Module.
|
8
8
|
*/
|
9
9
|
export interface IInventoryServiceNext extends IModuleService {
|
10
10
|
/**
|
11
|
-
* This method
|
11
|
+
* This method retrieves a paginated list of inventory items based on optional filters and configuration.
|
12
|
+
*
|
12
13
|
* @param {FilterableInventoryItemProps} selector - The filters to apply on the retrieved inventory items.
|
13
|
-
* @param {FindConfig<InventoryItemDTO>} config -
|
14
|
-
* The configurations determining how the inventory items are retrieved. Its properties, such as `select` or `relations`, accept the
|
14
|
+
* @param {FindConfig<InventoryItemDTO>} config - The configurations determining how the inventory item is retrieved. Its properties, such as `select` or `relations`, accept the
|
15
15
|
* attributes or relations associated with a inventory item.
|
16
16
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
17
|
-
* @
|
17
|
+
* @returns {Promise<InventoryItemDTO[]>} The list of inventory items.
|
18
18
|
*
|
19
19
|
* @example
|
20
20
|
* To retrieve a list of inventory items using their IDs:
|
21
21
|
*
|
22
22
|
* ```ts
|
23
|
-
*
|
24
|
-
*
|
25
|
-
* }
|
26
|
-
*
|
27
|
-
* async function retrieveInventoryItems (ids: string[]) {
|
28
|
-
* const inventoryModule = await initializeInventoryModule({})
|
23
|
+
* const inventoryItems = await inventoryModuleService.list({
|
24
|
+
* id: ["iitem_123", "iitem_321"],
|
25
|
+
* })
|
26
|
+
* ```
|
29
27
|
*
|
30
|
-
*
|
31
|
-
* id: ids
|
32
|
-
* })
|
28
|
+
* To specify relations that should be retrieved within the inventory items:
|
33
29
|
*
|
34
|
-
*
|
35
|
-
*
|
30
|
+
* ```ts
|
31
|
+
* const inventoryItems = await inventoryModuleService.list(
|
32
|
+
* {
|
33
|
+
* id: ["iitem_123", "iitem_321"],
|
34
|
+
* },
|
35
|
+
* {
|
36
|
+
* relations: ["location_levels"],
|
37
|
+
* }
|
38
|
+
* )
|
36
39
|
* ```
|
37
40
|
*
|
38
|
-
*
|
41
|
+
* By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
39
42
|
*
|
40
43
|
* ```ts
|
41
|
-
*
|
42
|
-
*
|
43
|
-
*
|
44
|
+
* const inventoryItems = await inventoryModuleService.list(
|
45
|
+
* {
|
46
|
+
* id: ["iitem_123", "iitem_321"],
|
47
|
+
* },
|
48
|
+
* {
|
49
|
+
* relations: ["location_levels"],
|
50
|
+
* take: 20,
|
51
|
+
* skip: 2,
|
52
|
+
* }
|
53
|
+
* )
|
54
|
+
* ```
|
55
|
+
*/
|
56
|
+
list(selector: InventoryNext.FilterableInventoryItemProps, config?: FindConfig<InventoryNext.InventoryItemDTO>, context?: Context): Promise<InventoryNext.InventoryItemDTO[]>;
|
57
|
+
/**
|
58
|
+
* This method retrieves a paginated list of inventory items along with the total count of available inventory items satisfying the provided filters.
|
59
|
+
*
|
60
|
+
* @param {FilterableInventoryItemProps} selector - The filters to apply on the retrieved inventory items.
|
61
|
+
* @param {FindConfig<InventoryItemDTO>} config - The configurations determining how the inventory item is retrieved. Its properties, such as `select` or `relations`, accept the
|
62
|
+
* attributes or relations associated with a inventory item.
|
63
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
64
|
+
* @returns {Promise<[InventoryItemDTO[], number]>} The list of inventory items along with their total count.
|
44
65
|
*
|
45
|
-
*
|
46
|
-
*
|
66
|
+
* @example
|
67
|
+
* To retrieve a list of inventory items using their IDs:
|
47
68
|
*
|
48
|
-
*
|
49
|
-
*
|
50
|
-
*
|
51
|
-
*
|
69
|
+
* ```ts
|
70
|
+
* const [inventoryItems, count] =
|
71
|
+
* await inventoryModuleService.listAndCount({
|
72
|
+
* id: ["iitem_123", "iitem_321"],
|
52
73
|
* })
|
74
|
+
* ```
|
75
|
+
*
|
76
|
+
* To specify relations that should be retrieved within the inventory items:
|
53
77
|
*
|
54
|
-
*
|
55
|
-
*
|
78
|
+
* ```ts
|
79
|
+
* const [inventoryItems, count] =
|
80
|
+
* await inventoryModuleService.listAndCount(
|
81
|
+
* {
|
82
|
+
* id: ["iitem_123", "iitem_321"],
|
83
|
+
* },
|
84
|
+
* {
|
85
|
+
* relations: ["location_levels"],
|
86
|
+
* }
|
87
|
+
* )
|
56
88
|
* ```
|
57
89
|
*
|
58
90
|
* By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
59
91
|
*
|
60
92
|
* ```ts
|
61
|
-
*
|
62
|
-
*
|
63
|
-
*
|
64
|
-
*
|
65
|
-
*
|
66
|
-
*
|
67
|
-
*
|
68
|
-
*
|
69
|
-
*
|
70
|
-
*
|
71
|
-
*
|
72
|
-
* skip,
|
73
|
-
* take
|
74
|
-
* })
|
75
|
-
*
|
76
|
-
* // do something with the inventory items or return them
|
77
|
-
* }
|
93
|
+
* const [inventoryItems, count] =
|
94
|
+
* await inventoryModuleService.listAndCount(
|
95
|
+
* {
|
96
|
+
* id: ["iitem_123", "iitem_321"],
|
97
|
+
* },
|
98
|
+
* {
|
99
|
+
* relations: ["location_levels"],
|
100
|
+
* take: 20,
|
101
|
+
* skip: 2,
|
102
|
+
* }
|
103
|
+
* )
|
78
104
|
* ```
|
79
105
|
*/
|
80
|
-
list(selector: InventoryNext.FilterableInventoryItemProps, config?: FindConfig<InventoryNext.InventoryItemDTO>, context?: Context): Promise<InventoryNext.InventoryItemDTO[]>;
|
81
106
|
listAndCount(selector: InventoryNext.FilterableInventoryItemProps, config?: FindConfig<InventoryNext.InventoryItemDTO>, context?: Context): Promise<[InventoryNext.InventoryItemDTO[], number]>;
|
82
107
|
/**
|
83
|
-
* This method
|
108
|
+
* This method retrieves a paginated list of reservation items based on optional filters and configuration.
|
109
|
+
*
|
84
110
|
* @param {FilterableReservationItemProps} selector - The filters to apply on the retrieved reservation items.
|
85
|
-
* @param {FindConfig<ReservationItemDTO>} config -
|
86
|
-
* The configurations determining how the reservation items are retrieved. Its properties, such as `select` or `relations`, accept the
|
111
|
+
* @param {FindConfig<ReservationItemDTO>} config - The configurations determining how the reservation item is retrieved. Its properties, such as `select` or `relations`, accept the
|
87
112
|
* attributes or relations associated with a reservation item.
|
88
113
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
89
|
-
* @
|
114
|
+
* @returns {Promise<ReservationItemDTO[]>} The list of reservation items.
|
90
115
|
*
|
91
116
|
* @example
|
92
117
|
* To retrieve a list of reservation items using their IDs:
|
93
118
|
*
|
94
119
|
* ```ts
|
95
|
-
*
|
96
|
-
*
|
97
|
-
*
|
98
|
-
*
|
99
|
-
* async function retrieveReservationItems (ids: string[]) {
|
100
|
-
* const inventoryModule = await initializeInventoryModule({})
|
101
|
-
*
|
102
|
-
* const [reservationItems, count] = await inventoryModule.listReservationItems({
|
103
|
-
* id: ids
|
120
|
+
* const reservationItems =
|
121
|
+
* await inventoryModuleService.listReservationItems({
|
122
|
+
* id: ["resitem_123", "resitem_321"],
|
104
123
|
* })
|
105
|
-
*
|
106
|
-
* // do something with the reservation items or return them
|
107
|
-
* }
|
108
124
|
* ```
|
109
125
|
*
|
110
126
|
* To specify relations that should be retrieved within the reservation items:
|
111
127
|
*
|
112
128
|
* ```ts
|
113
|
-
*
|
114
|
-
*
|
115
|
-
*
|
129
|
+
* const reservationItems =
|
130
|
+
* await inventoryModuleService.listReservationItems(
|
131
|
+
* {
|
132
|
+
* id: ["resitem_123", "resitem_321"],
|
133
|
+
* },
|
134
|
+
* {
|
135
|
+
* relations: ["inventory_item"],
|
136
|
+
* }
|
137
|
+
* )
|
138
|
+
* ```
|
139
|
+
*
|
140
|
+
* By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
141
|
+
*
|
142
|
+
* ```ts
|
143
|
+
* const reservationItems =
|
144
|
+
* await inventoryModuleService.listReservationItems(
|
145
|
+
* {
|
146
|
+
* id: ["resitem_123", "resitem_321"],
|
147
|
+
* },
|
148
|
+
* {
|
149
|
+
* relations: ["inventory_item"],
|
150
|
+
* take: 20,
|
151
|
+
* skip: 2,
|
152
|
+
* }
|
153
|
+
* )
|
154
|
+
* ```
|
155
|
+
*/
|
156
|
+
listReservationItems(selector: InventoryNext.FilterableReservationItemProps, config?: FindConfig<InventoryNext.ReservationItemDTO>, context?: Context): Promise<InventoryNext.ReservationItemDTO[]>;
|
157
|
+
/**
|
158
|
+
* This method retrieves a paginated list of reservation items along with the total count of available reservation items satisfying the provided filters.
|
116
159
|
*
|
117
|
-
*
|
118
|
-
*
|
160
|
+
* @param {FilterableReservationItemProps} selector - The filters to apply on the retrieved reservation items.
|
161
|
+
* @param {FindConfig<ReservationItemDTO>} config - The configurations determining how the reservation item is retrieved. Its properties, such as `select` or `relations`, accept the
|
162
|
+
* attributes or relations associated with a reservation item.
|
163
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
164
|
+
* @returns {Promise<[ReservationItemDTO[], number]>} The list of reservation items along with their total count.
|
119
165
|
*
|
120
|
-
*
|
121
|
-
*
|
122
|
-
*
|
123
|
-
*
|
166
|
+
* @example
|
167
|
+
* To retrieve a list of reservation items using their IDs:
|
168
|
+
*
|
169
|
+
* ```ts
|
170
|
+
* const [reservationItems, count] =
|
171
|
+
* await inventoryModuleService.listAndCountReservationItems({
|
172
|
+
* id: ["resitem_123", "resitem_321"],
|
124
173
|
* })
|
174
|
+
* ```
|
175
|
+
*
|
176
|
+
* To specify relations that should be retrieved within the reservation items:
|
125
177
|
*
|
126
|
-
*
|
127
|
-
*
|
178
|
+
* ```ts
|
179
|
+
* const [reservationItems, count] =
|
180
|
+
* await inventoryModuleService.listAndCountReservationItems(
|
181
|
+
* {
|
182
|
+
* id: ["resitem_123", "resitem_321"],
|
183
|
+
* },
|
184
|
+
* {
|
185
|
+
* relations: ["inventory_item"],
|
186
|
+
* }
|
187
|
+
* )
|
128
188
|
* ```
|
129
189
|
*
|
130
190
|
* By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
131
191
|
*
|
132
192
|
* ```ts
|
133
|
-
*
|
134
|
-
*
|
135
|
-
*
|
136
|
-
*
|
137
|
-
*
|
138
|
-
*
|
139
|
-
*
|
140
|
-
*
|
141
|
-
*
|
142
|
-
*
|
143
|
-
*
|
144
|
-
* skip,
|
145
|
-
* take
|
146
|
-
* })
|
147
|
-
*
|
148
|
-
* // do something with the reservation items or return them
|
149
|
-
* }
|
193
|
+
* const [reservationItems, count] =
|
194
|
+
* await inventoryModuleService.listAndCountReservationItems(
|
195
|
+
* {
|
196
|
+
* id: ["resitem_123", "resitem_321"],
|
197
|
+
* },
|
198
|
+
* {
|
199
|
+
* relations: ["inventory_item"],
|
200
|
+
* take: 20,
|
201
|
+
* skip: 2,
|
202
|
+
* }
|
203
|
+
* )
|
150
204
|
* ```
|
151
205
|
*/
|
152
|
-
listReservationItems(selector: InventoryNext.FilterableReservationItemProps, config?: FindConfig<InventoryNext.ReservationItemDTO>, context?: Context): Promise<InventoryNext.ReservationItemDTO[]>;
|
153
206
|
listAndCountReservationItems(selector: InventoryNext.FilterableReservationItemProps, config?: FindConfig<InventoryNext.ReservationItemDTO>, context?: Context): Promise<[InventoryNext.ReservationItemDTO[], number]>;
|
154
207
|
/**
|
155
|
-
* This method
|
208
|
+
* This method retrieves a paginated list of inventory levels based on optional filters and configuration.
|
209
|
+
*
|
156
210
|
* @param {FilterableInventoryLevelProps} selector - The filters to apply on the retrieved inventory levels.
|
157
|
-
* @param {FindConfig<InventoryLevelDTO>} config -
|
158
|
-
* The configurations determining how the inventory levels are retrieved. Its properties, such as `select` or `relations`, accept the
|
211
|
+
* @param {FindConfig<InventoryLevelDTO>} config - The configurations determining how the inventory level is retrieved. Its properties, such as `select` or `relations`, accept the
|
159
212
|
* attributes or relations associated with a inventory level.
|
160
213
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
161
|
-
* @
|
214
|
+
* @returns {Promise<InventoryLevelDTO[]>} The list of inventory levels.
|
162
215
|
*
|
163
216
|
* @example
|
164
|
-
* To retrieve a list of inventory levels using their
|
217
|
+
* To retrieve a list of inventory levels using the IDs of their associated inventory items:
|
165
218
|
*
|
166
219
|
* ```ts
|
167
|
-
*
|
168
|
-
*
|
169
|
-
*
|
170
|
-
*
|
171
|
-
* async function retrieveInventoryLevels (inventoryItemIds: string[]) {
|
172
|
-
* const inventoryModule = await initializeInventoryModule({})
|
173
|
-
*
|
174
|
-
* const [inventoryLevels, count] = await inventoryModule.listInventoryLevels({
|
175
|
-
* inventory_item_id: inventoryItemIds
|
220
|
+
* const inventoryLevels =
|
221
|
+
* await inventoryModuleService.listInventoryLevels({
|
222
|
+
* inventory_item_id: ["iitem_123", "iitem_321"],
|
176
223
|
* })
|
177
|
-
*
|
178
|
-
* // do something with the inventory levels or return them
|
179
|
-
* }
|
180
224
|
* ```
|
181
225
|
*
|
182
226
|
* To specify relations that should be retrieved within the inventory levels:
|
183
227
|
*
|
184
228
|
* ```ts
|
185
|
-
*
|
186
|
-
*
|
187
|
-
*
|
229
|
+
* const inventoryLevels =
|
230
|
+
* await inventoryModuleService.listInventoryLevels(
|
231
|
+
* {
|
232
|
+
* inventory_item_id: ["iitem_123", "iitem_321"],
|
233
|
+
* },
|
234
|
+
* {
|
235
|
+
* relations: ["inventory_item"],
|
236
|
+
* }
|
237
|
+
* )
|
238
|
+
* ```
|
188
239
|
*
|
189
|
-
*
|
190
|
-
* const inventoryModule = await initializeInventoryModule({})
|
240
|
+
* By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
191
241
|
*
|
192
|
-
*
|
193
|
-
*
|
194
|
-
*
|
195
|
-
*
|
196
|
-
*
|
242
|
+
* ```ts
|
243
|
+
* const inventoryLevels =
|
244
|
+
* await inventoryModuleService.listInventoryLevels(
|
245
|
+
* {
|
246
|
+
* inventory_item_id: ["iitem_123", "iitem_321"],
|
247
|
+
* },
|
248
|
+
* {
|
249
|
+
* relations: ["inventory_item"],
|
250
|
+
* take: 20,
|
251
|
+
* skip: 2,
|
252
|
+
* }
|
253
|
+
* )
|
254
|
+
* ```
|
255
|
+
*/
|
256
|
+
listInventoryLevels(selector: InventoryNext.FilterableInventoryLevelProps, config?: FindConfig<InventoryNext.InventoryLevelDTO>, context?: Context): Promise<InventoryNext.InventoryLevelDTO[]>;
|
257
|
+
/**
|
258
|
+
* This method retrieves a paginated list of inventory levels along with the total count of available inventory levels satisfying the provided filters.
|
259
|
+
*
|
260
|
+
* @param {FilterableInventoryLevelProps} selector - The filters to apply on the retrieved inventory levels.
|
261
|
+
* @param {FindConfig<InventoryLevelDTO>} config - The configurations determining how the inventory level is retrieved. Its properties, such as `select` or `relations`, accept the
|
262
|
+
* attributes or relations associated with a inventory level.
|
263
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
264
|
+
* @returns {Promise<[InventoryLevelDTO[], number]>} The list of inventory levels along with their total count.
|
197
265
|
*
|
198
|
-
*
|
199
|
-
*
|
266
|
+
* @example
|
267
|
+
* To retrieve a list of inventory levels using the IDs of their associated inventory items:
|
268
|
+
*
|
269
|
+
* ```ts
|
270
|
+
* const [inventoryLevels, count] =
|
271
|
+
* await inventoryModuleService.listAndCountInventoryLevels(
|
272
|
+
* {
|
273
|
+
* inventory_item_id: ["iitem_123", "iitem_321"],
|
274
|
+
* },
|
275
|
+
* {
|
276
|
+
* relations: ["inventory_item"],
|
277
|
+
* take: 20,
|
278
|
+
* skip: 2,
|
279
|
+
* }
|
280
|
+
* )
|
281
|
+
* ```
|
282
|
+
*
|
283
|
+
* To specify relations that should be retrieved within the inventory levels:
|
284
|
+
*
|
285
|
+
* ```ts
|
286
|
+
* const [inventoryLevels, count] =
|
287
|
+
* await inventoryModuleService.listAndCountInventoryLevels(
|
288
|
+
* {
|
289
|
+
* inventory_item_id: ["iitem_123", "iitem_321"],
|
290
|
+
* },
|
291
|
+
* {
|
292
|
+
* relations: ["inventory_item"],
|
293
|
+
* }
|
294
|
+
* )
|
200
295
|
* ```
|
201
296
|
*
|
202
297
|
* By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
203
298
|
*
|
204
299
|
* ```ts
|
205
|
-
*
|
206
|
-
*
|
207
|
-
*
|
208
|
-
*
|
209
|
-
* async function retrieveInventoryLevels (inventoryItemIds: string[], skip: number, take: number) {
|
210
|
-
* const inventoryModule = await initializeInventoryModule({})
|
211
|
-
*
|
212
|
-
* const [inventoryLevels, count] = await inventoryModule.listInventoryLevels({
|
213
|
-
* inventory_item_id: inventoryItemIds
|
214
|
-
* }, {
|
215
|
-
* relations: ["inventory_item"],
|
216
|
-
* skip,
|
217
|
-
* take
|
300
|
+
* const [inventoryLevels, count] =
|
301
|
+
* await inventoryModuleService.listAndCountInventoryLevels({
|
302
|
+
* inventory_item_id: ["iitem_123", "iitem_321"],
|
218
303
|
* })
|
219
|
-
*
|
220
|
-
* // do something with the inventory levels or return them
|
221
|
-
* }
|
222
304
|
* ```
|
223
305
|
*/
|
224
|
-
listInventoryLevels(selector: InventoryNext.FilterableInventoryLevelProps, config?: FindConfig<InventoryNext.InventoryLevelDTO>, context?: Context): Promise<InventoryNext.InventoryLevelDTO[]>;
|
225
306
|
listAndCountInventoryLevels(selector: InventoryNext.FilterableInventoryLevelProps, config?: FindConfig<InventoryNext.InventoryLevelDTO>, context?: Context): Promise<[InventoryNext.InventoryLevelDTO[], number]>;
|
226
307
|
/**
|
227
|
-
* This method
|
308
|
+
* This method retrieves an inventory item by its ID.
|
228
309
|
*
|
229
|
-
* @param {string} inventoryItemId - The
|
230
|
-
* @param {FindConfig<InventoryItemDTO>} config -
|
231
|
-
* The configurations determining how the inventory item is retrieved. Its properties, such as `select` or `relations`, accept the
|
310
|
+
* @param {string} inventoryItemId - The inventory item's ID.
|
311
|
+
* @param {FindConfig<InventoryItemDTO>} config - The configurations determining how the inventory item is retrieved. Its properties, such as `select` or `relations`, accept the
|
232
312
|
* attributes or relations associated with a inventory item.
|
233
313
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
234
314
|
* @returns {Promise<InventoryItemDTO>} The retrieved inventory item.
|
@@ -237,579 +317,561 @@ export interface IInventoryServiceNext extends IModuleService {
|
|
237
317
|
* A simple example that retrieves a inventory item by its ID:
|
238
318
|
*
|
239
319
|
* ```ts
|
240
|
-
*
|
241
|
-
*
|
242
|
-
* } from "@medusajs/inventory"
|
243
|
-
*
|
244
|
-
* async function retrieveInventoryItem (id: string) {
|
245
|
-
* const inventoryModule = await initializeInventoryModule({})
|
246
|
-
*
|
247
|
-
* const inventoryItem = await inventoryModule.retrieveInventoryItem(id)
|
248
|
-
*
|
249
|
-
* // do something with the inventory item or return it
|
250
|
-
* }
|
320
|
+
* const inventoryItem =
|
321
|
+
* await inventoryModuleService.retrieve("iitem_123")
|
251
322
|
* ```
|
252
323
|
*
|
253
324
|
* To specify relations that should be retrieved:
|
254
325
|
*
|
255
326
|
* ```ts
|
256
|
-
*
|
257
|
-
*
|
258
|
-
*
|
259
|
-
*
|
260
|
-
*
|
261
|
-
*
|
262
|
-
*
|
263
|
-
* const inventoryItem = await inventoryModule.retrieveInventoryItem(id, {
|
264
|
-
* relations: ["inventory_level"]
|
265
|
-
* })
|
266
|
-
*
|
267
|
-
* // do something with the inventory item or return it
|
268
|
-
* }
|
327
|
+
* const inventoryItem = await inventoryModuleService.retrieve(
|
328
|
+
* "iitem_123",
|
329
|
+
* {
|
330
|
+
* relations: ["location_levels"],
|
331
|
+
* }
|
332
|
+
* )
|
269
333
|
* ```
|
270
334
|
*/
|
271
335
|
retrieve(inventoryItemId: string, config?: FindConfig<InventoryNext.InventoryItemDTO>, context?: Context): Promise<InventoryNext.InventoryItemDTO>;
|
272
336
|
/**
|
273
|
-
* This method
|
337
|
+
* This method retrieves an inventory level based on its associated inventory item and location.
|
274
338
|
*
|
275
|
-
* @param {string} inventoryItemId - The
|
276
|
-
* @param {string} locationId - The ID
|
339
|
+
* @param {string} inventoryItemId - The inventory item's ID.
|
340
|
+
* @param {string} locationId - The location's ID.
|
277
341
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
278
342
|
* @returns {Promise<InventoryLevelDTO>} The retrieved inventory level.
|
279
343
|
*
|
280
344
|
* @example
|
281
|
-
*
|
282
|
-
*
|
283
|
-
*
|
345
|
+
* const inventoryLevel =
|
346
|
+
* await inventoryModuleService.retrieveInventoryLevelByItemAndLocation(
|
347
|
+
* "iitem_123",
|
348
|
+
* "loc_123"
|
349
|
+
* )
|
350
|
+
*/
|
351
|
+
retrieveInventoryLevelByItemAndLocation(inventoryItemId: string, locationId: string, context?: Context): Promise<InventoryNext.InventoryLevelDTO>;
|
352
|
+
/**
|
353
|
+
* This method retrieves an inventory level by its ID.
|
354
|
+
*
|
355
|
+
* @param {string} inventoryLevelId - The inventory level's ID.
|
356
|
+
* @param {FindConfig<InventoryLevelDTO>} config - The configurations determining how the inventory level is retrieved. Its properties, such as `select` or `relations`, accept the
|
357
|
+
* attributes or relations associated with a inventory level.
|
358
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
359
|
+
* @returns {Promise<InventoryLevelDTO>} The retrieved inventory level.
|
284
360
|
*
|
285
|
-
*
|
286
|
-
*
|
287
|
-
* locationId: string
|
288
|
-
* ) {
|
289
|
-
* const inventoryModule = await initializeInventoryModule({})
|
361
|
+
* @example
|
362
|
+
* A simple example that retrieves a inventory level by its ID:
|
290
363
|
*
|
291
|
-
*
|
292
|
-
*
|
293
|
-
*
|
364
|
+
* ```ts
|
365
|
+
* const inventoryLevel =
|
366
|
+
* await inventoryModuleService.retrieveInventoryLevel(
|
367
|
+
* "iitem_123"
|
294
368
|
* )
|
369
|
+
* ```
|
295
370
|
*
|
296
|
-
*
|
297
|
-
*
|
371
|
+
* To specify relations that should be retrieved:
|
372
|
+
*
|
373
|
+
* ```ts
|
374
|
+
* const inventoryLevel =
|
375
|
+
* await inventoryModuleService.retrieveInventoryLevel(
|
376
|
+
* "iitem_123",
|
377
|
+
* {
|
378
|
+
* relations: ["inventory_item"],
|
379
|
+
* }
|
380
|
+
* )
|
381
|
+
* ```
|
298
382
|
*/
|
299
|
-
retrieveInventoryLevelByItemAndLocation(inventoryItemId: string, locationId: string, context?: Context): Promise<InventoryNext.InventoryLevelDTO>;
|
300
383
|
retrieveInventoryLevel(inventoryLevelId: string, config?: FindConfig<InventoryNext.InventoryLevelDTO>, context?: Context): Promise<InventoryNext.InventoryLevelDTO>;
|
301
384
|
/**
|
302
|
-
* This method
|
385
|
+
* This method retrieves a reservation item by its ID.
|
303
386
|
*
|
304
|
-
* @param {string} reservationId - The
|
387
|
+
* @param {string} reservationId - The reservation's ID.
|
388
|
+
* @param {FindConfig<ReservationItemDTO>} config - The configurations determining how the reservation item is retrieved. Its properties, such as `select` or `relations`, accept the
|
389
|
+
* attributes or relations associated with a reservation item.
|
305
390
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
306
391
|
* @returns {Promise<ReservationItemDTO>} The retrieved reservation item.
|
307
392
|
*
|
308
393
|
* @example
|
309
|
-
*
|
310
|
-
* initialize as initializeInventoryModule,
|
311
|
-
* } from "@medusajs/inventory"
|
394
|
+
* A simple example that retrieves a reservation item by its ID:
|
312
395
|
*
|
313
|
-
*
|
314
|
-
*
|
396
|
+
* ```ts
|
397
|
+
* const reservationItem =
|
398
|
+
* await inventoryModuleService.retrieveReservationItem(
|
399
|
+
* "resitem"
|
400
|
+
* )
|
401
|
+
* ```
|
315
402
|
*
|
316
|
-
*
|
403
|
+
* To specify relations that should be retrieved:
|
317
404
|
*
|
318
|
-
*
|
319
|
-
*
|
405
|
+
* ```ts
|
406
|
+
* const reservationItem =
|
407
|
+
* await inventoryModuleService.retrieveReservationItem(
|
408
|
+
* "resitem",
|
409
|
+
* {
|
410
|
+
* relations: ["inventory_item"],
|
411
|
+
* }
|
412
|
+
* )
|
413
|
+
* ```
|
320
414
|
*/
|
321
415
|
retrieveReservationItem(reservationId: string, config?: FindConfig<InventoryNext.ReservationItemDTO>, context?: Context): Promise<InventoryNext.ReservationItemDTO>;
|
322
416
|
/**
|
323
|
-
* This method
|
417
|
+
* This method creates reservation items.
|
324
418
|
*
|
325
|
-
* @param {CreateReservationItemInput[]} input - The details of the reservation items to
|
419
|
+
* @param {CreateReservationItemInput[]} input - The details of the reservation items to be created.
|
326
420
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
327
|
-
* @returns {
|
421
|
+
* @returns {Promise<ReservationItemDTO[]>} The created reservation items.
|
328
422
|
*
|
329
423
|
* @example
|
330
|
-
*
|
331
|
-
*
|
332
|
-
*
|
333
|
-
*
|
334
|
-
*
|
335
|
-
*
|
336
|
-
*
|
337
|
-
*
|
338
|
-
|
339
|
-
|
424
|
+
* const reservationItems =
|
425
|
+
* await inventoryModuleService.createReservationItems([
|
426
|
+
* {
|
427
|
+
* inventory_item_id: "iitem_123",
|
428
|
+
* location_id: "loc_123",
|
429
|
+
* quantity: 10,
|
430
|
+
* },
|
431
|
+
* ])
|
432
|
+
*/
|
433
|
+
createReservationItems(input: InventoryNext.CreateReservationItemInput[], context?: Context): Promise<InventoryNext.ReservationItemDTO[]>;
|
434
|
+
/**
|
435
|
+
* This method creates a reservation item.
|
340
436
|
*
|
341
|
-
*
|
342
|
-
*
|
343
|
-
*
|
437
|
+
* @param {CreateReservationItemInput} input - The details of the reservation item to be created.
|
438
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
439
|
+
* @returns {Promise<ReservationItemDTO>} The created reservation item.
|
344
440
|
*
|
345
|
-
*
|
346
|
-
*
|
441
|
+
* @example
|
442
|
+
* const reservationItem =
|
443
|
+
* await inventoryModuleService.createReservationItems({
|
444
|
+
* inventory_item_id: "iitem_123",
|
445
|
+
* location_id: "loc_123",
|
446
|
+
* quantity: 10,
|
447
|
+
* })
|
347
448
|
*/
|
348
|
-
createReservationItems(input: InventoryNext.CreateReservationItemInput[], context?: Context): Promise<InventoryNext.ReservationItemDTO[]>;
|
349
449
|
createReservationItems(input: InventoryNext.CreateReservationItemInput, context?: Context): Promise<InventoryNext.ReservationItemDTO>;
|
350
450
|
/**
|
351
|
-
* This method
|
451
|
+
* This method creates inventory items.
|
352
452
|
*
|
353
|
-
* @param {CreateInventoryItemInput[]} input - The details of the inventory items to
|
453
|
+
* @param {CreateInventoryItemInput[]} input - The details of the inventory items to be created.
|
354
454
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
355
|
-
* @returns {Promise<InventoryItemDTO[]>} The created inventory items
|
455
|
+
* @returns {Promise<InventoryItemDTO[]>} The created inventory items.
|
356
456
|
*
|
357
457
|
* @example
|
358
|
-
*
|
359
|
-
*
|
360
|
-
*
|
361
|
-
*
|
362
|
-
*
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
*
|
458
|
+
* const inventoryItems = await inventoryModuleService.create([
|
459
|
+
* {
|
460
|
+
* sku: "SHIRT",
|
461
|
+
* },
|
462
|
+
* ])
|
463
|
+
*/
|
464
|
+
create(input: InventoryNext.CreateInventoryItemInput[], context?: Context): Promise<InventoryNext.InventoryItemDTO[]>;
|
465
|
+
/**
|
466
|
+
* This method creates an inventory item.
|
367
467
|
*
|
368
|
-
*
|
369
|
-
*
|
370
|
-
*
|
468
|
+
* @param {CreateInventoryItemInput} input - The details of the inventory item to be created.
|
469
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
470
|
+
* @returns {Promise<InventoryItemDTO>} The created inventory item.
|
371
471
|
*
|
372
|
-
*
|
373
|
-
*
|
472
|
+
* @example
|
473
|
+
* const inventoryItem = await inventoryModuleService.create({
|
474
|
+
* sku: "SHIRT",
|
475
|
+
* })
|
374
476
|
*/
|
375
|
-
create(input: InventoryNext.CreateInventoryItemInput[], context?: Context): Promise<InventoryNext.InventoryItemDTO[]>;
|
376
477
|
create(input: InventoryNext.CreateInventoryItemInput, context?: Context): Promise<InventoryNext.InventoryItemDTO>;
|
377
478
|
/**
|
378
|
-
* This method
|
479
|
+
* This method creates inventory levels.
|
379
480
|
*
|
380
|
-
* @param {CreateInventoryLevelInput[]} data - The details of the inventory levels to
|
481
|
+
* @param {CreateInventoryLevelInput[]} data - The details of the inventory levels to be created.
|
381
482
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
382
|
-
* @returns {Promise<InventoryLevelDTO[]>} The created inventory levels
|
483
|
+
* @returns {Promise<InventoryLevelDTO[]>} The created inventory levels.
|
383
484
|
*
|
384
485
|
* @example
|
385
|
-
*
|
386
|
-
*
|
387
|
-
*
|
388
|
-
*
|
389
|
-
*
|
390
|
-
*
|
391
|
-
*
|
392
|
-
*
|
393
|
-
*
|
394
|
-
*
|
486
|
+
* const inventoryLevels =
|
487
|
+
* await inventoryModuleService.createInventoryLevels([
|
488
|
+
* {
|
489
|
+
* inventory_item_id: "iitem_123",
|
490
|
+
* location_id: "loc_123",
|
491
|
+
* stocked_quantity: 10,
|
492
|
+
* },
|
493
|
+
* {
|
494
|
+
* inventory_item_id: "iitem_321",
|
495
|
+
* location_id: "loc_321",
|
496
|
+
* stocked_quantity: 20,
|
497
|
+
* reserved_quantity: 10,
|
498
|
+
* },
|
499
|
+
* ])
|
500
|
+
*/
|
501
|
+
createInventoryLevels(data: InventoryNext.CreateInventoryLevelInput[], context?: Context): Promise<InventoryNext.InventoryLevelDTO[]>;
|
502
|
+
/**
|
503
|
+
* This method creates an inventory level.
|
395
504
|
*
|
396
|
-
*
|
397
|
-
*
|
398
|
-
*
|
505
|
+
* @param {CreateInventoryLevelInput} data - The details of the inventory level to be created.
|
506
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
507
|
+
* @returns {Promise<InventoryLevelDTO>} The created inventory level.
|
399
508
|
*
|
400
|
-
*
|
401
|
-
*
|
509
|
+
* @example
|
510
|
+
* const inventoryLevels =
|
511
|
+
* await inventoryModuleService.createInventoryLevels({
|
512
|
+
* inventory_item_id: "iitem_123",
|
513
|
+
* location_id: "loc_123",
|
514
|
+
* stocked_quantity: 10,
|
515
|
+
* })
|
402
516
|
*/
|
403
|
-
createInventoryLevels(data: InventoryNext.CreateInventoryLevelInput[], context?: Context): Promise<InventoryNext.InventoryLevelDTO[]>;
|
404
517
|
createInventoryLevels(data: InventoryNext.CreateInventoryLevelInput, context?: Context): Promise<InventoryNext.InventoryLevelDTO>;
|
405
518
|
/**
|
406
|
-
* This method
|
519
|
+
* This method updates existing inventory levels.
|
407
520
|
*
|
408
|
-
* @param {BulkUpdateInventoryLevelInput} updates - The attributes to update in
|
521
|
+
* @param {BulkUpdateInventoryLevelInput[]} updates - The list of The attributes to update in an inventory level. The inventory level is identified by the IDs of its associated inventory item and location.
|
409
522
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
410
|
-
* @returns {Promise<InventoryLevelDTO[]>} The updated inventory levels
|
523
|
+
* @returns {Promise<InventoryLevelDTO[]>} The updated inventory levels.
|
411
524
|
*
|
412
525
|
* @example
|
413
|
-
*
|
414
|
-
*
|
415
|
-
*
|
416
|
-
*
|
417
|
-
*
|
418
|
-
*
|
419
|
-
*
|
420
|
-
*
|
421
|
-
*
|
422
|
-
|
526
|
+
* const inventoryLevels =
|
527
|
+
* await inventoryModuleService.updateInventoryLevels([
|
528
|
+
* {
|
529
|
+
* inventory_item_id: "iitem_123",
|
530
|
+
* location_id: "loc_123",
|
531
|
+
* id: "ilev_123",
|
532
|
+
* stocked_quantity: 20,
|
533
|
+
* },
|
534
|
+
* ])
|
535
|
+
*/
|
536
|
+
updateInventoryLevels(updates: InventoryNext.BulkUpdateInventoryLevelInput[], context?: Context): Promise<InventoryNext.InventoryLevelDTO[]>;
|
537
|
+
/**
|
538
|
+
* This method updates an existing inventory level.
|
423
539
|
*
|
424
|
-
*
|
425
|
-
*
|
426
|
-
*
|
540
|
+
* @param {BulkUpdateInventoryLevelInput} updates - The attributes to update in an inventory level. The inventory level is identified by the IDs of its associated inventory item and location.
|
541
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
542
|
+
* @returns {Promise<InventoryLevelDTO>} The updated inventory level.
|
427
543
|
*
|
428
|
-
*
|
429
|
-
*
|
544
|
+
* @example
|
545
|
+
* const inventoryLevel =
|
546
|
+
* await inventoryModuleService.updateInventoryLevels({
|
547
|
+
* inventory_item_id: "iitem_123",
|
548
|
+
* location_id: "loc_123",
|
549
|
+
* stocked_quantity: 20,
|
550
|
+
* })
|
430
551
|
*/
|
431
|
-
updateInventoryLevels(updates: InventoryNext.BulkUpdateInventoryLevelInput[], context?: Context): Promise<InventoryNext.InventoryLevelDTO[]>;
|
432
552
|
updateInventoryLevels(updates: InventoryNext.BulkUpdateInventoryLevelInput, context?: Context): Promise<InventoryNext.InventoryLevelDTO>;
|
433
553
|
/**
|
434
|
-
* This method
|
554
|
+
* This method updates an existing inventory item.
|
435
555
|
*
|
436
|
-
* @param {
|
437
|
-
* @param {Partial<CreateInventoryItemInput>} input - The attributes to update in the inventory item.
|
556
|
+
* @param {UpdateInventoryItemInput} input - The attributes to update in the inventory item.
|
438
557
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
439
|
-
* @returns {Promise<InventoryItemDTO>} The updated inventory item
|
558
|
+
* @returns {Promise<InventoryItemDTO>} The updated inventory item.
|
440
559
|
*
|
441
560
|
* @example
|
442
|
-
*
|
443
|
-
*
|
444
|
-
*
|
445
|
-
*
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
*
|
450
|
-
* const inventoryModule = await initializeInventoryModule({})
|
561
|
+
* const inventoryItem = await inventoryModuleService.update({
|
562
|
+
* id: "iitem_123",
|
563
|
+
* title: "Medusa Shirt Inventory",
|
564
|
+
* })
|
565
|
+
*/
|
566
|
+
update(input: InventoryNext.UpdateInventoryItemInput, context?: Context): Promise<InventoryNext.InventoryItemDTO>;
|
567
|
+
/**
|
568
|
+
* This method updates existing inventory items.
|
451
569
|
*
|
452
|
-
*
|
453
|
-
*
|
454
|
-
*
|
455
|
-
* sku
|
456
|
-
* }
|
457
|
-
* )
|
570
|
+
* @param {UpdateInventoryItemInput[]} input - The attributes to update in the inventory items.
|
571
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
572
|
+
* @returns {Promise<InventoryItemDTO[]>} The updated inventory items.
|
458
573
|
*
|
459
|
-
*
|
460
|
-
*
|
574
|
+
* @example
|
575
|
+
* const inventoryItems = await inventoryModuleService.update([
|
576
|
+
* {
|
577
|
+
* id: "iitem_123",
|
578
|
+
* title: "Medusa Shirt Inventory",
|
579
|
+
* },
|
580
|
+
* {
|
581
|
+
* id: "iitem_321",
|
582
|
+
* description: "The inventory of Medusa pants",
|
583
|
+
* },
|
584
|
+
* ])
|
461
585
|
*/
|
462
|
-
update(input: InventoryNext.UpdateInventoryItemInput, context?: Context): Promise<InventoryNext.InventoryItemDTO>;
|
463
586
|
update(input: InventoryNext.UpdateInventoryItemInput[], context?: Context): Promise<InventoryNext.InventoryItemDTO[]>;
|
464
587
|
/**
|
465
|
-
* This method
|
588
|
+
* This method updates an existing reservation item.
|
466
589
|
*
|
467
|
-
* @param {
|
468
|
-
* @param {UpdateReservationItemInput} input - The attributes to update in the reservation item.
|
590
|
+
* @param {UpdateReservationItemInput} input - The attributes to update in a reservation item.
|
469
591
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
470
592
|
* @returns {Promise<ReservationItemDTO>} The updated reservation item.
|
471
593
|
*
|
472
594
|
* @example
|
473
|
-
*
|
474
|
-
*
|
475
|
-
*
|
595
|
+
* const reservationItem =
|
596
|
+
* await inventoryModuleService.updateReservationItems({
|
597
|
+
* id: "resitem_123",
|
598
|
+
* quantity: 10,
|
599
|
+
* })
|
600
|
+
*/
|
601
|
+
updateReservationItems(input: InventoryNext.UpdateReservationItemInput, context?: Context): Promise<InventoryNext.ReservationItemDTO>;
|
602
|
+
/**
|
603
|
+
* This method updates existing reservation items.
|
476
604
|
*
|
477
|
-
*
|
478
|
-
*
|
479
|
-
*
|
480
|
-
* ) {
|
481
|
-
* const inventoryModule = await initializeInventoryModule({})
|
605
|
+
* @param {UpdateReservationItemInput[]} input - The attributes to update in the reservation items.
|
606
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
607
|
+
* @returns {Promise<ReservationItemDTO[]>} The updated reservation items.
|
482
608
|
*
|
483
|
-
*
|
484
|
-
*
|
609
|
+
* @example
|
610
|
+
* const reservationItems =
|
611
|
+
* await inventoryModuleService.updateReservationItems([
|
485
612
|
* {
|
486
|
-
*
|
487
|
-
*
|
488
|
-
*
|
489
|
-
*
|
490
|
-
* // do something with the reservation item or return it
|
491
|
-
* }
|
613
|
+
* id: "resitem_123",
|
614
|
+
* quantity: 10,
|
615
|
+
* },
|
616
|
+
* ])
|
492
617
|
*/
|
493
|
-
updateReservationItems(input: InventoryNext.UpdateReservationItemInput, context?: Context): Promise<InventoryNext.ReservationItemDTO>;
|
494
618
|
updateReservationItems(input: InventoryNext.UpdateReservationItemInput[], context?: Context): Promise<InventoryNext.ReservationItemDTO[]>;
|
495
619
|
/**
|
496
|
-
* This method
|
620
|
+
* This method deletes a reservation item by its associated line item.
|
497
621
|
*
|
498
|
-
* @param {string | string[]} lineItemId - The
|
499
|
-
* @param {Context} context - A context used to share
|
500
|
-
* @returns {Promise<void>} Resolves when the reservation
|
622
|
+
* @param {string | string[]} lineItemId - The line item's ID.
|
623
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
624
|
+
* @returns {Promise<void>} Resolves when the reservation item is deleted.
|
501
625
|
*
|
502
626
|
* @example
|
503
|
-
*
|
504
|
-
*
|
505
|
-
*
|
506
|
-
*
|
507
|
-
* async function deleteReservationItemsByLineItem (
|
508
|
-
* lineItemIds: string[]
|
509
|
-
* ) {
|
510
|
-
* const inventoryModule = await initializeInventoryModule({})
|
511
|
-
*
|
512
|
-
* await inventoryModule.deleteReservationItemsByLineItem(
|
513
|
-
* lineItemIds
|
514
|
-
* )
|
515
|
-
* }
|
627
|
+
* await inventoryModuleService.deleteReservationItemByLocationId(
|
628
|
+
* "cali_123"
|
629
|
+
* )
|
516
630
|
*/
|
517
631
|
deleteReservationItemsByLineItem(lineItemId: string | string[], context?: Context): Promise<void>;
|
518
632
|
/**
|
519
|
-
* This method
|
633
|
+
* This method deletes reservation items by their IDs.
|
520
634
|
*
|
521
|
-
* @param {string | string[]} reservationItemId - The
|
635
|
+
* @param {string | string[]} reservationItemId - The reservation items' IDs.
|
522
636
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
523
|
-
* @returns {Promise<void>} Resolves when the reservation item
|
637
|
+
* @returns {Promise<void>} Resolves when the reservation item is deleted.
|
524
638
|
*
|
525
639
|
* @example
|
526
|
-
*
|
527
|
-
*
|
528
|
-
*
|
529
|
-
*
|
530
|
-
* async function deleteReservationItems (
|
531
|
-
* reservationItemIds: string[]
|
532
|
-
* ) {
|
533
|
-
* const inventoryModule = await initializeInventoryModule({})
|
534
|
-
*
|
535
|
-
* await inventoryModule.deleteReservationItem(
|
536
|
-
* reservationItemIds
|
537
|
-
* )
|
538
|
-
* }
|
640
|
+
* await inventoryModuleService.deleteReservationItems(
|
641
|
+
* "resitem_123"
|
642
|
+
* )
|
539
643
|
*/
|
540
644
|
deleteReservationItems(reservationItemId: string | string[], context?: Context): Promise<void>;
|
541
645
|
/**
|
542
|
-
* This method
|
543
|
-
* {@link restoreInventoryItem} method.
|
646
|
+
* This method deletes inventory items by their IDs.
|
544
647
|
*
|
545
|
-
* @param {string | string[]} inventoryItemId - The
|
648
|
+
* @param {string | string[]} inventoryItemId - The inventory item's ID.
|
546
649
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
547
|
-
* @returns {Promise<void>} Resolves when the inventory
|
650
|
+
* @returns {Promise<void>} Resolves when the inventory items are deleted.
|
548
651
|
*
|
549
652
|
* @example
|
550
|
-
*
|
551
|
-
* initialize as initializeInventoryModule,
|
552
|
-
* } from "@medusajs/inventory"
|
553
|
-
*
|
554
|
-
* async function deleteInventoryItem (
|
555
|
-
* inventoryItems: string[]
|
556
|
-
* ) {
|
557
|
-
* const inventoryModule = await initializeInventoryModule({})
|
558
|
-
*
|
559
|
-
* await inventoryModule.deleteInventoryItem(
|
560
|
-
* inventoryItems
|
561
|
-
* )
|
562
|
-
* }
|
653
|
+
* await inventoryModuleService.delete("iitem_123")
|
563
654
|
*/
|
564
655
|
delete(inventoryItemId: string | string[], context?: Context): Promise<void>;
|
565
656
|
/**
|
566
|
-
*
|
567
|
-
*
|
568
|
-
* @param
|
569
|
-
* @param
|
657
|
+
* This method soft deletes inventory items by their IDs.
|
658
|
+
*
|
659
|
+
* @param {string[]} inventoryItemIds - The inventory items' IDs.
|
660
|
+
* @param {SoftDeleteReturn<TReturnableLinkableKeys>} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
|
661
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
662
|
+
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were also soft deleted, such as the ID of the associated location levels.
|
663
|
+
* The object's keys are the ID attribute names of the inventory service next entity's relations, such as `location_level_id`, and its value is an array of strings, each being the ID of a record associated
|
664
|
+
* with the inventory item through this relation, such as the IDs of associated location levels.
|
665
|
+
*
|
666
|
+
* If there are no related records, the promise resolves to `void`.
|
667
|
+
*
|
668
|
+
* @example
|
669
|
+
* await inventoryModuleService.softDelete(
|
670
|
+
* ["iitem_123", "iitem_321"],
|
671
|
+
* {
|
672
|
+
* returnLinkableKeys: ["location_level"],
|
673
|
+
* }
|
674
|
+
* )
|
570
675
|
*/
|
571
676
|
softDelete<TReturnableLinkableKeys extends string = string>(inventoryItemIds: string[], config?: SoftDeleteReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
572
677
|
/**
|
573
|
-
* This method
|
678
|
+
* This method restores soft deleted inventory items by their IDs.
|
574
679
|
*
|
575
|
-
* @param {string[]}
|
576
|
-
* @param {RestoreReturn<TReturnableLinkableKeys>} config -
|
577
|
-
*
|
578
|
-
* @
|
680
|
+
* @param {string[]} inventoryItemIds - The inventory items' IDs.
|
681
|
+
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the inventory items. You can pass to its `returnLinkableKeys`
|
682
|
+
* property any of the inventory item's relation attribute names, such as `location_levels`.
|
683
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
684
|
+
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were restored, such as the ID of associated location levels.
|
685
|
+
* The object's keys are the ID attribute names of the inventory item entity's relations, such as `location_level_id`,
|
686
|
+
* and its value is an array of strings, each being the ID of the record associated with the inventory item through this relation,
|
687
|
+
* such as the IDs of associated location levels.
|
579
688
|
*
|
580
|
-
*
|
581
|
-
* import {
|
582
|
-
* initialize as initializeInventoryModule,
|
583
|
-
* } from "@medusajs/inventory"
|
584
|
-
*
|
585
|
-
* async function restoreInventoryItem (
|
586
|
-
* inventoryItems: string[]
|
587
|
-
* ) {
|
588
|
-
* const inventoryModule = await initializeInventoryModule({})
|
689
|
+
* If there are no related records restored, the promise resolves to `void`.
|
589
690
|
*
|
590
|
-
*
|
591
|
-
*
|
592
|
-
*
|
593
|
-
*
|
691
|
+
* @example
|
692
|
+
* await inventoryModuleService.restore(
|
693
|
+
* ["iitem_123", "iitem_321"],
|
694
|
+
* {
|
695
|
+
* returnLinkableKeys: ["location_level"],
|
696
|
+
* }
|
697
|
+
* )
|
594
698
|
*/
|
595
699
|
restore<TReturnableLinkableKeys extends string = string>(inventoryItemIds: string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
596
700
|
/**
|
597
|
-
* This method deletes
|
701
|
+
* This method soft deletes inventory item's level by the associated location.
|
598
702
|
*
|
599
|
-
* @param {string | string[]} locationId - The
|
703
|
+
* @param {string | string[]} locationId - The locations' IDs.
|
600
704
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
601
|
-
* @returns {Promise<
|
705
|
+
* @returns {Promise<[object[], Record<string, unknown[]>]>} An array, where the first item is an array includes the soft-deleted inventory levels,
|
706
|
+
* and the second is an object that includes the IDs of related records that were soft-deleted.
|
602
707
|
*
|
603
708
|
* @example
|
604
|
-
*
|
605
|
-
*
|
606
|
-
*
|
607
|
-
*
|
608
|
-
* async function deleteInventoryItemLevelByLocationId (
|
609
|
-
* locationIds: string[]
|
610
|
-
* ) {
|
611
|
-
* const inventoryModule = await initializeInventoryModule({})
|
612
|
-
*
|
613
|
-
* await inventoryModule.deleteInventoryItemLevelByLocationId(
|
614
|
-
* locationIds
|
615
|
-
* )
|
616
|
-
* }
|
709
|
+
* await inventoryModuleService.deleteInventoryItemLevelByLocationId(
|
710
|
+
* "loc_123"
|
711
|
+
* )
|
617
712
|
*/
|
618
713
|
deleteInventoryItemLevelByLocationId(locationId: string | string[], context?: Context): Promise<[object[], Record<string, unknown[]>]>;
|
619
714
|
/**
|
620
|
-
* This method deletes reservation
|
715
|
+
* This method deletes reservation items by their associated location.
|
621
716
|
*
|
622
|
-
* @param {string | string[]} locationId - The
|
717
|
+
* @param {string | string[]} locationId - The location's ID.
|
623
718
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
624
|
-
* @returns {Promise<void>} Resolves when
|
719
|
+
* @returns {Promise<void>} Resolves when then reservation items are deleted successfully.
|
625
720
|
*
|
626
721
|
* @example
|
627
|
-
*
|
628
|
-
*
|
629
|
-
*
|
630
|
-
*
|
631
|
-
* async function deleteReservationItemByLocationId (
|
632
|
-
* locationIds: string[]
|
633
|
-
* ) {
|
634
|
-
* const inventoryModule = await initializeInventoryModule({})
|
635
|
-
*
|
636
|
-
* await inventoryModule.deleteReservationItemByLocationId(
|
637
|
-
* locationIds
|
638
|
-
* )
|
639
|
-
* }
|
722
|
+
* await inventoryModuleService.deleteReservationItemByLocationId(
|
723
|
+
* "loc_123"
|
724
|
+
* )
|
640
725
|
*/
|
641
726
|
deleteReservationItemByLocationId(locationId: string | string[], context?: Context): Promise<void>;
|
642
727
|
/**
|
643
|
-
* This method
|
728
|
+
* This method deletes an inventory level by its associated inventory item and location.
|
644
729
|
*
|
645
|
-
* @param {string} inventoryItemId - The
|
646
|
-
* @param {string} locationId - The ID
|
730
|
+
* @param {string} inventoryItemId - The inventory item's ID.
|
731
|
+
* @param {string} locationId - The location's ID.
|
647
732
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
648
|
-
* @returns {Promise<void>} Resolves when the inventory level
|
733
|
+
* @returns {Promise<void>} Resolves when the inventory level is deleted successfully.
|
649
734
|
*
|
650
735
|
* @example
|
651
|
-
*
|
652
|
-
*
|
653
|
-
*
|
736
|
+
* await inventoryModuleService.deleteInventoryLevel(
|
737
|
+
* "iitem_123",
|
738
|
+
* "loc_123"
|
739
|
+
* )
|
740
|
+
*/
|
741
|
+
deleteInventoryLevel(inventoryItemId: string, locationId: string, context?: Context): Promise<void>;
|
742
|
+
/**
|
743
|
+
* This method deletes inventory levels by their IDs.
|
654
744
|
*
|
655
|
-
*
|
656
|
-
*
|
657
|
-
*
|
658
|
-
* ) {
|
659
|
-
* const inventoryModule = await initializeInventoryModule({})
|
745
|
+
* @param {string | string[]} inventoryLevelIds - The inventory levels' IDs.
|
746
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
747
|
+
* @returns {Promise<void>} Resolves when the inventory levels are deleted.
|
660
748
|
*
|
661
|
-
*
|
662
|
-
*
|
663
|
-
* locationId
|
664
|
-
* )
|
665
|
-
* }
|
749
|
+
* @example
|
750
|
+
* await inventoryModuleService.deleteInventoryLevels("ilev_123")
|
666
751
|
*/
|
667
|
-
deleteInventoryLevel(inventoryItemId: string, locationId: string, context?: Context): Promise<void>;
|
668
752
|
deleteInventoryLevels(inventoryLevelIds: string | string[], context?: Context): Promise<void>;
|
753
|
+
/**
|
754
|
+
* This method soft deletes inventory levels by their IDs.
|
755
|
+
*
|
756
|
+
* @param {string[]} inventoryLevelIds - The inventory levels' IDs.
|
757
|
+
* @param {SoftDeleteReturn<TReturnableLinkableKeys>} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
|
758
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
759
|
+
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were also soft deleted.
|
760
|
+
* If there are no related records, the promise resolves to `void`.
|
761
|
+
*
|
762
|
+
* @example
|
763
|
+
* await inventoryModuleService.softDeleteInventoryLevels([
|
764
|
+
* "ilev_123",
|
765
|
+
* ])
|
766
|
+
*/
|
669
767
|
softDeleteInventoryLevels<TReturnableLinkableKeys extends string = string>(inventoryLevelIds: string[], config?: SoftDeleteReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
670
|
-
restoreInventoryLevels<TReturnableLinkableKeys extends string = string>(inventoryLevelIds: string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
671
768
|
/**
|
672
|
-
* This method
|
769
|
+
* This method restores soft deleted inventory levels by their IDs.
|
673
770
|
*
|
674
|
-
* @param {string}
|
675
|
-
* @param {
|
676
|
-
*
|
677
|
-
* @param {Context}
|
678
|
-
* @returns {Promise<
|
771
|
+
* @param {string[]} inventoryLevelIds - The inventory levels' IDs.
|
772
|
+
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the inventory level. You can pass to its `returnLinkableKeys`
|
773
|
+
* property any of the inventory level's relation attribute names, such as `{type relation name}`.
|
774
|
+
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
775
|
+
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were restored.
|
776
|
+
* If there are no related records restored, the promise resolves to `void`.
|
679
777
|
*
|
680
778
|
* @example
|
681
|
-
*
|
682
|
-
*
|
683
|
-
*
|
779
|
+
* await inventoryModuleService.restoreInventoryLevels([
|
780
|
+
* "ilev_123",
|
781
|
+
* ])
|
782
|
+
*/
|
783
|
+
restoreInventoryLevels<TReturnableLinkableKeys extends string = string>(inventoryLevelIds: string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
784
|
+
/**
|
785
|
+
* This method adjusts the inventory quantity of an item in a location.
|
684
786
|
*
|
685
|
-
*
|
686
|
-
*
|
687
|
-
*
|
688
|
-
*
|
689
|
-
*
|
690
|
-
* const inventoryModule = await initializeInventoryModule({})
|
787
|
+
* @param {string} inventoryItemId - The inventory item's ID.
|
788
|
+
* @param {string} locationId - The location's ID.
|
789
|
+
* @param {number} adjustment - the adjustment to make to the quantity.
|
790
|
+
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
791
|
+
* @returns {Promise<InventoryLevelDTO>} The updated inventory level.
|
691
792
|
*
|
692
|
-
*
|
693
|
-
*
|
694
|
-
*
|
695
|
-
*
|
793
|
+
* @example
|
794
|
+
* // add to the inventory quantity
|
795
|
+
* const inventoryLevel1 =
|
796
|
+
* await inventoryModuleService.adjustInventory(
|
797
|
+
* "iitem_123",
|
798
|
+
* "loc_123",
|
799
|
+
* 5
|
696
800
|
* )
|
697
801
|
*
|
698
|
-
*
|
699
|
-
*
|
802
|
+
* // subtract from the inventory quantity
|
803
|
+
* const inventoryLevel2 =
|
804
|
+
* await inventoryModuleService.adjustInventory(
|
805
|
+
* "iitem_123",
|
806
|
+
* "loc_123",
|
807
|
+
* -5
|
808
|
+
* )
|
700
809
|
*/
|
701
810
|
adjustInventory(inventoryItemId: string, locationId: string, adjustment: number, context?: Context): Promise<InventoryNext.InventoryLevelDTO>;
|
702
811
|
/**
|
703
|
-
* This method
|
812
|
+
* This method confirms that a quantity is available of an inventory item in the specified locations.
|
704
813
|
*
|
705
|
-
* @param {string} inventoryItemId - The
|
706
|
-
* @param {string[]} locationIds - The
|
707
|
-
* @param {number} quantity - The quantity to
|
814
|
+
* @param {string} inventoryItemId - The inventory item's ID.
|
815
|
+
* @param {string[]} locationIds - The locations' IDs.
|
816
|
+
* @param {number} quantity - The quantity to confirm its availability.
|
708
817
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
709
|
-
* @returns {Promise<boolean>} Whether the
|
818
|
+
* @returns {Promise<boolean>} Whether the quantity is available.
|
710
819
|
*
|
711
820
|
* @example
|
712
|
-
*
|
713
|
-
*
|
714
|
-
*
|
715
|
-
*
|
716
|
-
*
|
717
|
-
* inventoryItemId: string,
|
718
|
-
* locationIds: string[],
|
719
|
-
* quantity: number
|
720
|
-
* ) {
|
721
|
-
* const inventoryModule = await initializeInventoryModule({})
|
722
|
-
*
|
723
|
-
* return await inventoryModule.confirmInventory(
|
724
|
-
* inventoryItemId,
|
725
|
-
* locationIds,
|
726
|
-
* quantity
|
821
|
+
* const isAvailable =
|
822
|
+
* await inventoryModuleService.confirmInventory(
|
823
|
+
* "iitem_123",
|
824
|
+
* ["loc_123", "loc_321"],
|
825
|
+
* 10
|
727
826
|
* )
|
728
|
-
* }
|
729
827
|
*/
|
730
828
|
confirmInventory(inventoryItemId: string, locationIds: string[], quantity: number, context?: Context): Promise<boolean>;
|
731
829
|
/**
|
732
|
-
* This method
|
830
|
+
* This method retrieves the available quantity of an inventory item in the specified locations.
|
733
831
|
*
|
734
|
-
* @param {string} inventoryItemId - The
|
735
|
-
* @param {string[]} locationIds - The
|
832
|
+
* @param {string} inventoryItemId - The inventory item's ID.
|
833
|
+
* @param {string[]} locationIds - The locations' IDs.
|
736
834
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
737
|
-
* @returns {Promise<number>} The available quantity of the
|
835
|
+
* @returns {Promise<number>} The available quantity of the item.
|
738
836
|
*
|
739
837
|
* @example
|
740
|
-
*
|
741
|
-
*
|
742
|
-
*
|
743
|
-
*
|
744
|
-
* async function retrieveAvailableQuantity (
|
745
|
-
* inventoryItemId: string,
|
746
|
-
* locationIds: string[],
|
747
|
-
* ) {
|
748
|
-
* const inventoryModule = await initializeInventoryModule({})
|
749
|
-
*
|
750
|
-
* const quantity = await inventoryModule.retrieveAvailableQuantity(
|
751
|
-
* inventoryItemId,
|
752
|
-
* locationIds,
|
838
|
+
* const availableQuantity =
|
839
|
+
* await inventoryModuleService.retrieveAvailableQuantity(
|
840
|
+
* "iitem_123",
|
841
|
+
* ["loc_123", "loc_321"]
|
753
842
|
* )
|
754
|
-
*
|
755
|
-
* // do something with the quantity or return it
|
756
|
-
* }
|
757
843
|
*/
|
758
844
|
retrieveAvailableQuantity(inventoryItemId: string, locationIds: string[], context?: Context): Promise<number>;
|
759
845
|
/**
|
760
|
-
* This method
|
846
|
+
* This method retrieves the stocked quantity of an inventory item in the specified location.
|
761
847
|
*
|
762
|
-
* @param {string} inventoryItemId - The
|
763
|
-
* @param {string[]} locationIds - The
|
848
|
+
* @param {string} inventoryItemId - The inventory item's ID.
|
849
|
+
* @param {string[]} locationIds - The locations' IDs.
|
764
850
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
765
|
-
* @returns {Promise<number>} The stocked quantity of the
|
851
|
+
* @returns {Promise<number>} The stocked quantity of the item.
|
766
852
|
*
|
767
853
|
* @example
|
768
|
-
*
|
769
|
-
*
|
770
|
-
*
|
771
|
-
*
|
772
|
-
* async function retrieveStockedQuantity (
|
773
|
-
* inventoryItemId: string,
|
774
|
-
* locationIds: string[],
|
775
|
-
* ) {
|
776
|
-
* const inventoryModule = await initializeInventoryModule({})
|
777
|
-
*
|
778
|
-
* const quantity = await inventoryModule.retrieveStockedQuantity(
|
779
|
-
* inventoryItemId,
|
780
|
-
* locationIds,
|
854
|
+
* const stockedQuantity =
|
855
|
+
* await inventoryModuleService.retrieveStockedQuantity(
|
856
|
+
* "iitem_123",
|
857
|
+
* ["loc_123", "loc_321"]
|
781
858
|
* )
|
782
|
-
*
|
783
|
-
* // do something with the quantity or return it
|
784
|
-
* }
|
785
859
|
*/
|
786
860
|
retrieveStockedQuantity(inventoryItemId: string, locationIds: string[], context?: Context): Promise<number>;
|
787
861
|
/**
|
788
|
-
* This method
|
862
|
+
* This method retrieves the reserved quantity of an inventory item in the specified location.
|
789
863
|
*
|
790
|
-
* @param {string} inventoryItemId - The
|
791
|
-
* @param {string[]} locationIds - The
|
864
|
+
* @param {string} inventoryItemId - The inventory item's ID.
|
865
|
+
* @param {string[]} locationIds - The locations' IDs.
|
792
866
|
* @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
|
793
|
-
* @returns {Promise<number>} The reserved quantity of the
|
867
|
+
* @returns {Promise<number>} The reserved quantity of the item.
|
794
868
|
*
|
795
869
|
* @example
|
796
|
-
*
|
797
|
-
*
|
798
|
-
*
|
799
|
-
*
|
800
|
-
* async function retrieveReservedQuantity (
|
801
|
-
* inventoryItemId: string,
|
802
|
-
* locationIds: string[],
|
803
|
-
* ) {
|
804
|
-
* const inventoryModule = await initializeInventoryModule({})
|
805
|
-
*
|
806
|
-
* const quantity = await inventoryModule.retrieveReservedQuantity(
|
807
|
-
* inventoryItemId,
|
808
|
-
* locationIds,
|
870
|
+
* const reservedQuantity =
|
871
|
+
* await inventoryModuleService.retrieveReservedQuantity(
|
872
|
+
* "iitem_123",
|
873
|
+
* ["loc_123", "loc_321"]
|
809
874
|
* )
|
810
|
-
*
|
811
|
-
* // do something with the quantity or return it
|
812
|
-
* }
|
813
875
|
*/
|
814
876
|
retrieveReservedQuantity(inventoryItemId: string, locationIds: string[], context?: Context): Promise<number>;
|
815
877
|
}
|