@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
@@ -14,31 +14,12 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
17
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
30
18
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
31
19
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
32
20
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
33
21
  return c > 3 && r && Object.defineProperty(target, key, r), r;
34
22
  };
35
- var __importStar = (this && this.__importStar) || function (mod) {
36
- if (mod && mod.__esModule) return mod;
37
- var result = {};
38
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
39
- __setModuleDefault(result, mod);
40
- return result;
41
- };
42
23
  var __metadata = (this && this.__metadata) || function (k, v) {
43
24
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
44
25
  };
@@ -95,29 +76,30 @@ var __read = (this && this.__read) || function (o, n) {
95
76
  return ar;
96
77
  };
97
78
  Object.defineProperty(exports, "__esModule", { value: true });
98
- exports.AdminGetCollectionsParams = exports.AdminGetCollectionsPaginationParams = void 0;
79
+ exports.AdminGetProductTypesParams = exports.AdminGetProductTypesPaginationParams = void 0;
99
80
  var class_transformer_1 = require("class-transformer");
81
+ var medusa_core_utils_1 = require("medusa-core-utils");
100
82
  var class_validator_1 = require("class-validator");
101
- var lodash_1 = __importStar(require("lodash"));
83
+ var lodash_1 = require("lodash");
102
84
  var _1 = require(".");
103
85
  var common_1 = require("../../../../types/common");
104
86
  var validator_1 = require("../../../../utils/validator");
87
+ var is_type_1 = require("../../../../utils/validators/is-type");
105
88
  /**
106
- * @oas [get] /collections
107
- * operationId: "GetCollections"
108
- * summary: "List Product Collections"
109
- * description: "Retrieve a list of Product Collection."
89
+ * @oas [get] /product-types
90
+ * operationId: "GetProductTypes"
91
+ * summary: "List Product Types"
92
+ * description: "Retrieve a list of Product Types."
110
93
  * x-authenticated: true
111
94
  * parameters:
112
- * - (query) limit {string} The number of collections to return.
113
- * - (query) offset {string} The offset of collections to return.
114
- * - (query) title {string} The title of collections to return.
115
- * - (query) handle {string} The handle of collections to return.
116
- * - (query) deleted_at {DateComparisonOperator} Date comparison for when resulting collections was deleted, i.e. less than, greater than etc.
117
- * - (query) created_at {DateComparisonOperator} Date comparison for when resulting collections was created, i.e. less than, greater than etc.
118
- * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting collections was updated, i.e. less than, greater than etc.
95
+ * - (query) limit {string} The number of types to return.
96
+ * - (query) offset {string} The offset of types to return.
97
+ * - (query) value {string} The value of types to return.
98
+ * - (query) id {string} The id of types to return.
99
+ * - (query) created_at {DateComparisonOperator} Date comparison for when resulting tas was created, i.e. less than, greater than etc.
100
+ * - (query) updated_at {DateComparisonOperator} Date comparison for when resulting tas was updated, i.e. less than, greater than etc.
119
101
  * tags:
120
- * - Collection
102
+ * - Product Tag
121
103
  * responses:
122
104
  * "200":
123
105
  * description: OK
@@ -125,29 +107,44 @@ var validator_1 = require("../../../../utils/validator");
125
107
  * application/json:
126
108
  * schema:
127
109
  * properties:
128
- * collection:
129
- * $ref: "#/components/schemas/product_collection"
110
+ * types:
111
+ * $ref: "#/components/schemas/product_tag"
130
112
  */
131
113
  exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
