@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.
Files changed (200) hide show
  1. package/dist/auth/common/auth-user.d.ts +21 -16
  2. package/dist/auth/common/auth-user.d.ts.map +1 -1
  3. package/dist/auth/common/provider.d.ts +28 -15
  4. package/dist/auth/common/provider.d.ts.map +1 -1
  5. package/dist/auth/service.d.ts +137 -75
  6. package/dist/auth/service.d.ts.map +1 -1
  7. package/dist/bundles.d.ts +2 -0
  8. package/dist/bundles.d.ts.map +1 -1
  9. package/dist/bundles.js +3 -1
  10. package/dist/bundles.js.map +1 -1
  11. package/dist/cart/common.d.ts +443 -62
  12. package/dist/cart/common.d.ts.map +1 -1
  13. package/dist/cart/mutations.d.ts +483 -0
  14. package/dist/cart/mutations.d.ts.map +1 -1
  15. package/dist/cart/mutations.js.map +1 -1
  16. package/dist/cart/service.d.ts +1607 -0
  17. package/dist/cart/service.d.ts.map +1 -1
  18. package/dist/common/index.d.ts +1 -0
  19. package/dist/common/index.d.ts.map +1 -1
  20. package/dist/common/index.js +1 -0
  21. package/dist/common/index.js.map +1 -1
  22. package/dist/common/rule.d.ts +2 -0
  23. package/dist/common/rule.d.ts.map +1 -0
  24. package/dist/common/rule.js +3 -0
  25. package/dist/common/rule.js.map +1 -0
  26. package/dist/customer/service.d.ts +445 -197
  27. package/dist/customer/service.d.ts.map +1 -1
  28. package/dist/file/common.d.ts +14 -0
  29. package/dist/file/common.d.ts.map +1 -0
  30. package/dist/file/common.js +3 -0
  31. package/dist/file/common.js.map +1 -0
  32. package/dist/file/index.d.ts +4 -0
  33. package/dist/file/index.d.ts.map +1 -0
  34. package/dist/file/index.js +20 -0
  35. package/dist/file/index.js.map +1 -0
  36. package/dist/file/mutations.d.ts +18 -0
  37. package/dist/file/mutations.d.ts.map +1 -0
  38. package/dist/file/mutations.js +3 -0
  39. package/dist/file/mutations.js.map +1 -0
  40. package/dist/file/service.d.ts +76 -0
  41. package/dist/file/service.d.ts.map +1 -0
  42. package/dist/file/service.js +3 -0
  43. package/dist/file/service.js.map +1 -0
  44. package/dist/fulfillment/mutations/shipping-option-rule.d.ts +2 -2
  45. package/dist/fulfillment/mutations/shipping-option-rule.d.ts.map +1 -1
  46. package/dist/http/fulfillment/admin/fulfillment-address.d.ts +22 -0
  47. package/dist/http/fulfillment/admin/fulfillment-address.d.ts.map +1 -0
  48. package/dist/http/fulfillment/admin/fulfillment-address.js +3 -0
  49. package/dist/http/fulfillment/admin/fulfillment-address.js.map +1 -0
  50. package/dist/http/fulfillment/admin/fulfillment-item.d.ts +17 -0
  51. package/dist/http/fulfillment/admin/fulfillment-item.d.ts.map +1 -0
  52. package/dist/http/fulfillment/admin/fulfillment-item.js +3 -0
  53. package/dist/http/fulfillment/admin/fulfillment-item.js.map +1 -0
  54. package/dist/http/fulfillment/admin/fulfillment-label.d.ts +14 -0
  55. package/dist/http/fulfillment/admin/fulfillment-label.d.ts.map +1 -0
  56. package/dist/http/fulfillment/admin/fulfillment-label.js +3 -0
  57. package/dist/http/fulfillment/admin/fulfillment-label.js.map +1 -0
  58. package/dist/http/fulfillment/admin/fulfillment-provider.d.ts +12 -0
  59. package/dist/http/fulfillment/admin/fulfillment-provider.d.ts.map +1 -0
  60. package/dist/http/fulfillment/admin/fulfillment-provider.js +3 -0
  61. package/dist/http/fulfillment/admin/fulfillment-provider.js.map +1 -0
  62. package/dist/http/fulfillment/admin/fulfillment-set.d.ts +15 -0
  63. package/dist/http/fulfillment/admin/fulfillment-set.d.ts.map +1 -0
  64. package/dist/http/fulfillment/admin/fulfillment-set.js +3 -0
  65. package/dist/http/fulfillment/admin/fulfillment-set.js.map +1 -0
  66. package/dist/http/fulfillment/admin/fulfillment.d.ts +27 -0
  67. package/dist/http/fulfillment/admin/fulfillment.d.ts.map +1 -0
  68. package/dist/http/fulfillment/admin/fulfillment.js +3 -0
  69. package/dist/http/fulfillment/admin/fulfillment.js.map +1 -0
  70. package/dist/http/fulfillment/admin/geo-zone.d.ts +17 -0
  71. package/dist/http/fulfillment/admin/geo-zone.d.ts.map +1 -0
  72. package/dist/http/fulfillment/admin/geo-zone.js +3 -0
  73. package/dist/http/fulfillment/admin/geo-zone.js.map +1 -0
  74. package/dist/http/fulfillment/admin/index.d.ts +13 -0
  75. package/dist/http/fulfillment/admin/index.d.ts.map +1 -0
  76. package/dist/http/fulfillment/admin/index.js +29 -0
  77. package/dist/http/fulfillment/admin/index.js.map +1 -0
  78. package/dist/http/fulfillment/admin/service-zone.d.ts +14 -0
  79. package/dist/http/fulfillment/admin/service-zone.d.ts.map +1 -0
  80. package/dist/http/fulfillment/admin/service-zone.js +3 -0
  81. package/dist/http/fulfillment/admin/service-zone.js.map +1 -0
  82. package/dist/http/fulfillment/admin/shipping-option-rule.d.ts +16 -0
  83. package/dist/http/fulfillment/admin/shipping-option-rule.d.ts.map +1 -0
  84. package/dist/http/fulfillment/admin/shipping-option-rule.js +3 -0
  85. package/dist/http/fulfillment/admin/shipping-option-rule.js.map +1 -0
  86. package/dist/http/fulfillment/admin/shipping-option-type.d.ts +14 -0
  87. package/dist/http/fulfillment/admin/shipping-option-type.d.ts.map +1 -0
  88. package/dist/http/fulfillment/admin/shipping-option-type.js +3 -0
  89. package/dist/http/fulfillment/admin/shipping-option-type.js.map +1 -0
  90. package/dist/http/fulfillment/admin/shipping-option.d.ts +31 -0
  91. package/dist/http/fulfillment/admin/shipping-option.d.ts.map +1 -0
  92. package/dist/http/fulfillment/admin/shipping-option.js +3 -0
  93. package/dist/http/fulfillment/admin/shipping-option.js.map +1 -0
  94. package/dist/http/fulfillment/admin/shipping-profile.d.ts +13 -0
  95. package/dist/http/fulfillment/admin/shipping-profile.d.ts.map +1 -0
  96. package/dist/http/fulfillment/admin/shipping-profile.js +3 -0
  97. package/dist/http/fulfillment/admin/shipping-profile.js.map +1 -0
  98. package/dist/http/fulfillment/index.d.ts +2 -0
  99. package/dist/http/fulfillment/index.d.ts.map +1 -0
  100. package/dist/http/fulfillment/index.js +18 -0
  101. package/dist/http/fulfillment/index.js.map +1 -0
  102. package/dist/http/index.d.ts +3 -0
  103. package/dist/http/index.d.ts.map +1 -0
  104. package/dist/http/index.js +19 -0
  105. package/dist/http/index.js.map +1 -0
  106. package/dist/http/stock-locations/common.d.ts +28 -0
  107. package/dist/http/stock-locations/common.d.ts.map +1 -0
  108. package/dist/http/stock-locations/common.js +3 -0
  109. package/dist/http/stock-locations/common.js.map +1 -0
  110. package/dist/http/stock-locations/index.d.ts +2 -0
  111. package/dist/http/stock-locations/index.d.ts.map +1 -0
  112. package/dist/http/stock-locations/index.js +18 -0
  113. package/dist/http/stock-locations/index.js.map +1 -0
  114. package/dist/index.d.ts +4 -1
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +4 -1
  117. package/dist/index.js.map +1 -1
  118. package/dist/inventory/common/inventory-item.d.ts +55 -64
  119. package/dist/inventory/common/inventory-item.d.ts.map +1 -1
  120. package/dist/inventory/common/inventory-level.d.ts +37 -37
  121. package/dist/inventory/common/inventory-level.d.ts.map +1 -1
  122. package/dist/inventory/common/reservation-item.d.ts +34 -44
  123. package/dist/inventory/common/reservation-item.d.ts.map +1 -1
  124. package/dist/inventory/service-next.d.ts +596 -534
  125. package/dist/inventory/service-next.d.ts.map +1 -1
  126. package/dist/payment/common.d.ts +174 -53
  127. package/dist/payment/common.d.ts.map +1 -1
  128. package/dist/payment/common.js +3 -3
  129. package/dist/payment/common.js.map +1 -1
  130. package/dist/payment/mutations.d.ts +58 -17
  131. package/dist/payment/mutations.d.ts.map +1 -1
  132. package/dist/payment/provider.d.ts +128 -43
  133. package/dist/payment/provider.d.ts.map +1 -1
  134. package/dist/payment/provider.js.map +1 -1
  135. package/dist/payment/service.d.ts +460 -39
  136. package/dist/payment/service.d.ts.map +1 -1
  137. package/dist/pricing/common/price-list.d.ts +2 -2
  138. package/dist/pricing/common/price-set.d.ts +6 -4
  139. package/dist/pricing/common/price-set.d.ts.map +1 -1
  140. package/dist/pricing/service.d.ts +731 -1695
  141. package/dist/pricing/service.d.ts.map +1 -1
  142. package/dist/product/common.d.ts +4 -0
  143. package/dist/product/common.d.ts.map +1 -1
  144. package/dist/product-category/repository.d.ts +2 -1
  145. package/dist/product-category/repository.d.ts.map +1 -1
  146. package/dist/promotion/common/application-method.d.ts +153 -0
  147. package/dist/promotion/common/application-method.d.ts.map +1 -1
  148. package/dist/promotion/common/campaign-budget.d.ts +37 -0
  149. package/dist/promotion/common/campaign-budget.d.ts.map +1 -1
  150. package/dist/promotion/common/campaign.d.ts +36 -0
  151. package/dist/promotion/common/campaign.d.ts.map +1 -1
  152. package/dist/promotion/common/compute-actions.d.ts +135 -0
  153. package/dist/promotion/common/compute-actions.d.ts.map +1 -1
  154. package/dist/promotion/common/promotion-rule-value.d.ts +30 -0
  155. package/dist/promotion/common/promotion-rule-value.d.ts.map +1 -1
  156. package/dist/promotion/common/promotion-rule.d.ts +77 -0
  157. package/dist/promotion/common/promotion-rule.d.ts.map +1 -1
  158. package/dist/promotion/common/promotion.d.ts +100 -0
  159. package/dist/promotion/common/promotion.d.ts.map +1 -1
  160. package/dist/promotion/mutations.d.ts +84 -0
  161. package/dist/promotion/mutations.d.ts.map +1 -1
  162. package/dist/promotion/service.d.ts +786 -0
  163. package/dist/promotion/service.d.ts.map +1 -1
  164. package/dist/region/common.d.ts +9 -0
  165. package/dist/region/common.d.ts.map +1 -1
  166. package/dist/region/mutations.d.ts +11 -3
  167. package/dist/region/mutations.d.ts.map +1 -1
  168. package/dist/region/service.d.ts +210 -85
  169. package/dist/region/service.d.ts.map +1 -1
  170. package/dist/stock-location/common.d.ts +14 -0
  171. package/dist/stock-location/common.d.ts.map +1 -1
  172. package/dist/stock-location/service-next.d.ts +178 -186
  173. package/dist/stock-location/service-next.d.ts.map +1 -1
  174. package/dist/store/common/store.d.ts +42 -0
  175. package/dist/store/common/store.d.ts.map +1 -1
  176. package/dist/store/mutations/store.d.ts +75 -0
  177. package/dist/store/mutations/store.d.ts.map +1 -1
  178. package/dist/store/service.d.ts +113 -75
  179. package/dist/store/service.d.ts.map +1 -1
  180. package/dist/tax/common.d.ts +298 -10
  181. package/dist/tax/common.d.ts.map +1 -1
  182. package/dist/tax/mutations.d.ts +157 -0
  183. package/dist/tax/mutations.d.ts.map +1 -1
  184. package/dist/tax/provider.d.ts +126 -0
  185. package/dist/tax/provider.d.ts.map +1 -1
  186. package/dist/tax/service.d.ts +600 -0
  187. package/dist/tax/service.d.ts.map +1 -1
  188. package/dist/workflows/index.d.ts +2 -0
  189. package/dist/workflows/index.d.ts.map +1 -0
  190. package/dist/workflows/index.js +18 -0
  191. package/dist/workflows/index.js.map +1 -0
  192. package/dist/workflows/stock-locations/index.d.ts +2 -0
  193. package/dist/workflows/stock-locations/index.d.ts.map +1 -0
  194. package/dist/workflows/stock-locations/index.js +18 -0
  195. package/dist/workflows/stock-locations/index.js.map +1 -0
  196. package/dist/workflows/stock-locations/mutations.d.ts +8 -0
  197. package/dist/workflows/stock-locations/mutations.d.ts.map +1 -0
  198. package/dist/workflows/stock-locations/mutations.js +3 -0
  199. package/dist/workflows/stock-locations/mutations.js.map +1 -0
  200. 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 inventory module.
