@medusajs/medusa 1.1.63 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/api/index.d.ts +2 -0
  3. package/dist/api/index.js +2 -0
  4. package/dist/api/index.js.map +1 -1
  5. package/dist/api/routes/admin/collections/add-products.d.ts +32 -0
  6. package/dist/api/routes/admin/{product-tags/update-collection.js → collections/add-products.js} +25 -45
  7. package/dist/api/routes/admin/collections/add-products.js.map +1 -0
  8. package/dist/api/routes/admin/collections/index.d.ts +2 -0
  9. package/dist/api/routes/admin/collections/index.js +11 -1
  10. package/dist/api/routes/admin/collections/index.js.map +1 -1
  11. package/dist/api/routes/admin/collections/remove-products.d.ts +32 -0
  12. package/dist/api/routes/admin/{product-tags/create-collection.js → collections/remove-products.js} +35 -49
  13. package/dist/api/routes/admin/collections/remove-products.js.map +1 -0
  14. package/dist/api/routes/admin/customer-groups/create-customer-group.d.ts +27 -0
  15. package/dist/api/routes/admin/customer-groups/create-customer-group.js +103 -0
  16. package/dist/api/routes/admin/customer-groups/create-customer-group.js.map +1 -0
  17. package/dist/api/routes/admin/customer-groups/delete-customer-group.d.ts +28 -0
  18. package/dist/api/routes/admin/{product-tags/delete-collection.js → customer-groups/delete-customer-group.js} +25 -25
  19. package/dist/api/routes/admin/customer-groups/delete-customer-group.js.map +1 -0
  20. package/dist/api/routes/admin/customer-groups/delete-customers-batch.d.ts +27 -0
  21. package/dist/api/routes/admin/customer-groups/delete-customers-batch.js +106 -0
  22. package/dist/api/routes/admin/customer-groups/delete-customers-batch.js.map +1 -0
  23. package/dist/api/routes/admin/customer-groups/get-customer-group.d.ts +25 -0
  24. package/dist/api/routes/admin/customer-groups/get-customer-group.js +113 -0
  25. package/dist/api/routes/admin/customer-groups/get-customer-group.js.map +1 -0
  26. package/dist/api/routes/admin/customer-groups/index.d.ts +13 -0
  27. package/dist/api/routes/admin/customer-groups/index.js +31 -0
  28. package/dist/api/routes/admin/customer-groups/index.js.map +1 -0
  29. package/dist/api/routes/admin/customer-groups/update-customer-group.d.ts +28 -0
  30. package/dist/api/routes/admin/customer-groups/update-customer-group.js +124 -0
  31. package/dist/api/routes/admin/customer-groups/update-customer-group.js.map +1 -0
  32. package/dist/api/routes/admin/customers/get-customer.js +18 -5
  33. package/dist/api/routes/admin/customers/get-customer.js.map +1 -1
  34. package/dist/api/routes/admin/customers/index.d.ts +1 -0
  35. package/dist/api/routes/admin/customers/index.js +2 -0
  36. package/dist/api/routes/admin/customers/index.js.map +1 -1
  37. package/dist/api/routes/admin/customers/update-customer.d.ts +14 -0
  38. package/dist/api/routes/admin/customers/update-customer.js +49 -10
  39. package/dist/api/routes/admin/customers/update-customer.js.map +1 -1
  40. package/dist/api/routes/admin/draft-orders/create-draft-order.d.ts +3 -3
  41. package/dist/api/routes/admin/draft-orders/create-draft-order.js.map +1 -1
  42. package/dist/api/routes/admin/draft-orders/create-line-item.d.ts +1 -1
  43. package/dist/api/routes/admin/draft-orders/create-line-item.js.map +1 -1
  44. package/dist/api/routes/admin/draft-orders/update-line-item.d.ts +1 -1
  45. package/dist/api/routes/admin/draft-orders/update-line-item.js.map +1 -1
  46. package/dist/api/routes/admin/index.js +6 -0
  47. package/dist/api/routes/admin/index.js.map +1 -1
  48. package/dist/api/routes/admin/orders/add-shipping-method.d.ts +1 -1
  49. package/dist/api/routes/admin/orders/add-shipping-method.js.map +1 -1
  50. package/dist/api/routes/admin/orders/create-claim.js +9 -1
  51. package/dist/api/routes/admin/orders/create-claim.js.map +1 -1
  52. package/dist/api/routes/admin/orders/create-swap-shipment.js +1 -0
  53. package/dist/api/routes/admin/orders/create-swap-shipment.js.map +1 -1
  54. package/dist/api/routes/admin/orders/create-swap.js +7 -1
  55. package/dist/api/routes/admin/orders/create-swap.js.map +1 -1
  56. package/dist/api/routes/admin/orders/index.d.ts +0 -1
  57. package/dist/api/routes/admin/orders/index.js +2 -5
  58. package/dist/api/routes/admin/orders/index.js.map +1 -1
  59. package/dist/api/routes/admin/product-types/index.d.ts +15 -0
  60. package/dist/api/routes/admin/product-types/index.js +40 -0
  61. package/dist/api/routes/admin/product-types/index.js.map +1 -0
  62. package/dist/api/routes/admin/product-types/list-product-types.d.ts +39 -0
  63. package/dist/api/routes/admin/{product-tags/list-collections.js → product-types/list-product-types.js} +72 -76
  64. package/dist/api/routes/admin/product-types/list-product-types.js.map +1 -0
  65. package/dist/api/routes/admin/regions/index.js +3 -0
  66. package/dist/api/routes/admin/regions/index.js.map +1 -1
  67. package/dist/api/routes/admin/regions/list-regions.d.ts +27 -3
  68. package/dist/api/routes/admin/regions/list-regions.js +91 -11
  69. package/dist/api/routes/admin/regions/list-regions.js.map +1 -1
  70. package/dist/api/routes/admin/regions/update-region.d.ts +12 -0
  71. package/dist/api/routes/admin/regions/update-region.js +24 -0
  72. package/dist/api/routes/admin/regions/update-region.js.map +1 -1
  73. package/dist/api/routes/admin/shipping-options/index.d.ts +2 -2
  74. package/dist/api/routes/admin/shipping-options/list-shipping-options.js +23 -7
  75. package/dist/api/routes/admin/shipping-options/list-shipping-options.js.map +1 -1
  76. package/dist/api/routes/admin/store/index.d.ts +4 -1
  77. package/dist/api/routes/admin/store/index.js +1 -0
  78. package/dist/api/routes/admin/store/index.js.map +1 -1
  79. package/dist/api/routes/admin/store/list-tax-providers.d.ts +22 -0
  80. package/dist/api/routes/admin/{product-tags/get-collection.js → store/list-tax-providers.js} +21 -22
  81. package/dist/api/routes/admin/store/list-tax-providers.js.map +1 -0
  82. package/dist/api/routes/admin/swaps/index.js +0 -6
  83. package/dist/api/routes/admin/swaps/index.js.map +1 -1
  84. package/dist/api/routes/admin/tax-rates/add-to-product-types.d.ts +1 -1
  85. package/dist/api/routes/admin/tax-rates/add-to-product-types.js +4 -59
  86. package/dist/api/routes/admin/tax-rates/add-to-product-types.js.map +1 -1
  87. package/dist/api/routes/admin/tax-rates/add-to-products.d.ts +1 -1
  88. package/dist/api/routes/admin/tax-rates/add-to-products.js +4 -55
  89. package/dist/api/routes/admin/tax-rates/add-to-products.js.map +1 -1
  90. package/dist/api/routes/admin/tax-rates/add-to-shipping-options.d.ts +1 -1
  91. package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js +4 -59
  92. package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js.map +1 -1
  93. package/dist/api/routes/admin/tax-rates/create-tax-rate.js +14 -113
  94. package/dist/api/routes/admin/tax-rates/create-tax-rate.js.map +1 -1
  95. package/dist/api/routes/admin/tax-rates/index.d.ts +3 -0
  96. package/dist/api/routes/admin/tax-rates/index.js +18 -3
  97. package/dist/api/routes/admin/tax-rates/index.js.map +1 -1
  98. package/dist/api/routes/admin/tax-rates/list-tax-rates.d.ts +2 -2
  99. package/dist/api/routes/admin/tax-rates/list-tax-rates.js.map +1 -1
  100. package/dist/api/routes/admin/tax-rates/remove-from-product-types.d.ts +29 -0
  101. package/dist/api/routes/admin/tax-rates/remove-from-product-types.js +122 -0
  102. package/dist/api/routes/admin/tax-rates/remove-from-product-types.js.map +1 -0
  103. package/dist/api/routes/admin/tax-rates/remove-from-products.d.ts +29 -0
  104. package/dist/api/routes/admin/tax-rates/remove-from-products.js +122 -0
  105. package/dist/api/routes/admin/tax-rates/remove-from-products.js.map +1 -0
  106. package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.d.ts +29 -0
  107. package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.js +122 -0
  108. package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.js.map +1 -0
  109. package/dist/api/routes/admin/tax-rates/update-tax-rate.js +15 -116
  110. package/dist/api/routes/admin/tax-rates/update-tax-rate.js.map +1 -1
  111. package/dist/api/routes/store/carts/add-shipping-method.d.ts +1 -1
  112. package/dist/api/routes/store/carts/add-shipping-method.js.map +1 -1
  113. package/dist/api/routes/store/carts/complete-cart.js +11 -247
  114. package/dist/api/routes/store/carts/complete-cart.js.map +1 -1
  115. package/dist/api/routes/store/carts/index.js +2 -0
  116. package/dist/api/routes/store/carts/index.js.map +1 -1
  117. package/dist/api/routes/store/swaps/create-swap.js +7 -1
  118. package/dist/api/routes/store/swaps/create-swap.js.map +1 -1
  119. package/dist/db-subscribers/region.d.ts +6 -0
  120. package/dist/db-subscribers/region.js +84 -0
  121. package/dist/db-subscribers/region.js.map +1 -0
  122. package/dist/entity-subscribers/region.d.ts +6 -0
  123. package/dist/entity-subscribers/region.js +27 -0
  124. package/dist/entity-subscribers/region.js.map +1 -0
  125. package/dist/helpers/test-request.js +2 -0
  126. package/dist/helpers/test-request.js.map +1 -1
  127. package/dist/index.d.ts +59 -50
  128. package/dist/index.js +60 -101
  129. package/dist/index.js.map +1 -1
  130. package/dist/loaders/db-subscribers.d.ts +6 -0
  131. package/dist/loaders/db-subscribers.js +53 -0
  132. package/dist/loaders/db-subscribers.js.map +1 -0
  133. package/dist/loaders/index.d.ts +2 -1
  134. package/dist/loaders/index.js +17 -4
  135. package/dist/loaders/index.js.map +1 -1
  136. package/dist/loaders/models.js.map +1 -1
  137. package/dist/loaders/passport.js.map +1 -1
  138. package/dist/loaders/plugins.js +26 -0
  139. package/dist/loaders/plugins.js.map +1 -1
  140. package/dist/loaders/services.d.ts +2 -1
  141. package/dist/loaders/services.js +9 -7
  142. package/dist/loaders/services.js.map +1 -1
  143. package/dist/migrations/1641636508055-new_tax_system.js +9 -9
  144. package/dist/migrations/1641636508055-new_tax_system.js.map +1 -1
  145. package/dist/migrations/1644943746861-customer_groups.d.ts +6 -0
  146. package/dist/migrations/1644943746861-customer_groups.js +107 -0
  147. package/dist/migrations/1644943746861-customer_groups.js.map +1 -0
  148. package/dist/models/cart.d.ts +2 -1
  149. package/dist/models/cart.js +1 -0
  150. package/dist/models/cart.js.map +1 -1
  151. package/dist/models/customer-group.d.ts +11 -0
  152. package/dist/models/customer-group.js +81 -0
  153. package/dist/models/customer-group.js.map +1 -0
  154. package/dist/models/customer.d.ts +2 -0
  155. package/dist/models/customer.js +18 -1
  156. package/dist/models/customer.js.map +1 -1
  157. package/dist/models/line-item.d.ts +3 -0
  158. package/dist/models/line-item.js +9 -0
  159. package/dist/models/line-item.js.map +1 -1
  160. package/dist/models/order.d.ts +2 -1
  161. package/dist/models/order.js +3 -2
  162. package/dist/models/order.js.map +1 -1
  163. package/dist/models/product-tax-rate.d.ts +0 -1
  164. package/dist/models/product-tax-rate.js +5 -7
  165. package/dist/models/product-tax-rate.js.map +1 -1
  166. package/dist/models/product-type-tax-rate.d.ts +0 -1
  167. package/dist/models/product-type-tax-rate.js +2 -6
  168. package/dist/models/product-type-tax-rate.js.map +1 -1
  169. package/dist/models/product.d.ts +1 -1
  170. package/dist/models/product.js +2 -2
  171. package/dist/models/product.js.map +1 -1
  172. package/dist/models/region.d.ts +7 -0
  173. package/dist/models/region.js +31 -2
  174. package/dist/models/region.js.map +1 -1
  175. package/dist/models/shipping-method.d.ts +2 -0
  176. package/dist/models/shipping-method.js +7 -0
  177. package/dist/models/shipping-method.js.map +1 -1
  178. package/dist/models/shipping-tax-rate.d.ts +0 -1
  179. package/dist/models/shipping-tax-rate.js +2 -6
  180. package/dist/models/shipping-tax-rate.js.map +1 -1
  181. package/dist/models/swap.d.ts +1 -1
  182. package/dist/models/swap.js +1 -1
  183. package/dist/models/swap.js.map +1 -1
  184. package/dist/repositories/customer-group.d.ts +5 -0
  185. package/dist/repositories/customer-group.js +91 -0
  186. package/dist/repositories/customer-group.js.map +1 -0
  187. package/dist/repositories/line-item.d.ts +12 -0
  188. package/dist/repositories/line-item.js +61 -0
  189. package/dist/repositories/line-item.js.map +1 -1
  190. package/dist/repositories/money-amount.d.ts +6 -0
  191. package/dist/repositories/money-amount.js +97 -0
  192. package/dist/repositories/money-amount.js.map +1 -1
  193. package/dist/repositories/product.d.ts +2 -0
  194. package/dist/repositories/product.js +32 -0
  195. package/dist/repositories/product.js.map +1 -1
  196. package/dist/repositories/tax-provider.d.ts +4 -0
  197. package/dist/repositories/tax-provider.js +38 -0
  198. package/dist/repositories/tax-provider.js.map +1 -0
  199. package/dist/repositories/tax-rate.d.ts +7 -4
  200. package/dist/repositories/tax-rate.js +96 -21
  201. package/dist/repositories/tax-rate.js.map +1 -1
  202. package/dist/services/cart.d.ts +92 -114
  203. package/dist/services/cart.js +142 -144
  204. package/dist/services/cart.js.map +1 -1
  205. package/dist/services/claim.d.ts +22 -33
  206. package/dist/services/claim.js +106 -95
  207. package/dist/services/claim.js.map +1 -1
  208. package/dist/services/customer-group.d.ts +54 -0
  209. package/dist/services/customer-group.js +265 -0
  210. package/dist/services/customer-group.js.map +1 -0
  211. package/dist/services/customer.d.ts +3 -1
  212. package/dist/services/customer.js +28 -17
  213. package/dist/services/customer.js.map +1 -1
  214. package/dist/services/fulfillment.js +1 -1
  215. package/dist/services/fulfillment.js.map +1 -1
  216. package/dist/services/gift-card.js +1 -1
  217. package/dist/services/gift-card.js.map +1 -1
  218. package/dist/services/index.d.ts +4 -0
  219. package/dist/services/index.js +9 -1
  220. package/dist/services/index.js.map +1 -1
  221. package/dist/services/invite.d.ts +3 -3
  222. package/dist/services/invite.js +4 -2
  223. package/dist/services/invite.js.map +1 -1
  224. package/dist/services/line-item.d.ts +12 -1
  225. package/dist/services/line-item.js +49 -1
  226. package/dist/services/line-item.js.map +1 -1
  227. package/dist/services/order.d.ts +6 -2
  228. package/dist/services/order.js +186 -80
  229. package/dist/services/order.js.map +1 -1
  230. package/dist/services/product-collection.d.ts +2 -0
  231. package/dist/services/product-collection.js +49 -0
  232. package/dist/services/product-collection.js.map +1 -1
  233. package/dist/services/product-type.d.ts +15 -0
  234. package/dist/services/product-type.js +44 -0
  235. package/dist/services/product-type.js.map +1 -1
  236. package/dist/services/product-variant.d.ts +2 -1
  237. package/dist/services/product-variant.js +96 -85
  238. package/dist/services/product-variant.js.map +1 -1
  239. package/dist/services/product.js +3 -1
  240. package/dist/services/product.js.map +1 -1
  241. package/dist/services/region.d.ts +4 -1
  242. package/dist/services/region.js +25 -10
  243. package/dist/services/region.js.map +1 -1
  244. package/dist/services/return.d.ts +3 -1
  245. package/dist/services/return.js +37 -26
  246. package/dist/services/return.js.map +1 -1
  247. package/dist/services/shipping-option.d.ts +7 -4
  248. package/dist/services/shipping-option.js +22 -5
  249. package/dist/services/shipping-option.js.map +1 -1
  250. package/dist/services/swap.d.ts +5 -22
  251. package/dist/services/swap.js +308 -454
  252. package/dist/services/swap.js.map +1 -1
  253. package/dist/services/tax-provider.d.ts +3 -0
  254. package/dist/services/tax-provider.js +10 -0
  255. package/dist/services/tax-provider.js.map +1 -1
  256. package/dist/services/tax-rate.d.ts +13 -6
  257. package/dist/services/tax-rate.js +235 -41
  258. package/dist/services/tax-rate.js.map +1 -1
  259. package/dist/services/totals.d.ts +194 -59
  260. package/dist/services/totals.js +581 -106
  261. package/dist/services/totals.js.map +1 -1
  262. package/dist/subscribers/region.d.ts +14 -0
  263. package/dist/subscribers/region.js +65 -0
  264. package/dist/subscribers/region.js.map +1 -0
  265. package/dist/types/cart.d.ts +2 -1
  266. package/dist/types/cart.js +6 -1
  267. package/dist/types/cart.js.map +1 -1
  268. package/dist/types/common.d.ts +5 -1
  269. package/dist/types/common.js +22 -7
  270. package/dist/types/common.js.map +1 -1
  271. package/dist/types/customer-groups.d.ts +11 -0
  272. package/dist/types/customer-groups.js +43 -0
  273. package/dist/types/customer-groups.js.map +1 -0
  274. package/dist/types/orders.d.ts +2 -0
  275. package/dist/types/orders.js +6 -1
  276. package/dist/types/orders.js.map +1 -1
  277. package/dist/types/product.d.ts +6 -0
  278. package/dist/types/product.js +25 -1
  279. package/dist/types/product.js.map +1 -1
  280. package/dist/utils/format-registration-name.js +3 -0
  281. package/dist/utils/format-registration-name.js.map +1 -1
  282. package/package.json +5 -4
  283. package/yarn-error.log +5 -79
  284. package/dist/api/routes/admin/product-tags/create-collection.d.ts +0 -41
  285. package/dist/api/routes/admin/product-tags/create-collection.js.map +0 -1
  286. package/dist/api/routes/admin/product-tags/delete-collection.d.ts +0 -28
  287. package/dist/api/routes/admin/product-tags/delete-collection.js.map +0 -1
  288. package/dist/api/routes/admin/product-tags/get-collection.d.ts +0 -22
  289. package/dist/api/routes/admin/product-tags/get-collection.js.map +0 -1
  290. package/dist/api/routes/admin/product-tags/list-collections.d.ts +0 -40
  291. package/dist/api/routes/admin/product-tags/list-collections.js.map +0 -1
  292. package/dist/api/routes/admin/product-tags/update-collection.d.ts +0 -41
  293. package/dist/api/routes/admin/product-tags/update-collection.js.map +0 -1