132
- var validated, productCollectionService, listConfig, filterableFields, _a, collections, count;
133
- return __generator(this, function (_b) {
134
- switch (_b.label) {
135
- case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminGetCollectionsParams, req.query)];
114
+ var validated, typeService, listConfig, orderField, _a, field, filterableFields, _b, types, count;
115
+ var _c, _d;
116
+ return __generator(this, function (_e) {
117
+ switch (_e.label) {
118
+ case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminGetProductTypesParams, req.query)];
136
119
  case 1:
137
- validated = _b.sent();
138
- productCollectionService = req.scope.resolve("productCollectionService");
120
+ validated = _e.sent();
121
+ typeService = req.scope.resolve("productTypeService");
139
122
  listConfig = {
140
- select: _1.defaultAdminCollectionsFields,
141
- relations: _1.defaultAdminCollectionsRelations,
123
+ select: _1.defaultAdminProductTypeFields,
124
+ relations: _1.defaultAdminProductTypeRelations,
142
125
  skip: validated.offset,
143
126
  take: validated.limit,
144
127
  };
145
- filterableFields = lodash_1.default.omit(validated, ["limit", "offset"]);
146
- return [4 /*yield*/, productCollectionService.listAndCount(lodash_1.default.pickBy(filterableFields, lodash_1.identity), listConfig)];
128
+ if (typeof validated.order !== "undefined") {
129
+ orderField = validated.order;
130
+ if (validated.order.startsWith("-")) {
131
+ _a = __read(validated.order.split("-"), 2), field = _a[1];
132
+ orderField = field;
133
+ listConfig.order = (_c = {}, _c[field] = "DESC", _c);
134
+ }
135
+ else {
136
+ listConfig.order = (_d = {}, _d[validated.order] = "ASC", _d);
137
+ }
138
+ if (!_1.allowedAdminProductTypeFields.includes(orderField)) {
139
+ throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.INVALID_DATA, "Order field must be a valid product type field");
140
+ }
141
+ }
142
+ filterableFields = (0, lodash_1.omit)(validated, ["limit", "offset"]);
143
+ return [4 /*yield*/, typeService.listAndCount((0, lodash_1.pickBy)(filterableFields, lodash_1.identity), listConfig)];
147
144
  case 2:
148
- _a = __read.apply(void 0, [_b.sent(), 2]), collections = _a[0], count = _a[1];
145
+ _b = __read.apply(void 0, [_e.sent(), 2]), types = _b[0], count = _b[1];
149
146
  res.status(200).json({
150
- collections: collections,
147
+ product_types: types,
151
148
  count: count,
152
149
  offset: validated.offset,
153
150
  limit: validated.limit,
@@ -156,8 +153,8 @@ exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0
156
153
  }
157
154
  });
158
155
  }); });
159
- var AdminGetCollectionsPaginationParams = /** @class */ (function () {
160
- function AdminGetCollectionsPaginationParams() {
156
+ var AdminGetProductTypesPaginationParams = /** @class */ (function () {
157
+ function AdminGetProductTypesPaginationParams() {
161
158
  this.limit = 10;
162
159
  this.offset = 0;
163
160
  }
@@ -166,50 +163,49 @@ var AdminGetCollectionsPaginationParams = /** @class */ (function () {
166
163
  (0, class_validator_1.IsOptional)(),
167
164
  (0, class_transformer_1.Type)(function () { return Number; }),
168
165
  __metadata("design:type", Object)
169
- ], AdminGetCollectionsPaginationParams.prototype, "limit", void 0);
166
+ ], AdminGetProductTypesPaginationParams.prototype, "limit", void 0);
170
167
  __decorate([
171
168
  (0, class_validator_1.IsNumber)(),
172
169
  (0, class_validator_1.IsOptional)(),
173
170
  (0, class_transformer_1.Type)(function () { return Number; }),
174
171
  __metadata("design:type", Object)
175
- ], AdminGetCollectionsPaginationParams.prototype, "offset", void 0);
176
- return AdminGetCollectionsPaginationParams;
172
+ ], AdminGetProductTypesPaginationParams.prototype, "offset", void 0);
173
+ return AdminGetProductTypesPaginationParams;
177
174
  }());