7
+ * The main service interface for the Inventory Module.
8
8
  */
9
9
  export interface IInventoryServiceNext extends IModuleService {
10
10
  /**
11
- * This method is used to retrieve a paginated list of inventory items along with the total count of available inventory items satisfying the provided filters.
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
- * @return {Promise<[InventoryItemDTO[], number]>} The list of inventory items along with the total count.
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
- * import {
24
- * initialize as initializeInventoryModule,
25
- * } from "@medusajs/inventory"
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
- * const [inventoryItems, count] = await inventoryModule.listInventoryItems({
31
- * id: ids
32
- * })
28
+ * To specify relations that should be retrieved within the inventory items:
33
29
  *
34
- * // do something with the inventory items or return them
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
- * To specify relations that should be retrieved within the inventory items:
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
- * import {
42
- * initialize as initializeInventoryModule,
43
- * } from "@medusajs/inventory"
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
- * async function retrieveInventoryItems (ids: string[]) {
46
- * const inventoryModule = await initializeInventoryModule({})
66
+ * @example
67
+ * To retrieve a list of inventory items using their IDs:
47
68
  *
48
- * const [inventoryItems, count] = await inventoryModule.listInventoryItems({
49
- * id: ids
50
- * }, {
51
- * relations: ["inventory_level"]
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
- * // do something with the inventory items or return them
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
- * import {
62
- * initialize as initializeInventoryModule,
63
- * } from "@medusajs/inventory"
64
- *
65
- * async function retrieveInventoryItems (ids: string[], skip: number, take: number) {
66
- * const inventoryModule = await initializeInventoryModule({})
67
- *
68
- * const [inventoryItems, count] = await inventoryModule.listInventoryItems({
69
- * id: ids
70
- * }, {
71
- * relations: ["inventory_level"],
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 is used to retrieve a paginated list of reservation items along with the total count of available reservation items satisfying the provided filters.
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
- * @return {Promise<[ReservationItemDTO[], number]>} The list of reservation items along with the total count.
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
- * import {
96
- * initialize as initializeInventoryModule,
97
- * } from "@medusajs/inventory"
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
- * import {
114
- * initialize as initializeInventoryModule,
115
- * } from "@medusajs/inventory"
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
- * async function retrieveReservationItems (ids: string[]) {
118
- * const inventoryModule = await initializeInventoryModule({})
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
- * const [reservationItems, count] = await inventoryModule.listReservationItems({
121
- * id: ids
122
- * }, {
123
- * relations: ["inventory_item"]
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
- * // do something with the reservation items or return them
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
- * import {
134
- * initialize as initializeInventoryModule,
135
- * } from "@medusajs/inventory"
136
- *
137
- * async function retrieveReservationItems (ids: string[], skip: number, take: number) {
138
- * const inventoryModule = await initializeInventoryModule({})
139
- *
140
- * const [reservationItems, count] = await inventoryModule.listReservationItems({
141
- * id: ids
142
- * }, {
143
- * relations: ["inventory_item"],
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 is used to retrieve a paginated list of inventory levels along with the total count of available inventory levels satisfying the provided filters.
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
- * @return {Promise<[InventoryLevelDTO[], number]>} The list of inventory levels along with the total count.
214
+ * @returns {Promise<InventoryLevelDTO[]>} The list of inventory levels.
162
215
  *
163
216
  * @example
164
- * To retrieve a list of inventory levels using their IDs:
217
+ * To retrieve a list of inventory levels using the IDs of their associated inventory items:
165
218
  *
166
219
  * ```ts
167
- * import {
168
- * initialize as initializeInventoryModule,
169
- * } from "@medusajs/inventory"
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
- * import {
186
- * initialize as initializeInventoryModule,
187
- * } from "@medusajs/inventory"
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
- * async function retrieveInventoryLevels (inventoryItemIds: string[]) {
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
- * const [inventoryLevels, count] = await inventoryModule.listInventoryLevels({
193
- * inventory_item_id: inventoryItemIds
194
- * }, {
195
- * relations: ["inventory_item"]
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
- * // do something with the inventory levels or return them
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
- * import {
206
- * initialize as initializeInventoryModule,
207
- * } from "@medusajs/inventory"
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 is used to retrieve an inventory item by its ID
308
+ * This method retrieves an inventory item by its ID.
228
309
  *
229
- * @param {string} inventoryItemId - The ID of the inventory item to retrieve.
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
- * import {
241
- * initialize as initializeInventoryModule,
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
- * import {
257
- * initialize as initializeInventoryModule,
258
- * } from "@medusajs/inventory"
259
- *
260
- * async function retrieveInventoryItem (id: string) {
261
- * const inventoryModule = await initializeInventoryModule({})
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 is used to retrieve an inventory level for an inventory item and a location.
337
+ * This method retrieves an inventory level based on its associated inventory item and location.
274
338
  *
275
- * @param {string} inventoryItemId - The ID of the inventory item.
276
- * @param {string} locationId - The ID of the location.
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
- * import {
282
- * initialize as initializeInventoryModule,
283
- * } from "@medusajs/inventory"
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
- * async function retrieveInventoryLevel (
286
- * inventoryItemId: string,
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
- * const inventoryLevel = await inventoryModule.retrieveInventoryLevel(
292
- * inventoryItemId,
293
- * locationId
364
+ * ```ts
365
+ * const inventoryLevel =
366
+ * await inventoryModuleService.retrieveInventoryLevel(
367
+ * "iitem_123"
294
368
  * )
369
+ * ```
295
370
  *
296
- * // do something with the inventory level or return it
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 is used to retrieve a reservation item by its ID.
385
+ * This method retrieves a reservation item by its ID.
303
386
  *
304
- * @param {string} reservationId - The ID of the reservation item.
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
- * import {
310
- * initialize as initializeInventoryModule,
311
- * } from "@medusajs/inventory"
394
+ * A simple example that retrieves a reservation item by its ID:
312
395
  *
313
- * async function retrieveReservationItem (id: string) {
314
- * const inventoryModule = await initializeInventoryModule({})
396
+ * ```ts
397
+ * const reservationItem =
398
+ * await inventoryModuleService.retrieveReservationItem(
399
+ * "resitem"
400
+ * )
401
+ * ```
315
402
  *
316
- * const reservationItem = await inventoryModule.retrieveReservationItem(id)
403
+ * To specify relations that should be retrieved:
317
404
  *
318
- * // do something with the reservation item or return it
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 is used to create reservation items.
417
+ * This method creates reservation items.
324
418
  *
325
- * @param {CreateReservationItemInput[]} input - The details of the reservation items to create.
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 { Promise<ReservationItemDTO[]>} The created reservation items' details.
421
+ * @returns {Promise<ReservationItemDTO[]>} The created reservation items.
328
422
  *
329
423
  * @example
330
- * import {
331
- * initialize as initializeInventoryModule,
332
- * } from "@medusajs/inventory"
333
- *
334
- * async function createReservationItems (items: {
335
- * inventory_item_id: string,
336
- * location_id: string,
337
- * quantity: number
338
- * }[]) {
339
- * const inventoryModule = await initializeInventoryModule({})
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
- * const reservationItems = await inventoryModule.createReservationItems(
342
- * items
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
- * // do something with the reservation items or return them
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 is used to create inventory items.
451
+ * This method creates inventory items.
352
452
  *
353
- * @param {CreateInventoryItemInput[]} input - The details of the inventory items to create.
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' details.
455
+ * @returns {Promise<InventoryItemDTO[]>} The created inventory items.
356
456
  *
357
457
  * @example
358
- * import {
359
- * initialize as initializeInventoryModule,
360
- * } from "@medusajs/inventory"
361
- *
362
- * async function createInventoryItems (items: {
363
- * sku: string,
364
- * requires_shipping: boolean
365
- * }[]) {
366
- * const inventoryModule = await initializeInventoryModule({})
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
- * const inventoryItems = await inventoryModule.createInventoryItems(
369
- * items
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
- * // do something with the inventory items or return them
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 is used to create inventory levels.
479
+ * This method creates inventory levels.
379
480
  *
380
- * @param {CreateInventoryLevelInput[]} data - The details of the inventory levels to create.
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' details.
483
+ * @returns {Promise<InventoryLevelDTO[]>} The created inventory levels.
383
484
  *
384
485
  * @example
385
- * import {
386
- * initialize as initializeInventoryModule,
387
- * } from "@medusajs/inventory"
388
- *
389
- * async function createInventoryLevels (items: {
390
- * inventory_item_id: string
391
- * location_id: string
392
- * stocked_quantity: number
393
- * }[]) {
394
- * const inventoryModule = await initializeInventoryModule({})
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
- * const inventoryLevels = await inventoryModule.createInventoryLevels(
397
- * items
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
- * // do something with the inventory levels or return them
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 is used to update inventory levels. Each inventory level is identified by the IDs of its associated inventory item and location.
519
+ * This method updates existing inventory levels.
407
520
  *
408
- * @param {BulkUpdateInventoryLevelInput} updates - The attributes to update in each inventory level.
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' details.
523
+ * @returns {Promise<InventoryLevelDTO[]>} The updated inventory levels.
411
524
  *
412
525
  * @example
413
- * import {
414
- * initialize as initializeInventoryModule,
415
- * } from "@medusajs/inventory"
416
- *
417
- * async function updateInventoryLevels (items: {
418
- * inventory_item_id: string,
419
- * location_id: string,
420
- * stocked_quantity: number
421
- * }[]) {
422
- * const inventoryModule = await initializeInventoryModule({})
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
- * const inventoryLevels = await inventoryModule.updateInventoryLevels(
425
- * items
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
- * // do something with the inventory levels or return them
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 is used to update an inventory item.
554
+ * This method updates an existing inventory item.
435
555
  *
436
- * @param {string} inventoryItemId - The ID of the inventory item.
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's details.
558
+ * @returns {Promise<InventoryItemDTO>} The updated inventory item.
440
559
  *
441
560
  * @example
442
- * import {
443
- * initialize as initializeInventoryModule,
444
- * } from "@medusajs/inventory"
445
- *
446
- * async function updateInventoryItem (
447
- * inventoryItemId: string,
448
- * sku: string
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
- * const inventoryItem = await inventoryModule.updateInventoryItem(
453
- * inventoryItemId,
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
- * // do something with the inventory item or return it
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 is used to update a reservation item.
588
+ * This method updates an existing reservation item.
466
589
  *
467
- * @param {string} reservationItemId - The ID of the reservation item.
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
- * import {
474
- * initialize as initializeInventoryModule,
475
- * } from "@medusajs/inventory"
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
- * async function updateReservationItem (
478
- * reservationItemId: string,
479
- * quantity: number
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
- * const reservationItem = await inventoryModule.updateReservationItem(
484
- * reservationItemId,
609
+ * @example
610
+ * const reservationItems =
611
+ * await inventoryModuleService.updateReservationItems([
485
612
  * {
486
- * quantity
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 is used to delete the reservation items associated with a line item or multiple line items.
620
+ * This method deletes a reservation item by its associated line item.
497
621
  *
498
- * @param {string | string[]} lineItemId - The ID(s) of the line item(s).
499
- * @param {Context} context - A context used to share re9sources, such as transaction manager, between the application and the module.
500
- * @returns {Promise<void>} Resolves when the reservation items are successfully deleted.
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
- * import {
504
- * initialize as initializeInventoryModule,
505
- * } from "@medusajs/inventory"
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 is used to delete a reservation item or multiple reservation items by their IDs.
633
+ * This method deletes reservation items by their IDs.
520
634
  *
521
- * @param {string | string[]} reservationItemId - The ID(s) of the reservation item(s) to delete.
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(s) are successfully deleted.
637
+ * @returns {Promise<void>} Resolves when the reservation item is deleted.
524
638
  *
525
639
  * @example
526
- * import {
527
- * initialize as initializeInventoryModule,
528
- * } from "@medusajs/inventory"
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 is used to delete an inventory item or multiple inventory items. The inventory items are only soft deleted and can be restored using the
543
- * {@link restoreInventoryItem} method.
646
+ * This method deletes inventory items by their IDs.
544
647
  *
545
- * @param {string | string[]} inventoryItemId - The ID(s) of the inventory item(s) to delete.
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 item(s) are successfully deleted.
650
+ * @returns {Promise<void>} Resolves when the inventory items are deleted.
548
651
  *
549
652
  * @example
550
- * import {
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
- * Soft delete inventory items
567
- * @param inventoryItemIds
568
- * @param config
569
- * @param sharedContext
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 is used to restore an inventory item or multiple inventory items that were previously deleted using the {@link deleteInventoryItem} method.
678
+ * This method restores soft deleted inventory items by their IDs.
574
679
  *
575
- * @param {string[]} inventoryItemId - The ID(s) of the inventory item(s) to restore.
576
- * @param {RestoreReturn<TReturnableLinkableKeys>} config - Restore config
577
- * @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
578
- * @returns {Promise<void>} Resolves when the inventory item(s) are successfully restored.
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
- * @example
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
- * await inventoryModule.restoreInventoryItem(
591
- * inventoryItems
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 the inventory item level(s) for the ID(s) of associated location(s).
701
+ * This method soft deletes inventory item's level by the associated location.
598
702
  *
599
- * @param {string | string[]} locationId - The ID(s) of the associated location(s).
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<void>} Resolves when the inventory item level(s) are successfully restored.
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
- * import {
605
- * initialize as initializeInventoryModule,
606
- * } from "@medusajs/inventory"
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 item(s) by the ID(s) of associated location(s).
715
+ * This method deletes reservation items by their associated location.
621
716
  *
622
- * @param {string | string[]} locationId - The ID(s) of the associated location(s).
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 the reservation item(s) are successfully restored.
719
+ * @returns {Promise<void>} Resolves when then reservation items are deleted successfully.
625
720
  *
626
721
  * @example
627
- * import {
628
- * initialize as initializeInventoryModule,
629
- * } from "@medusajs/inventory"
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 is used to delete an inventory level. The inventory level is identified by the IDs of its associated inventory item and location.
728
+ * This method deletes an inventory level by its associated inventory item and location.
644
729
  *
645
- * @param {string} inventoryItemId - The ID of the associated inventory item.
646
- * @param {string} locationId - The ID of the associated location.
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(s) are successfully restored.
733
+ * @returns {Promise<void>} Resolves when the inventory level is deleted successfully.
649
734
  *
650
735
  * @example
651
- * import {
652
- * initialize as initializeInventoryModule,
653
- * } from "@medusajs/inventory"
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
- * async function deleteInventoryLevel (
656
- * inventoryItemId: string,
657
- * locationId: string
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
- * await inventoryModule.deleteInventoryLevel(
662
- * inventoryItemId,
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 is used to adjust the inventory level's stocked quantity. The inventory level is identified by the IDs of its associated inventory item and location.
769
+ * This method restores soft deleted inventory levels by their IDs.
673
770
  *
674
- * @param {string} inventoryItemId - The ID of the associated inventory item.
675
- * @param {string} locationId - The ID of the associated location.
676
- * @param {number} adjustment - A positive or negative number used to adjust the inventory level's stocked quantity.
677
- * @param {Context} context - A context used to share resources, such as transaction manager, between the application and the module.
678
- * @returns {Promise<InventoryLevelDTO>} The inventory level's details.
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
- * import {
682
- * initialize as initializeInventoryModule,
683
- * } from "@medusajs/inventory"
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
- * async function adjustInventory (
686
- * inventoryItemId: string,
687
- * locationId: string,
688
- * adjustment: number
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
- * const inventoryLevel = await inventoryModule.adjustInventory(
693
- * inventoryItemId,
694
- * locationId,
695
- * adjustment
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
- * // do something with the inventory level or return it.
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 is used to confirm whether the specified quantity of an inventory item is available in the specified locations.
812
+ * This method confirms that a quantity is available of an inventory item in the specified locations.
704
813
  *
705
- * @param {string} inventoryItemId - The ID of the inventory item to check its availability.
706
- * @param {string[]} locationIds - The IDs of the locations to check the quantity availability in.
707
- * @param {number} quantity - The quantity to check if available for the inventory item in the specified locations.
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 specified quantity is available for the inventory item in the specified locations.
818
+ * @returns {Promise<boolean>} Whether the quantity is available.
710
819
  *
711
820
  * @example
712
- * import {
713
- * initialize as initializeInventoryModule,
714
- * } from "@medusajs/inventory"
715
- *
716
- * async function confirmInventory (
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 is used to retrieve the available quantity of an inventory item within the specified locations.
830
+ * This method retrieves the available quantity of an inventory item in the specified locations.
733
831
  *
734
- * @param {string} inventoryItemId - The ID of the inventory item to retrieve its quantity.
735
- * @param {string[]} locationIds - The IDs of the locations to retrieve the available quantity from.
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 inventory item in the specified locations.
835
+ * @returns {Promise<number>} The available quantity of the item.
738
836
  *
739
837
  * @example
740
- * import {
741
- * initialize as initializeInventoryModule,
742
- * } from "@medusajs/inventory"
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 is used to retrieve the stocked quantity of an inventory item within the specified locations.
846
+ * This method retrieves the stocked quantity of an inventory item in the specified location.
761
847
  *
762
- * @param {string} inventoryItemId - The ID of the inventory item to retrieve its stocked quantity.
763
- * @param {string[]} locationIds - The IDs of the locations to retrieve the stocked quantity from.
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 inventory item in the specified locations.
851
+ * @returns {Promise<number>} The stocked quantity of the item.
766
852
  *
767
853
  * @example
768
- * import {
769
- * initialize as initializeInventoryModule,
770
- * } from "@medusajs/inventory"
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 is used to retrieve the reserved quantity of an inventory item within the specified locations.
862
+ * This method retrieves the reserved quantity of an inventory item in the specified location.
789
863
  *
790
- * @param {string} inventoryItemId - The ID of the inventory item to retrieve its reserved quantity.
791
- * @param {string[]} locationIds - The IDs of the locations to retrieve the reserved quantity from.
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 inventory item in the specified locations.
867
+ * @returns {Promise<number>} The reserved quantity of the item.
794
868
  *
795
869
  * @example
796
- * import {
797
- * initialize as initializeInventoryModule,
798
- * } from "@medusajs/inventory"
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
  }