@@ -213,7 +213,22 @@ var TaxRateRepository = /** @class */ (function (_super) {
213
213
  }
214
214
  return qb;
215
215
  };
216
- TaxRateRepository.prototype.addToProduct = function (id, productIds) {
216
+ TaxRateRepository.prototype.removeFromProduct = function (id, productIds) {
217
+ return __awaiter(this, void 0, void 0, function () {
218
+ return __generator(this, function (_a) {
219
+ switch (_a.label) {
220
+ case 0: return [4 /*yield*/, this.createQueryBuilder()
221
+ .delete()
222
+ .from(product_tax_rate_1.ProductTaxRate)
223
+ .where({ rate_id: id, product_id: (0, typeorm_1.In)(productIds) })
224
+ .execute()];
225
+ case 1: return [2 /*return*/, _a.sent()];
226
+ }
227
+ });
228
+ });
229
+ };
230
+ TaxRateRepository.prototype.addToProduct = function (id, productIds, overrideExisting) {
231
+ if (overrideExisting === void 0) { overrideExisting = false; }
217
232
  return __awaiter(this, void 0, void 0, function () {
218
233
  var toInsert, insertResult;
219
234
  return __generator(this, function (_a) {
@@ -222,22 +237,47 @@ var TaxRateRepository = /** @class */ (function (_super) {
222
237
  toInsert = productIds.map(function (pId) { return ({ rate_id: id, product_id: pId }); });
223
238
  return [4 /*yield*/, this.createQueryBuilder()
224
239
  .insert()
240
+ .orIgnore(true)
225
241
  .into(product_tax_rate_1.ProductTaxRate)
226
242
  .values(toInsert)
227
243
  .execute()];
228
244
  case 1:
229
245
  insertResult = _a.sent();
230
- return [4 /*yield*/, this.manager
231
- .createQueryBuilder(product_tax_rate_1.ProductTaxRate, "ptr")
232
- .select()
233
- .where(insertResult.identifiers)
234
- .getMany()];
235
- case 2: return [2 /*return*/, _a.sent()];
246
+ if (!overrideExisting) return [3 /*break*/, 3];
247
+ return [4 /*yield*/, this.createQueryBuilder()
248
+ .delete()
249
+ .from(product_tax_rate_1.ProductTaxRate)
250
+ .where({ rate_id: id, product_id: (0, typeorm_1.Not)((0, typeorm_1.In)(productIds)) })
251
+ .execute()];
252
+ case 2:
253
+ _a.sent();
254
+ _a.label = 3;
255
+ case 3: return [4 /*yield*/, this.manager
256
+ .createQueryBuilder(product_tax_rate_1.ProductTaxRate, "ptr")
257
+ .select()
258
+ .where(insertResult.identifiers)
259
+ .getMany()];
260
+ case 4: return [2 /*return*/, _a.sent()];
261
+ }
262
+ });
263
+ });
264
+ };
265
+ TaxRateRepository.prototype.removeFromProductType = function (id, productTypeIds) {
266
+ return __awaiter(this, void 0, void 0, function () {
267
+ return __generator(this, function (_a) {
268
+ switch (_a.label) {
269
+ case 0: return [4 /*yield*/, this.createQueryBuilder()
270
+ .delete()
271
+ .from(product_type_tax_rate_1.ProductTypeTaxRate)
272
+ .where({ rate_id: id, product_type_id: (0, typeorm_1.In)(productTypeIds) })
273
+ .execute()];
274
+ case 1: return [2 /*return*/, _a.sent()];
236
275
  }
237
276
  });
238
277
  });
239
278
  };
240
- TaxRateRepository.prototype.addToProductType = function (id, productTypeIds) {
279
+ TaxRateRepository.prototype.addToProductType = function (id, productTypeIds, overrideExisting) {
280
+ if (overrideExisting === void 0) { overrideExisting = false; }
241
281
  return __awaiter(this, void 0, void 0, function () {
242
282
  var toInsert, insertResult;
243
283
  return __generator(this, function (_a) {
@@ -249,22 +289,47 @@ var TaxRateRepository = /** @class */ (function (_super) {
249
289
  }); });
250
290
  return [4 /*yield*/, this.createQueryBuilder()
251
291
  .insert()
292
+ .orIgnore(true)
252
293
  .into(product_type_tax_rate_1.ProductTypeTaxRate)
253
294
  .values(toInsert)
254
295
  .execute()];
255
296
  case 1:
256
297
  insertResult = _a.sent();
257
- return [4 /*yield*/, this.manager
258
- .createQueryBuilder(product_type_tax_rate_1.ProductTypeTaxRate, "ptr")
259
- .select()
260
- .where(insertResult.identifiers)
261
- .getMany()];
262
- case 2: return [2 /*return*/, _a.sent()];
298
+ if (!overrideExisting) return [3 /*break*/, 3];
299
+ return [4 /*yield*/, this.createQueryBuilder()
300
+ .delete()
301
+ .from(product_type_tax_rate_1.ProductTypeTaxRate)
302
+ .where({ rate_id: id, product_type_id: (0, typeorm_1.Not)((0, typeorm_1.In)(productTypeIds)) })
303
+ .execute()];
304
+ case 2:
305
+ _a.sent();
306
+ _a.label = 3;
307
+ case 3: return [4 /*yield*/, this.manager
308
+ .createQueryBuilder(product_type_tax_rate_1.ProductTypeTaxRate, "ptr")
309
+ .select()
310
+ .where(insertResult.identifiers)
311
+ .getMany()];
312
+ case 4: return [2 /*return*/, _a.sent()];
263
313
  }
264
314
  });
265
315
  });
266
316
  };