178
- exports.AdminGetCollectionsPaginationParams = AdminGetCollectionsPaginationParams;
179
- var AdminGetCollectionsParams = /** @class */ (function (_super) {
180
- __extends(AdminGetCollectionsParams, _super);
181
- function AdminGetCollectionsParams() {
175
+ exports.AdminGetProductTypesPaginationParams = AdminGetProductTypesPaginationParams;
176
+ var AdminGetProductTypesParams = /** @class */ (function (_super) {
177
+ __extends(AdminGetProductTypesParams, _super);
178
+ function AdminGetProductTypesParams() {
182
179
  return _super !== null && _super.apply(this, arguments) || this;
183
180
  }
184
181
  __decorate([
182
+ (0, class_validator_1.ValidateNested)(),
183
+ (0, is_type_1.IsType)([String, [String], common_1.StringComparisonOperator]),
185
184
  (0, class_validator_1.IsOptional)(),
186
- (0, class_validator_1.IsString)(),
187
- __metadata("design:type", String)
188
- ], AdminGetCollectionsParams.prototype, "title", void 0);
185
+ __metadata("design:type", Object)
186
+ ], AdminGetProductTypesParams.prototype, "id", void 0);
189
187
  __decorate([
188
+ (0, class_validator_1.ValidateNested)(),
189
+ (0, is_type_1.IsType)([String, [String], common_1.StringComparisonOperator]),
190
190
  (0, class_validator_1.IsOptional)(),
191
- (0, class_validator_1.IsString)(),
192
- __metadata("design:type", String)
193
- ], AdminGetCollectionsParams.prototype, "handle", void 0);
191
+ __metadata("design:type", Object)
192
+ ], AdminGetProductTypesParams.prototype, "value", void 0);
194
193
  __decorate([
194
+ (0, is_type_1.IsType)([common_1.DateComparisonOperator]),
195
195
  (0, class_validator_1.IsOptional)(),
196
- (0, class_validator_1.ValidateNested)(),
197
- (0, class_transformer_1.Type)(function () { return common_1.DateComparisonOperator; }),
198
196
  __metadata("design:type", common_1.DateComparisonOperator)
199
- ], AdminGetCollectionsParams.prototype, "created_at", void 0);
197
+ ], AdminGetProductTypesParams.prototype, "created_at", void 0);
200
198
  __decorate([
199
+ (0, is_type_1.IsType)([common_1.DateComparisonOperator]),
201
200
  (0, class_validator_1.IsOptional)(),
202
- (0, class_validator_1.ValidateNested)(),
203
- (0, class_transformer_1.Type)(function () { return common_1.DateComparisonOperator; }),
204
201
  __metadata("design:type", common_1.DateComparisonOperator)
205
- ], AdminGetCollectionsParams.prototype, "updated_at", void 0);
202
+ ], AdminGetProductTypesParams.prototype, "updated_at", void 0);
206
203
  __decorate([
207
- (0, class_validator_1.ValidateNested)(),
204
+ (0, class_validator_1.IsString)(),
208
205
  (0, class_validator_1.IsOptional)(),
209
- (0, class_transformer_1.Type)(function () { return common_1.DateComparisonOperator; }),
210
- __metadata("design:type", common_1.DateComparisonOperator)
211
- ], AdminGetCollectionsParams.prototype, "deleted_at", void 0);
212
- return AdminGetCollectionsParams;
213
- }(AdminGetCollectionsPaginationParams));
214
- exports.AdminGetCollectionsParams = AdminGetCollectionsParams;
215
- //# sourceMappingURL=list-collections.js.map
206
+ __metadata("design:type", String)
207
+ ], AdminGetProductTypesParams.prototype, "order", void 0);
208
+ return AdminGetProductTypesParams;
209
+ }(AdminGetProductTypesPaginationParams));
210
+ exports.AdminGetProductTypesParams = AdminGetProductTypesParams;
211
+ //# sourceMappingURL=list-product-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-product-types.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/product-types/list-product-types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAwC;AACxC,uDAA+C;AAC/C,mDAAgF;AAChF,iCAA+C;AAC/C,sBAIU;AAGV,mDAIiC;AACjC,yDAAuD;AACvD,gEAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;oBACV,qBAAM,IAAA,qBAAS,EAAC,0BAA0B,EAAE,GAAG,CAAC,KAAK,CAAC,EAAA;;gBAAlE,SAAS,GAAG,SAAsD;gBAElE,WAAW,GACf,GAAG,CAAC,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[
46
46
  "id",
47
47
  "name",
48
+ "automatic_taxes",
49
+ "gift_cards_taxable",
50
+ "tax_provider_id",
48
51
  "currency_code",
49
52
  "tax_rate",
50
53
  "tax_code",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/regions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mCAAgC;AAGhC,qEAA8C;AAC9C,4BAAyB;AAEzB,IAAM,KAAK,GAAG,IAAA,gBAAM,GAAE,CAAA;AAEtB,mBAAe,UAAC,GAAG;IACjB,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAE1B,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IACnE,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAE3E,KAAK,CAAC,GAAG,CACP,iCAAiC,EACjC,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC,OAAO,CAAC,CAC/D,CAAA;IAED,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IACrE,KAAK,CAAC,IAAI,CACR,aAAa,EACb,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CACrD,CAAA;IAED,KAAK,CAAC,MAAM,CACV,aAAa,EACb,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CACrD,CAAA;IAED,KAAK,CAAC,IAAI,CACR,uBAAuB,EACvB,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC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AiB;IACjB,eAAe;IACf,UAAU;IACV,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,UAAU;CACX,CAAA;AAEY,QAAA,2BAA2B,GAAG;IACzC,WAAW;IACX,mBAAmB;IACnB,uBAAuB;CACxB,CAAA;AAED;IAAA;IAEA,CAAC;IAAD,sBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,0CAAe;AAU5B;IAAA;IAGA,CAAC;IAAD,wBAAC;AAAD,CAAC,AAHD,IAGC;AAHY,8CAAiB;AAK9B;IAAA;IAEA,CAAC;IAAD,iDAAC;AAAD,CAAC,AAFD,IAEC;AAFY,gGAA0C;AAIvD,iDAA8B;AAC9B,kDAA+B;AAC/B,kDAA+B;AAC/B,gDAA6B;AAC7B,yDAAsC;AACtC,6DAA0C;AAC1C,iDAA8B"}
@@ -1,3 +1,4 @@
1
+ import { DateComparisonOperator } from "../../../../types/common";
1
2
  declare const _default: (req: any, res: any) => Promise<void>;
2
3
  /**
3
4
  * @oas [get] /regions
@@ -6,18 +7,36 @@ declare const _default: (req: any, res: any) => Promise<void>;
6
7
  * description: "Retrieves a list of Regions."
7
8
  * x-authenticated: true
8
9
  * parameters:
9
- * - in: path
10
+ * - in: query
10
11
  * name: limit
11
12
  * schema:
12
13
  * type: integer
13
14
  * required: false
14
15
  * description: limit the number of regions in response
15
- * - in: path
16
+ * - in: query
16
17
  * name: offset
17
18
  * schema:
18
19
  * type: integer
19
20
  * required: false
20
21
  * description: Offset of regions in response (used for pagination)
22
+ * - in: query
23
+ * name: created_at
24
+ * schema:
25
+ * type: DateComparisonOperator
26
+ * required: false
27
+ * description: Date comparison for when resulting region was created, i.e. less than, greater than etc.
28
+ * - in: query
29
+ * name: updated_at
30
+ * schema:
31
+ * type: DateComparisonOperator
32
+ * required: false
33
+ * description: Date comparison for when resulting region was updated, i.e. less than, greater than etc.
34
+ * - in: query
35
+ * name: deleted_at
36
+ * schema:
37
+ * type: DateComparisonOperator
38
+ * required: false
39
+ * description: Date comparison for when resulting region was deleted, i.e. less than, greater than etc.
21
40
  * tags:
22
41
  * - Region
23
42
  * responses:
@@ -33,7 +52,12 @@ declare const _default: (req: any, res: any) => Promise<void>;
33
52
  * $ref: "#/components/schemas/region"
34
53
  */
35
54
  export default _default;
36
- export declare class AdminGetRegionsParams {
55
+ export declare class AdminGetRegionsPaginationParams {
37
56
  limit?: number;
38
57
  offset?: number;
39
58
  }
59
+ export declare class AdminGetRegionsParams extends AdminGetRegionsPaginationParams {
60
+ created_at?: DateComparisonOperator;
61
+ updated_at?: DateComparisonOperator;
62
+ deleted_at?: DateComparisonOperator;
63
+ }
@@ -1,10 +1,44 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
2
29
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
30
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
31
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
32
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
33
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
34
  };
35
+ var __importStar = (this && this.__importStar) || function (mod) {
36
+ if (mod && mod.__esModule) return mod;
37
+ var result = {};
38
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
39
+ __setModuleDefault(result, mod);
40
+ return result;
41
+ };
8
42
  var __metadata = (this && this.__metadata) || function (k, v) {
9
43
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
44
  };