267
- TaxRateRepository.prototype.addToShippingOption = function (id, optionIds) {
317
+ TaxRateRepository.prototype.removeFromShippingOption = function (id, optionIds) {
318
+ return __awaiter(this, void 0, void 0, function () {
319
+ return __generator(this, function (_a) {
320
+ switch (_a.label) {
321
+ case 0: return [4 /*yield*/, this.createQueryBuilder()
322
+ .delete()
323
+ .from(shipping_tax_rate_1.ShippingTaxRate)
324
+ .where({ rate_id: id, shipping_option_id: (0, typeorm_1.In)(optionIds) })
325
+ .execute()];
326
+ case 1: return [2 /*return*/, _a.sent()];
327
+ }
328
+ });
329
+ });
330
+ };
331
+ TaxRateRepository.prototype.addToShippingOption = function (id, optionIds, overrideExisting) {
332
+ if (overrideExisting === void 0) { overrideExisting = false; }
268
333
  return __awaiter(this, void 0, void 0, function () {
269
334
  var toInsert, insertResult;
270
335
  return __generator(this, function (_a) {
@@ -276,17 +341,27 @@ var TaxRateRepository = /** @class */ (function (_super) {
276
341
  }); });
277
342
  return [4 /*yield*/, this.createQueryBuilder()
278
343
  .insert()
344
+ .orIgnore(true)
279
345
  .into(shipping_tax_rate_1.ShippingTaxRate)
280
346
  .values(toInsert)
281
347
  .execute()];
282
348
  case 1:
283
349
  insertResult = _a.sent();
284
- return [4 /*yield*/, this.manager
285
- .createQueryBuilder(shipping_tax_rate_1.ShippingTaxRate, "str")
286
- .select()
287
- .where(insertResult.identifiers)
288
- .getMany()];
289
- case 2: return [2 /*return*/, _a.sent()];
350
+ if (!overrideExisting) return [3 /*break*/, 3];
351
+ return [4 /*yield*/, this.createQueryBuilder()
352
+ .delete()
353
+ .from(shipping_tax_rate_1.ShippingTaxRate)
354
+ .where({ rate_id: id, shipping_option_id: (0, typeorm_1.Not)((0, typeorm_1.In)(optionIds)) })
355
+ .execute()];
356
+ case 2:
357
+ _a.sent();
358
+ _a.label = 3;
359
+ case 3: return [4 /*yield*/, this.manager
360
+ .createQueryBuilder(shipping_tax_rate_1.ShippingTaxRate, "str")
361
+ .select()
362
+ .where(insertResult.identifiers)
363
+ .getMany()];
364
+ case 4: return [2 /*return*/, _a.sent()];
290
365
  }
291
366
  });
292
367
  });