@@ -45,11 +79,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
79
  }
46
80
  };
47
81
  Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.AdminGetRegionsParams = void 0;
82
+ exports.AdminGetRegionsParams = exports.AdminGetRegionsPaginationParams = void 0;
49
83
  var validator_1 = require("../../../../utils/validator");
50
84
  var _1 = require(".");
51
85
  var class_validator_1 = require("class-validator");
52
86
  var class_transformer_1 = require("class-transformer");
87
+ var lodash_1 = __importStar(require("lodash"));
88
+ var common_1 = require("../../../../types/common");
53
89
  /**
54
90
  * @oas [get] /regions
55
91
  * operationId: "GetRegions"
@@ -57,18 +93,36 @@ var class_transformer_1 = require("class-transformer");
57
93
  * description: "Retrieves a list of Regions."
58
94
  * x-authenticated: true
59
95
  * parameters:
60
- * - in: path
96
+ * - in: query
61
97
  * name: limit
62
98
  * schema:
63
99
  * type: integer
64
100
  * required: false
65
101
  * description: limit the number of regions in response
66
- * - in: path
102
+ * - in: query
67
103
  * name: offset
68
104
  * schema:
69
105
  * type: integer
70
106
  * required: false
71
107
  * description: Offset of regions in response (used for pagination)
108
+ * - in: query
109
+ * name: created_at
110
+ * schema:
111
+ * type: DateComparisonOperator
112
+ * required: false
113
+ * description: Date comparison for when resulting region was created, i.e. less than, greater than etc.
114
+ * - in: query
115
+ * name: updated_at
116
+ * schema:
117
+ * type: DateComparisonOperator
118
+ * required: false
119
+ * description: Date comparison for when resulting region was updated, i.e. less than, greater than etc.
120
+ * - in: query
121
+ * name: deleted_at
122
+ * schema:
123
+ * type: DateComparisonOperator
124
+ * required: false
125
+ * description: Date comparison for when resulting region was deleted, i.e. less than, greater than etc.
72
126
  * tags:
73
127
  * - Region
74
128
  * responses:
@@ -84,21 +138,21 @@ var class_transformer_1 = require("class-transformer");
84
138
  * $ref: "#/components/schemas/region"
85
139
  */
86
140
  exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
87
- var validated, regionService, selector, listConfig, regions;
141
+ var validated, regionService, filterableFields, listConfig, regions;
88
142
  return __generator(this, function (_a) {
89
143
  switch (_a.label) {
90
144
  case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminGetRegionsParams, req.query)];
91
145
  case 1:
92
146
  validated = _a.sent();
93
147
  regionService = req.scope.resolve("regionService");
94
- selector = {};
148
+ filterableFields = lodash_1.default.omit(validated, ["limit", "offset"]);
95
149
  listConfig = {
96
150
  select: _1.defaultAdminRegionFields,
97
151
  relations: _1.defaultAdminRegionRelations,
98
152
  skip: validated.offset,
99
153
  take: validated.limit,
100
154
  };
101
- return [4 /*yield*/, regionService.list(selector, listConfig)];
155
+ return [4 /*yield*/, regionService.list(lodash_1.default.pickBy(filterableFields, lodash_1.identity), listConfig)];
102
156
  case 2:
103
157
  regions = _a.sent();
104
158
  res.json({
@@ -111,8 +165,8 @@ exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0
111
165
  }
112
166
  });
113
167
  }); });
114
- var AdminGetRegionsParams = /** @class */ (function () {
115
- function AdminGetRegionsParams() {
168
+ var AdminGetRegionsPaginationParams = /** @class */ (function () {
169
+ function AdminGetRegionsPaginationParams() {
116
170
  this.limit = 50;
117
171
  this.offset = 0;
118
172
  }
@@ -121,14 +175,40 @@ var AdminGetRegionsParams = /** @class */ (function () {
121
175
  (0, class_validator_1.IsOptional)(),
122
176
  (0, class_transformer_1.Type)(function () { return Number; }),
123
177
  __metadata("design:type", Number)
124
- ], AdminGetRegionsParams.prototype, "limit", void 0);
178
+ ], AdminGetRegionsPaginationParams.prototype, "limit", void 0);
125
179
  __decorate([
126
180
  (0, class_validator_1.IsInt)(),
127
181
  (0, class_validator_1.IsOptional)(),
128
182
  (0, class_transformer_1.Type)(function () { return Number; }),
129
183
  __metadata("design:type", Number)
130
- ], AdminGetRegionsParams.prototype, "offset", void 0);
131
- return AdminGetRegionsParams;
184
+ ], AdminGetRegionsPaginationParams.prototype, "offset", void 0);
185
+ return AdminGetRegionsPaginationParams;
132
186
  }());