@@ -1 +1 @@
1
- {"version":3,"file":"tax-rate.js","sourceRoot":"","sources":["../../src/repositories/tax-rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgC;AAChC,mCAMgB;AAChB,+CAA4C;AAC5C,+DAA2D;AAC3D,yEAAoE;AACpE,iEAA6D;AAC7D,6CAA2C;AAC3C,6DAA0D;AAG1D,IAAM,iBAAiB,GAAG;IACxB,eAAe;IACf,oBAAoB;IACpB,uBAAuB;CACxB,CAAA;AAGD;IAAuC,qCAAmB;IAA1D;;IAwLA,CAAC;IAvLC,+CAAmB,GAAnB,UAAoB,WAAqC;;QACvD,IAAI,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAA;QACtC,IAAM,YAAY,GAAG,WAAW,CAAA;QAEhC,IAAM,cAAc,GAAa,EAAE,CAAA;QACnC,IA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5B,sBAAO,SAAqB,EAAA;;;;KAC7B;IAtPU,iBAAiB;QAD7B,IAAA,0BAAgB,EAAC,kBAAO,CAAC;OACb,iBAAiB,CAuP7B;IAAD,wBAAC;CAAA,AAvPD,CAAuC,oBAAU,GAuPhD;AAvPY,8CAAiB"}
@@ -20,6 +20,7 @@ import LineItemService from "./line-item";
20
20
  import PaymentProviderService from "./payment-provider";
21
21
  import ShippingOptionService from "./shipping-option";
22
22
  import CustomerService from "./customer";
23
+ import TaxProviderService from "./tax-provider";
23
24
  import DiscountService from "./discount";
24
25
  import GiftCardService from "./gift-card";
25
26
  import TotalsService from "./totals";
@@ -32,6 +33,7 @@ declare type CartConstructorProps = {
32
33
  addressRepository: typeof AddressRepository;
33
34
  paymentSessionRepository: typeof PaymentSessionRepository;
34
35
  eventBusService: EventBusService;
36
+ taxProviderService: TaxProviderService;
35
37
  paymentProviderService: PaymentProviderService;
36
38
  productService: ProductService;
37
39
  productVariantService: ProductVariantService;
@@ -45,6 +47,9 @@ declare type CartConstructorProps = {
45
47
  inventoryService: InventoryService;
46
48
  customShippingOptionService: CustomShippingOptionService;
47
49
  };
50
+ declare type TotalsConfig = {
51
+ force_taxes?: boolean;
52
+ };
48
53
  declare class CartService extends BaseService {
49
54
  static Events: {
50
55
  CUSTOMER_UPDATED: string;
@@ -64,83 +69,67 @@ declare class CartService extends BaseService {
64
69
  private shippingOptionService_;
65
70
  private discountService_;
66
71
  private giftCardService_;
72
+ private taxProviderService_;
67
73
  private totalsService_;
68
74
  private addressRepository_;
69
75
  private paymentSessionRepository_;
70
76
  private inventoryService_;
71
77
  private customShippingOptionService_;
72
- constructor({ manager, cartRepository, shippingMethodRepository, eventBusService, paymentProviderService, productService, productVariantService, regionService, lineItemService, shippingOptionService, customerService, discountService, giftCardService, totalsService, addressRepository, paymentSessionRepository, inventoryService, customShippingOptionService, }: CartConstructorProps);
78
+ constructor({ manager, cartRepository, shippingMethodRepository, eventBusService, paymentProviderService, productService, productVariantService, taxProviderService, regionService, lineItemService, shippingOptionService, customerService, discountService, giftCardService, totalsService, addressRepository, paymentSessionRepository, inventoryService, customShippingOptionService, }: CartConstructorProps);
73
79
  withTransaction(transactionManager: EntityManager): CartService;
74
- /**
75
- * Used to validate cart ids. Throws an error if the cast fails
76
- * @param {string} rawId - the raw cart id to validate.
77
- * @return {string} the validated id
78
- */
79
- /**
80
- * Contents of a line item
81
- * @typedef {(object | array)} LineItemContent
82
- * @property {number} unit_price - the price of the content
83
- * @property {object} variant - the product variant of the content
84
- * @property {object} product - the product of the content
85
- * @property {number} quantity - the quantity of the content
86
- */
87
- /**
88
- * A collection of contents grouped in the same line item
89
- * @typedef {LineItemContent[]} LineItemContentArray
90
- */
91
80
  transformQueryForTotals_(config: FindConfig<Cart>): FindConfig<Cart> & {
92
81
  totalsToSelect: TotalField[];
93
82
  };
94
- decorateTotals_(cart: Cart, totalsToSelect: TotalField[]): Promise<Cart>;
83
+ decorateTotals_(cart: Cart, totalsToSelect: TotalField[], options?: TotalsConfig): Promise<Cart>;
95
84
  /**
96
- * @param {Object} selector - the query object for find
97
- * @param {Object} config - config object
98
- * @return {Promise} the result of the find operation
85
+ * @param selector - the query object for find
86
+ * @param config - config object
87
+ * @return the result of the find operation
99
88
  */
100
89
  list(selector: FilterableCartProps, config?: FindConfig<Cart>): Promise<Cart[]>;
101
90
  /**
102
91
  * Gets a cart by id.
103
- * @param {string} cartId - the id of the cart to get.
104
- * @param {Object} options - the options to get a cart
105
- * @return {Promise<Cart>} the cart document.
92
+ * @param cartId - the id of the cart to get.
93
+ * @param options - the options to get a cart
94
+ * @param totalsConfig - configuration for retrieval of totals
95
+ * @return the cart document.
106
96
  */
107
- retrieve(cartId: string, options?: FindConfig<Cart>): Promise<Cart>;
97
+ retrieve(cartId: string, options?: FindConfig<Cart>, totalsConfig?: TotalsConfig): Promise<Cart>;
108
98
  /**
109
99
  * Creates a cart.
110
- * @param {Object} data - the data to create the cart with
111
- * @return {Promise} the result of the create operation
100
+ * @param data - the data to create the cart with
101
+ * @return the result of the create operation
112
102
  */
113
103
  create(data: CartCreateProps): Promise<Cart>;
114
104
  /**
115
105
  * Removes a line item from the cart.
116
- * @param {string} cartId - the id of the cart that we will remove from
117
- * @param {LineItem} lineItemId - the line item to remove.
118
- * @return {Promise} the result of the update operation
106
+ * @param cartId - the id of the cart that we will remove from
107
+ * @param lineItemId - the line item to remove.
108
+ * @return the result of the update operation
119
109
  */
120
110
  removeLineItem(cartId: string, lineItemId: string): Promise<Cart>;
121
111
  /**
122
112
  * Checks if a given line item has a shipping method that can fulfill it.
123
113
  * Returns true if all products in the cart can be fulfilled with the current
124
114
  * shipping methods.
125
- * @param {ShippingMethod[]} shippingMethods - the set of shipping methods to check from
126
- * @param {LineItem} lineItem - the line item
127
- * @return {boolean}
115
+ * @param shippingMethods - the set of shipping methods to check from
116
+ * @param lineItem - the line item
117
+ * @return boolean representing wheter shipping method is validated
128
118
  */
129
119
  validateLineItemShipping_(shippingMethods: ShippingMethod[], lineItem: LineItem): boolean;
130
120
  /**
131
121
  * Adds a line item to the cart.
132
- * @param {string} cartId - the id of the cart that we will add to
133
- * @param {LineItem} lineItem - the line item to add.
134
- * @return {Promise} the result of the update operation
122
+ * @param cartId - the id of the cart that we will add to
123
+ * @param lineItem - the line item to add.
124
+ * @return the result of the update operation
135
125
  */
136
126
  addLineItem(cartId: string, lineItem: LineItem): Promise<Cart>;
137
127
  /**
138
128
  * Updates a cart's existing line item.
139
- * @param {string} cartId - the id of the cart to update
140
- * @param {string} lineItemId - the id of the line item to update.
141
- * @param {LineItemUpdate} lineItemUpdate - the line item to update. Must
142
- * include an id field.
143
- * @return {Promise} the result of the update operation
129
+ * @param cartId - the id of the cart to update
130
+ * @param lineItemId - the id of the line item to update.
131
+ * @param lineItemUpdate - the line item to update. Must include an id field.
132
+ * @return the result of the update operation
144
133
  */
145
134
  updateLineItem(cartId: string, lineItemId: string, lineItemUpdate: LineItemUpdate): Promise<Cart>;
146
135
  /**
@@ -148,42 +137,39 @@ declare class CartService extends BaseService {
148
137
  * shipping discount
149
138
  * If a free shipping is present, we set shipping methods price to 0
150
139
  * if a free shipping was present, we set shipping methods to original amount
151
- * @param {Cart} cart - the the cart to adjust free shipping for
152
- * @param {boolean} shouldAdd - flag to indicate, if we should add or remove
140
+ * @param cart - the the cart to adjust free shipping for
141
+ * @param shouldAdd - flag to indicate, if we should add or remove
142
+ * @return void
153
143
  */
154
144
  adjustFreeShipping_(cart: Cart, shouldAdd: boolean): Promise<void>;
155
145
  update(cartId: string, update: CartUpdateProps): Promise<Cart>;
156
146
  /**
157
147
  * Sets the customer id of a cart
158
- * @param {Cart} cart - the cart to add email to
159
- * @param {string} customerId - the customer to add to cart
160
- * @return {Promise} the result of the update operation
148
+ * @param cart - the cart to add email to
149
+ * @param customerId - the customer to add to cart
150
+ * @return the result of the update operation
161
151
  */
162
152
  updateCustomerId_(cart: Cart, customerId: string): Promise<void>;
163
153
  /**
164
154
  * Creates or fetches a user based on an email.
165
- * @param {string} email - the email to use
166
- * @return {Promise} the resultign customer object
155
+ * @param email - the email to use
156
+ * @return the resultign customer object
167
157
  */
168
158
  createOrFetchUserFromEmail_(email: string): Promise<Customer>;
169
159
  /**
170
160
  * Updates the cart's billing address.
171
- * @param {Cart} cart - the cart to update
172
- * @param {Address | string} addressOrId - the value to set the billing
173
- * address to
174
- * @param {AddressRepository} addrRepo - the repository to use for address
175
- * updates
176
- * @return {Promise} the result of the update operation
161
+ * @param cart - the cart to update
162
+ * @param addressOrId - the value to set the billing address to
163
+ * @param addrRepo - the repository to use for address updates
164
+ * @return the result of the update operation
177
165
  */
178
166
  updateBillingAddress_(cart: Cart, addressOrId: Partial<Address> | string, addrRepo: AddressRepository): Promise<void>;
179
167
  /**
180
168
  * Updates the cart's shipping address.
181
- * @param {Cart} cart - the cart to update
182
- * @param {Address | string} addressOrId - the value to set the shipping
183
- * address to
184
- * @param {AddressRepository} addrRepo - the repository to use for address
185
- * updates
186
- * @return {Promise} the result of the update operation
169
+ * @param cart - the cart to update
170
+ * @param addressOrId - the value to set the shipping address to
171
+ * @param addrRepo - the repository to use for address updates
172
+ * @return the result of the update operation
187
173
  */
188
174
  updateShippingAddress_(cart: Cart, addressOrId: Partial<Address> | string, addrRepo: AddressRepository): Promise<void>;
189
175
  applyGiftCard_(cart: Cart, code: string): Promise<void>;
@@ -192,30 +178,23 @@ declare class CartService extends BaseService {
192
178
  * If discount besides free shipping is already applied, this
193
179
  * will be overwritten
194
180
  * Throws if discount regions does not include the cart region
195
- * @param {Cart} cart - the cart to update
196
- * @param {string} discountCode - the discount code
197
- * @return {Promise} the result of the update operation
181
+ * @param cart - the cart to update
182
+ * @param discountCode - the discount code
183
+ * @return the result of the update operation
198
184
  */
199
185
  applyDiscount(cart: Cart, discountCode: string): Promise<void>;
200
186
  /**
201
187
  * Removes a discount based on a discount code.
202
- * @param {string} cartId - the id of the cart to remove from
203
- * @param {string} discountCode - the discount code to remove
204
- * @return {Promise<Cart>} the resulting cart
188
+ * @param cartId - the id of the cart to remove from
189
+ * @param discountCode - the discount code to remove
190
+ * @return the resulting cart
205
191
  */
206
192
  removeDiscount(cartId: string, discountCode: string): Promise<Cart>;
207
- /**
208
- * A payment method represents a way for the customer to pay. The payment
209
- * method will typically come from one of the payment sessions.
210
- * @typedef {object} PaymentMethod
211
- * @property {string} provider_id - the identifier of the payment method's
212
- * provider
213
- * @property {object} data - the data associated with the payment method
214
- */
215
193
  /**
216
194
  * Updates the currently selected payment session.
217
- * @param {string} cartId - the id of the cart to update the payment session for
218
- * @param {object} update - the data to update the payment session with
195
+ * @param cartId - the id of the cart to update the payment session for
196
+ * @param update - the data to update the payment session with
197
+ * @return the resulting cart
219
198
  */
220
199
  updatePaymentSession(cartId: string, update: object): Promise<Cart>;
221
200
  /**
@@ -224,18 +203,18 @@ declare class CartService extends BaseService {
224
203
  * a payment object, that we will use to update our cart payment with.
225
204
  * Additionally, if the payment does not require more or fails, we will
226
205
  * set the payment on the cart.
227
- * @param {string} cartId - the id of the cart to authorize payment for
228
- * @param {object} context - object containing whatever is relevant for
206
+ * @param cartId - the id of the cart to authorize payment for
207
+ * @param context - object containing whatever is relevant for
229
208
  * authorizing the payment with the payment provider. As an example,
230
209
  * this could be IP address or similar for fraud handling.
231
- * @return {Promise<Cart>} the resulting cart
210
+ * @return the resulting cart
232
211
  */
233
- authorizePayment(cartId: string, context?: object): Promise<Cart>;
212
+ authorizePayment(cartId: string, context?: Record<string, any>): Promise<Cart>;
234
213
  /**
235
214
  * Sets a payment method for a cart.
236
- * @param {string} cartId - the id of the cart to add payment method to
237
- * @param {string} providerId - the id of the provider to be set to the cart
238
- * @return {Promise} result of update operation
215
+ * @param cartId - the id of the cart to add payment method to
216
+ * @param providerId - the id of the provider to be set to the cart
217
+ * @return result of update operation
239
218
  */
240
219
  setPaymentSession(cartId: string, providerId: string): Promise<Cart>;
241
220
  /**
@@ -244,23 +223,22 @@ declare class CartService extends BaseService {
244
223
  * provider. Additional calls will ensure that payment sessions have correct
245
224
  * amounts, currencies, etc. as well as make sure to filter payment sessions
246
225
  * that are not available for the cart's region.
247
- * @param {Cart | string} cartOrCartId - the id of the cart to set payment
248
- * session for
249
- * @return {Promise} the result of the update operation.
226
+ * @param cartOrCartId - the id of the cart to set payment session for
227
+ * @return the result of the update operation.
250
228
  */
251
229
  setPaymentSessions(cartOrCartId: Cart | string): Promise<Cart>;
252
230
  /**
253
231
  * Removes a payment session from the cart.
254
- * @param {string} cartId - the id of the cart to remove from
255
- * @param {string} providerId - the id of the provider whoose payment session
232
+ * @param cartId - the id of the cart to remove from
233
+ * @param providerId - the id of the provider whoose payment session
256
234
  * should be removed.
257
- * @return {Promise<Cart>} the resulting cart.
235
+ * @return the resulting cart.
258
236
  */
259
237
  deletePaymentSession(cartId: string, providerId: string): Promise<Cart>;
260
238
  /**
261
239
  * Refreshes a payment session on a cart
262
- * @param {string} cartId - the id of the cart to remove from
263
- * @param {string} providerId - the id of the provider whoose payment session
240
+ * @param cartId - the id of the cart to remove from
241
+ * @param providerId - the id of the provider whoose payment session
264
242
  * should be removed.
265
243
  * @return {Promise<Cart>} the resulting cart.
266
244
  */
@@ -271,50 +249,50 @@ declare class CartService extends BaseService {
271
249
  * Shipping Option is a possible way to ship an order. Shipping Methods may
272
250
  * also have additional details in the data field such as an id for a package
273
251
  * shop.
274
- * @param {string} cartId - the id of the cart to add shipping method to
275
- * @param {string} optionId - id of shipping option to add as valid method
276
- * @param {Object} data - the fulmillment data for the method
277
- * @return {Promise} the result of the update operation
252
+ * @param cartId - the id of the cart to add shipping method to
253
+ * @param optionId - id of shipping option to add as valid method
254
+ * @param data - the fulmillment data for the method
255
+ * @return the result of the update operation
278
256
  */
279
- addShippingMethod(cartId: string, optionId: string, data?: object): Promise<Cart>;
257
+ addShippingMethod(cartId: string, optionId: string, data?: Record<string, any>): Promise<Cart>;
280
258
  /**
281
259
  * Finds the cart's custom shipping options based on the passed option id.
282
260
  * throws if custom options is not empty and no shipping option corresponds to optionId
283
- * @param {Object} cartCustomShippingOptions - the cart's custom shipping options
284
- * @param {string} optionId - id of the normal or custom shipping option to find in the cartCustomShippingOptions
285
- * @return {CustomShippingOption | undefined}
261
+ * @param cartCustomShippingOptions - the cart's custom shipping options
262
+ * @param optionId - id of the normal or custom shipping option to find in the cartCustomShippingOptions
263
+ * @return custom shipping option
286
264
  */
287
265
  findCustomShippingOption(cartCustomShippingOptions: CustomShippingOption[], optionId: string): CustomShippingOption | undefined;
288
266
  /**
289
267
  * Set's the region of a cart.
290
- * @param {Cart} cart - the cart to set region on
291
- * @param {string} regionId - the id of the region to set the region to
292
- * @param {string} countryCode - the country code to set the country to
293
- * @return {Promise} the result of the update operation
268
+ * @param cart - the cart to set region on
269
+ * @param regionId - the id of the region to set the region to
270
+ * @param countryCode - the country code to set the country to
271
+ * @return the result of the update operation
294
272
  */
295
273
  setRegion_(cart: Cart, regionId: string, countryCode: string | null): Promise<void>;
296
274
  /**
297
275
  * Deletes a cart from the database. Completed carts cannot be deleted.
298
- * @param {string} cartId - the id of the cart to delete
299
- * @return {Promise<string>} the deleted cart or undefined if the cart was
300
- * not found.
276
+ * @param cartId - the id of the cart to delete
277
+ * @return the deleted cart or undefined if the cart was not found.
301
278
  */
302
279
  delete(cartId: string): Promise<string>;
303
280
  /**
304
281
  * Dedicated method to set metadata for a cart.
305
282
  * To ensure that plugins does not overwrite each
306
283
  * others metadata fields, setMetadata is provided.
307
- * @param {string} cartId - the cart to apply metadata to.
308
- * @param {string} key - key for metadata field
309
- * @param {string} value - value for metadata field.
310
- * @return {Promise} resolves to the updated result.
284
+ * @param cartId - the cart to apply metadata to.
285
+ * @param key - key for metadata field
286
+ * @param value - value for metadata field.
287
+ * @return resolves to the updated result.
311
288
  */
312
289
  setMetadata(cartId: string, key: string, value: string | number): Promise<Cart>;
290
+ createTaxLines(id: string): Promise<Cart>;
313
291
  /**
314
292
  * Dedicated method to delete metadata for a cart.
315
- * @param {string} cartId - the cart to delete metadata from.
316
- * @param {string} key - key for metadata field
317
- * @return {Promise} resolves to the updated result.
293
+ * @param cartId - the cart to delete metadata from.
294
+ * @param key - key for metadata field
295
+ * @return resolves to the updated result.
318
296
  */
319
297
  deleteMetadata(cartId: string, key: string): Promise<Cart>;
320
298
  }