187
+ exports.AdminGetRegionsPaginationParams = AdminGetRegionsPaginationParams;
188
+ var AdminGetRegionsParams = /** @class */ (function (_super) {
189
+ __extends(AdminGetRegionsParams, _super);
190
+ function AdminGetRegionsParams() {
191
+ return _super !== null && _super.apply(this, arguments) || this;
192
+ }
193
+ __decorate([
194
+ (0, class_validator_1.IsOptional)(),
195
+ (0, class_validator_1.ValidateNested)(),
196
+ (0, class_transformer_1.Type)(function () { return common_1.DateComparisonOperator; }),
197
+ __metadata("design:type", common_1.DateComparisonOperator)
198
+ ], AdminGetRegionsParams.prototype, "created_at", void 0);
199
+ __decorate([
200
+ (0, class_validator_1.IsOptional)(),
201
+ (0, class_validator_1.ValidateNested)(),
202
+ (0, class_transformer_1.Type)(function () { return common_1.DateComparisonOperator; }),
203
+ __metadata("design:type", common_1.DateComparisonOperator)
204
+ ], AdminGetRegionsParams.prototype, "updated_at", void 0);
205
+ __decorate([
206
+ (0, class_validator_1.ValidateNested)(),
207
+ (0, class_validator_1.IsOptional)(),
208
+ (0, class_transformer_1.Type)(function () { return common_1.DateComparisonOperator; }),
209
+ __metadata("design:type", common_1.DateComparisonOperator)
210
+ ], AdminGetRegionsParams.prototype, "deleted_at", void 0);
211
+ return AdminGetRegionsParams;
212
+ }(AdminGetRegionsPaginationParams));
133
213
  exports.AdminGetRegionsParams = AdminGetRegionsParams;
134
214
  //# sourceMappingURL=list-regions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-regions.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/regions/list-regions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAuD;AAGvD,sBAAyE;AACzE,mDAAmD;AACnD,uDAAwC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACV,qBAAM,IAAA,qBAAS,EAAC,qBAAqB,EAAE,GAAG,CAAC,KAAK,CAAC,EAAA;;gBAA7D,SAAS,GAAG,SAAiD;gBAE7D,aAAa,GAAkB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;gBAEjE,QAAQ,GAAG,EAAE,CAAA;gBAEb,UAAU,GAAG;oBACjB,MAAM,EAAE,2BAAwB;oBAChC,SAAS,EAAE,8BAA2B;oBACtC,IAAI,EAAE,SAAS,CAAC,MAAM;oBACtB,IAAI,EAAE,SAAS,CAAC,KAAK;iBACtB,CAAA;gBAEyB,qBAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAA;;gBAAlE,OAAO,GAAa,SAA8C;gBAExE,GAAG,CAAC,IAAI,CAAC;oBACP,OAAO,SAAA;oBACP,KAAK,EAAE,OAAO,CAAC,MAAM;oBACrB,MAAM,EAAE,SAAS,CAAC,MAAM;oBACxB,KAAK,EAAE,SAAS,CAAC,KAAK;iBACvB,CAAC,CAAA;;;;KACH,EAAA;AAED;IAAA;QAIE,UAAK,GAAY,EAAE,CAAA;QAKnB,WAAM,GAAY,CAAC,CAAA;IACr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19
  * description: "The 3 character ISO currency code to use for the Region."
20
20
  * type: string
21
+ * automatic_taxes:
22
+ * description: "If true Medusa will automatically calculate taxes for carts in this region. If false you have to manually call POST /carts/:id/taxes."
23
+ * type: boolean
24
+ * gift_cards_taxable:
25
+ * description: "Whether gift cards in this region should be applied sales tax when purchasing a gift card"
26
+ * type: boolean
27
+ * tax_provider_id:
28
+ * description: "The id of the tax provider to use; if null the system tax provider is used"
29
+ * type: string
21
30
  * tax_code:
22
31
  * description: "An optional tax code the Region."
23
32
  * type: string
@@ -57,6 +66,9 @@ export declare class AdminPostRegionsRegionReq {
57
66
  currency_code?: string;
58
67
  tax_code?: string;
59
68
  tax_rate?: number;
69
+ gift_cards_taxable?: boolean;
70
+ automatic_taxes?: boolean;
71
+ tax_provider_id?: string | null;
60
72
  payment_providers?: string[];
61
73
  fulfillment_providers?: string[];
62
74
  countries?: string[];
@@ -68,6 +68,15 @@ var validator_1 = require("../../../../utils/validator");
68
68
  * currency_code:
69
69
  * description: "The 3 character ISO currency code to use for the Region."
70
70
  * type: string
71
+ * automatic_taxes:
72
+ * description: "If true Medusa will automatically calculate taxes for carts in this region. If false you have to manually call POST /carts/:id/taxes."
73
+ * type: boolean
74
+ * gift_cards_taxable:
75
+ * description: "Whether gift cards in this region should be applied sales tax when purchasing a gift card"
76
+ * type: boolean
77
+ * tax_provider_id:
78
+ * description: "The id of the tax provider to use; if null the system tax provider is used"
79
+ * type: string
71
80
  * tax_code:
72
81
  * description: "An optional tax code the Region."
73
82
  * type: string
@@ -148,6 +157,21 @@ var AdminPostRegionsRegionReq = /** @class */ (function () {
148
157
  (0, class_validator_1.IsOptional)(),
149
158
  __metadata("design:type", Number)
150
159
  ], AdminPostRegionsRegionReq.prototype, "tax_rate", void 0);
160
+ __decorate([
161
+ (0, class_validator_1.IsBoolean)(),
162
+ (0, class_validator_1.IsOptional)(),
163
+ __metadata("design:type", Boolean)
164
+ ], AdminPostRegionsRegionReq.prototype, "gift_cards_taxable", void 0);
165
+ __decorate([
166
+ (0, class_validator_1.IsBoolean)(),
167
+ (0, class_validator_1.IsOptional)(),
168
+ __metadata("design:type", Boolean)
169
+ ], AdminPostRegionsRegionReq.prototype, "automatic_taxes", void 0);
170
+ __decorate([
171
+ (0, class_validator_1.IsString)(),
172
+ (0, class_validator_1.IsOptional)(),
173
+ __metadata("design:type", Object)
174
+ ], AdminPostRegionsRegionReq.prototype, "tax_provider_id", void 0);
151
175
  __decorate([
152
176
  (0, class_validator_1.IsArray)(),
153
177
  (0, class_validator_1.IsString)({ each: true }),
@@ -1 +1 @@
1
- {"version":3,"file":"update-region.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/regions/update-region.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAyE;AACzE,sBAAyE;AACzE,yDAAuD;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,SAAS,GAAK,GAAG,CAAC,MAAM,UAAf,CAAe;gBACd,qBAAM,IAAA,qBAAS,EAAC,yBAAyB,EAAE,GAAG,CAAC,IAAI,CAAC,EAAA;;gBAAhE,SAAS,GAAG,SAAoD;gBAEhE,aAAa,GAAkB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;gBACvE,qBAAM,aAAa,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,EAAA;;gBAAhD,SAAgD,CAAA;gBACjC,qBAAM,aAAa,CAAC,QAAQ,CAAC,SAAS,EAAE;wBACrD,MAAM,EAAE,2BAAwB;wBAChC,SAAS,EAAE,8BAA2B;qBACvC,CAAC,EAAA;;gBAHI,MAAM,GAAG,SAGb;gBAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,MAAM,QAAA,EAAE,CAAC,CAAA;;;;KACjC,EAAA;AAED;IAAA;IAgCA,CAAC;IA7BC;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;2DACA;IAIb;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;oEACS;IAItB;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;+DACI;IAIjB;QAFC,IAAA,0BAAQ,GAAE;QACV,IAAA,4BAAU,GAAE;;+DACI;IAKjB;QAHC,IAAA,yBAAO,GAAE;QACT,IAAA,0BAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACxB,IAAA,4BAAU,GAAE;;wEACe;IAK5B;QAHC,IAAA,yBAAO,GAAE;QACT,IAAA,0BAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACxB,IAAA,4BAAU,GAAE;;4EACmB;IAMhC;QAHC,IAAA,yBAAO,GAAE;QACT,IAAA,0BAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACxB,IAAA,4BAAU,GAAE;;gEACO;IACtB,gCAAC;CAAA,AAhCD,IAgCC;AAhCY,8DAAyB"}
1
+ {"version":3,"file":"update-region.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/regions/update-region.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAMwB;AACxB,sBAAyE;AACzE,yDAAuD;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,SAAS,GAAK,GAAG,CAAC,MAAM,UAAf,CAAe;gBACd,qBAAM,IAAA,qBAAS,EAAC,yBAAyB,EAAE,GAAG,CAAC,IAAI,CAAC,EAAA;;gBAAhE,SAAS,GAAG,SAAoD;gBAEhE,aAAa,GAAkB,GAAG,CAAC,KAAK,CAA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GAAE;;gEACO;IACtB,gCAAC;CAAA,AA5CD,IA4CC;AA5CY,8DAAyB"}
@@ -1,10 +1,10 @@
1
1
  import { ShippingOption } from "../../../..";
2
- import { DeleteResponse } from "../../../../types/common";
2
+ import { PaginatedResponse, DeleteResponse } from "../../../../types/common";
3
3
  declare const _default: (app: any) => any;
4
4
  export default _default;
5
5
  export declare const defaultFields: string[];
6
6
  export declare const defaultRelations: string[];
7
- export declare type AdminShippingOptionsListRes = {
7
+ export declare type AdminShippingOptionsListRes = PaginatedResponse & {
8
8
  shipping_options: ShippingOption[];
9
9
  };
10
10
  export declare type AdminShippingOptionsRes = {
@@ -44,6 +44,22 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
44
44
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
45
45
  }
46
46
  };
47
+ var __read = (this && this.__read) || function (o, n) {
48
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
49
+ if (!m) return o;
50
+ var i = m.call(o), r, ar = [], e;
51
+ try {
52
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
53
+ }
54
+ catch (error) { e = { error: error }; }
55
+ finally {
56
+ try {
57
+ if (r && !r.done && (m = i["return"])) m.call(i);
58
+ }
59
+ finally { if (e) throw e.error; }
60
+ }
61
+ return ar;
62
+ };
47
63
  Object.defineProperty(exports, "__esModule", { value: true });
48
64
  exports.AdminGetShippingOptionsParams = void 0;
49
65
  var class_transformer_1 = require("class-transformer");
@@ -91,20 +107,20 @@ var is_boolean_1 = require("../../../../utils/validators/is-boolean");
91
107
  * $ref: "#/components/schemas/shipping_option"
92
108
  */
93
109
  exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
94
- var validatedParams, optionService, data;
95
- return __generator(this, function (_a) {
96
- switch (_a.label) {
110
+ var validatedParams, optionService, _a, data, count;
111
+ return __generator(this, function (_b) {
112
+ switch (_b.label) {
97
113
  case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminGetShippingOptionsParams, req.query)];
98
114
  case 1:
99
- validatedParams = _a.sent();
115
+ validatedParams = _b.sent();
100
116
  optionService = req.scope.resolve("shippingOptionService");
101
- return [4 /*yield*/, optionService.list(validatedParams, {
117
+ return [4 /*yield*/, optionService.listAndCount(validatedParams, {
102
118
  select: _1.defaultFields,
103
119
  relations: _1.defaultRelations,
104
120
  })];
105
121
  case 2:
106
- data = _a.sent();
107
- res.status(200).json({ shipping_options: data });
122
+ _a = __read.apply(void 0, [_b.sent(), 2]), data = _a[0], count = _a[1];
123
+ res.status(200).json({ shipping_options: data, count: count });
108
124
  return [2 /*return*/];
109
125
  }
110
126
  });