@mercurjs/framework 1.3.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 (275) hide show
  1. package/README.md +22 -0
  2. package/dist/index.d.ts +6 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +22 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/links/index.d.ts +3 -0
  7. package/dist/links/index.d.ts.map +1 -0
  8. package/dist/links/index.js +19 -0
  9. package/dist/links/index.js.map +1 -0
  10. package/dist/links/link-entrypoints.d.ts +4 -0
  11. package/dist/links/link-entrypoints.d.ts.map +1 -0
  12. package/dist/links/link-entrypoints.js +7 -0
  13. package/dist/links/link-entrypoints.js.map +1 -0
  14. package/dist/links/linkables.d.ts +16 -0
  15. package/dist/links/linkables.d.ts.map +1 -0
  16. package/dist/links/linkables.js +19 -0
  17. package/dist/links/linkables.js.map +1 -0
  18. package/dist/modules/index.d.ts +2 -0
  19. package/dist/modules/index.d.ts.map +1 -0
  20. package/dist/modules/index.js +5 -0
  21. package/dist/modules/index.js.map +1 -0
  22. package/dist/tsconfig.tsbuildinfo +1 -0
  23. package/dist/types/algolia/algolia-entity.d.ts +4 -0
  24. package/dist/types/algolia/algolia-entity.d.ts.map +1 -0
  25. package/dist/types/algolia/algolia-entity.js +3 -0
  26. package/dist/types/algolia/algolia-entity.js.map +1 -0
  27. package/dist/types/algolia/algolia-product.d.ts +347 -0
  28. package/dist/types/algolia/algolia-product.d.ts.map +1 -0
  29. package/dist/types/algolia/algolia-product.js +112 -0
  30. package/dist/types/algolia/algolia-product.js.map +1 -0
  31. package/dist/types/algolia/algolia-review.d.ts +25 -0
  32. package/dist/types/algolia/algolia-review.d.ts.map +1 -0
  33. package/dist/types/algolia/algolia-review.js +13 -0
  34. package/dist/types/algolia/algolia-review.js.map +1 -0
  35. package/dist/types/algolia/events.d.ts +13 -0
  36. package/dist/types/algolia/events.d.ts.map +1 -0
  37. package/dist/types/algolia/events.js +18 -0
  38. package/dist/types/algolia/events.js.map +1 -0
  39. package/dist/types/algolia/index-types.d.ts +5 -0
  40. package/dist/types/algolia/index-types.d.ts.map +1 -0
  41. package/dist/types/algolia/index-types.js +9 -0
  42. package/dist/types/algolia/index-types.js.map +1 -0
  43. package/dist/types/algolia/index.d.ts +6 -0
  44. package/dist/types/algolia/index.d.ts.map +1 -0
  45. package/dist/types/algolia/index.js +22 -0
  46. package/dist/types/algolia/index.js.map +1 -0
  47. package/dist/types/attribute/common.d.ts +41 -0
  48. package/dist/types/attribute/common.d.ts.map +1 -0
  49. package/dist/types/attribute/common.js +13 -0
  50. package/dist/types/attribute/common.js.map +1 -0
  51. package/dist/types/attribute/index.d.ts +3 -0
  52. package/dist/types/attribute/index.d.ts.map +1 -0
  53. package/dist/types/attribute/index.js +19 -0
  54. package/dist/types/attribute/index.js.map +1 -0
  55. package/dist/types/attribute/mutations.d.ts +50 -0
  56. package/dist/types/attribute/mutations.d.ts.map +1 -0
  57. package/dist/types/attribute/mutations.js +3 -0
  58. package/dist/types/attribute/mutations.js.map +1 -0
  59. package/dist/types/brand/index.d.ts +2 -0
  60. package/dist/types/brand/index.d.ts.map +1 -0
  61. package/dist/types/brand/index.js +18 -0
  62. package/dist/types/brand/index.js.map +1 -0
  63. package/dist/types/brand/mutations.d.ts +4 -0
  64. package/dist/types/brand/mutations.d.ts.map +1 -0
  65. package/dist/types/brand/mutations.js +3 -0
  66. package/dist/types/brand/mutations.js.map +1 -0
  67. package/dist/types/commission/common.d.ts +59 -0
  68. package/dist/types/commission/common.d.ts.map +1 -0
  69. package/dist/types/commission/common.js +3 -0
  70. package/dist/types/commission/common.js.map +1 -0
  71. package/dist/types/commission/index.d.ts +3 -0
  72. package/dist/types/commission/index.d.ts.map +1 -0
  73. package/dist/types/commission/index.js +19 -0
  74. package/dist/types/commission/index.js.map +1 -0
  75. package/dist/types/commission/mutations.d.ts +28 -0
  76. package/dist/types/commission/mutations.d.ts.map +1 -0
  77. package/dist/types/commission/mutations.js +3 -0
  78. package/dist/types/commission/mutations.js.map +1 -0
  79. package/dist/types/configuration/common.d.ts +14 -0
  80. package/dist/types/configuration/common.d.ts.map +1 -0
  81. package/dist/types/configuration/common.js +11 -0
  82. package/dist/types/configuration/common.js.map +1 -0
  83. package/dist/types/configuration/index.d.ts +3 -0
  84. package/dist/types/configuration/index.d.ts.map +1 -0
  85. package/dist/types/configuration/index.js +19 -0
  86. package/dist/types/configuration/index.js.map +1 -0
  87. package/dist/types/configuration/mutations.d.ts +10 -0
  88. package/dist/types/configuration/mutations.d.ts.map +1 -0
  89. package/dist/types/configuration/mutations.js +3 -0
  90. package/dist/types/configuration/mutations.js.map +1 -0
  91. package/dist/types/index.d.ts +15 -0
  92. package/dist/types/index.d.ts.map +1 -0
  93. package/dist/types/index.js +31 -0
  94. package/dist/types/index.js.map +1 -0
  95. package/dist/types/marketplace/common.d.ts +29 -0
  96. package/dist/types/marketplace/common.d.ts.map +1 -0
  97. package/dist/types/marketplace/common.js +3 -0
  98. package/dist/types/marketplace/common.js.map +1 -0
  99. package/dist/types/marketplace/events.d.ts +4 -0
  100. package/dist/types/marketplace/events.d.ts.map +1 -0
  101. package/dist/types/marketplace/events.js +8 -0
  102. package/dist/types/marketplace/events.js.map +1 -0
  103. package/dist/types/marketplace/index.d.ts +4 -0
  104. package/dist/types/marketplace/index.d.ts.map +1 -0
  105. package/dist/types/marketplace/index.js +20 -0
  106. package/dist/types/marketplace/index.js.map +1 -0
  107. package/dist/types/marketplace/mutations.d.ts +7 -0
  108. package/dist/types/marketplace/mutations.d.ts.map +1 -0
  109. package/dist/types/marketplace/mutations.js +3 -0
  110. package/dist/types/marketplace/mutations.js.map +1 -0
  111. package/dist/types/order-return-request/common.d.ts +20 -0
  112. package/dist/types/order-return-request/common.d.ts.map +1 -0
  113. package/dist/types/order-return-request/common.js +3 -0
  114. package/dist/types/order-return-request/common.js.map +1 -0
  115. package/dist/types/order-return-request/index.d.ts +3 -0
  116. package/dist/types/order-return-request/index.d.ts.map +1 -0
  117. package/dist/types/order-return-request/index.js +19 -0
  118. package/dist/types/order-return-request/index.js.map +1 -0
  119. package/dist/types/order-return-request/mutations.d.ts +29 -0
  120. package/dist/types/order-return-request/mutations.d.ts.map +1 -0
  121. package/dist/types/order-return-request/mutations.js +3 -0
  122. package/dist/types/order-return-request/mutations.js.map +1 -0
  123. package/dist/types/payment-stripe-connect/index.d.ts +13 -0
  124. package/dist/types/payment-stripe-connect/index.d.ts.map +1 -0
  125. package/dist/types/payment-stripe-connect/index.js +14 -0
  126. package/dist/types/payment-stripe-connect/index.js.map +1 -0
  127. package/dist/types/payout/common.d.ts +30 -0
  128. package/dist/types/payout/common.d.ts.map +1 -0
  129. package/dist/types/payout/common.js +10 -0
  130. package/dist/types/payout/common.js.map +1 -0
  131. package/dist/types/payout/events.d.ts +17 -0
  132. package/dist/types/payout/events.d.ts.map +1 -0
  133. package/dist/types/payout/events.js +24 -0
  134. package/dist/types/payout/events.js.map +1 -0
  135. package/dist/types/payout/index.d.ts +5 -0
  136. package/dist/types/payout/index.d.ts.map +1 -0
  137. package/dist/types/payout/index.js +21 -0
  138. package/dist/types/payout/index.js.map +1 -0
  139. package/dist/types/payout/mutations.d.ts +25 -0
  140. package/dist/types/payout/mutations.d.ts.map +1 -0
  141. package/dist/types/payout/mutations.js +3 -0
  142. package/dist/types/payout/mutations.js.map +1 -0
  143. package/dist/types/payout/provider.d.ts +52 -0
  144. package/dist/types/payout/provider.d.ts.map +1 -0
  145. package/dist/types/payout/provider.js +3 -0
  146. package/dist/types/payout/provider.js.map +1 -0
  147. package/dist/types/requests/common.d.ts +12 -0
  148. package/dist/types/requests/common.d.ts.map +1 -0
  149. package/dist/types/requests/common.js +3 -0
  150. package/dist/types/requests/common.js.map +1 -0
  151. package/dist/types/requests/events.d.ts +49 -0
  152. package/dist/types/requests/events.d.ts.map +1 -0
  153. package/dist/types/requests/events.js +64 -0
  154. package/dist/types/requests/events.js.map +1 -0
  155. package/dist/types/requests/humanize_types.d.ts +11 -0
  156. package/dist/types/requests/humanize_types.d.ts.map +1 -0
  157. package/dist/types/requests/humanize_types.js +14 -0
  158. package/dist/types/requests/humanize_types.js.map +1 -0
  159. package/dist/types/requests/index.d.ts +5 -0
  160. package/dist/types/requests/index.d.ts.map +1 -0
  161. package/dist/types/requests/index.js +21 -0
  162. package/dist/types/requests/index.js.map +1 -0
  163. package/dist/types/requests/mutations.d.ts +28 -0
  164. package/dist/types/requests/mutations.d.ts.map +1 -0
  165. package/dist/types/requests/mutations.js +3 -0
  166. package/dist/types/requests/mutations.js.map +1 -0
  167. package/dist/types/reviews/common.d.ts +11 -0
  168. package/dist/types/reviews/common.d.ts.map +1 -0
  169. package/dist/types/reviews/common.js +3 -0
  170. package/dist/types/reviews/common.js.map +1 -0
  171. package/dist/types/reviews/index.d.ts +3 -0
  172. package/dist/types/reviews/index.d.ts.map +1 -0
  173. package/dist/types/reviews/index.js +19 -0
  174. package/dist/types/reviews/index.js.map +1 -0
  175. package/dist/types/reviews/mutatations.d.ts +15 -0
  176. package/dist/types/reviews/mutatations.d.ts.map +1 -0
  177. package/dist/types/reviews/mutatations.js +3 -0
  178. package/dist/types/reviews/mutatations.js.map +1 -0
  179. package/dist/types/seller/common.d.ts +63 -0
  180. package/dist/types/seller/common.d.ts.map +1 -0
  181. package/dist/types/seller/common.js +16 -0
  182. package/dist/types/seller/common.js.map +1 -0
  183. package/dist/types/seller/events.d.ts +4 -0
  184. package/dist/types/seller/events.d.ts.map +1 -0
  185. package/dist/types/seller/events.js +8 -0
  186. package/dist/types/seller/events.js.map +1 -0
  187. package/dist/types/seller/index.d.ts +4 -0
  188. package/dist/types/seller/index.d.ts.map +1 -0
  189. package/dist/types/seller/index.js +20 -0
  190. package/dist/types/seller/index.js.map +1 -0
  191. package/dist/types/seller/mutations.d.ts +53 -0
  192. package/dist/types/seller/mutations.d.ts.map +1 -0
  193. package/dist/types/seller/mutations.js +3 -0
  194. package/dist/types/seller/mutations.js.map +1 -0
  195. package/dist/types/split-order-payment/common.d.ts +10 -0
  196. package/dist/types/split-order-payment/common.d.ts.map +1 -0
  197. package/dist/types/split-order-payment/common.js +3 -0
  198. package/dist/types/split-order-payment/common.js.map +1 -0
  199. package/dist/types/split-order-payment/index.d.ts +3 -0
  200. package/dist/types/split-order-payment/index.d.ts.map +1 -0
  201. package/dist/types/split-order-payment/index.js +19 -0
  202. package/dist/types/split-order-payment/index.js.map +1 -0
  203. package/dist/types/split-order-payment/mutations.d.ts +19 -0
  204. package/dist/types/split-order-payment/mutations.d.ts.map +1 -0
  205. package/dist/types/split-order-payment/mutations.js +3 -0
  206. package/dist/types/split-order-payment/mutations.js.map +1 -0
  207. package/dist/types/wishlist/common.d.ts +17 -0
  208. package/dist/types/wishlist/common.d.ts.map +1 -0
  209. package/dist/types/wishlist/common.js +3 -0
  210. package/dist/types/wishlist/common.js.map +1 -0
  211. package/dist/types/wishlist/index.d.ts +3 -0
  212. package/dist/types/wishlist/index.d.ts.map +1 -0
  213. package/dist/types/wishlist/index.js +19 -0
  214. package/dist/types/wishlist/index.js.map +1 -0
  215. package/dist/types/wishlist/mutations.d.ts +10 -0
  216. package/dist/types/wishlist/mutations.d.ts.map +1 -0
  217. package/dist/types/wishlist/mutations.js +3 -0
  218. package/dist/types/wishlist/mutations.js.map +1 -0
  219. package/dist/utils/admin.d.ts +3 -0
  220. package/dist/utils/admin.d.ts.map +1 -0
  221. package/dist/utils/admin.js +14 -0
  222. package/dist/utils/admin.js.map +1 -0
  223. package/dist/utils/configuration.d.ts +5 -0
  224. package/dist/utils/configuration.d.ts.map +1 -0
  225. package/dist/utils/configuration.js +32 -0
  226. package/dist/utils/configuration.js.map +1 -0
  227. package/dist/utils/hosts.d.ts +24 -0
  228. package/dist/utils/hosts.d.ts.map +1 -0
  229. package/dist/utils/hosts.js +43 -0
  230. package/dist/utils/hosts.js.map +1 -0
  231. package/dist/utils/index.d.ts +7 -0
  232. package/dist/utils/index.d.ts.map +1 -0
  233. package/dist/utils/index.js +23 -0
  234. package/dist/utils/index.js.map +1 -0
  235. package/dist/utils/middlewares/apply-reference-filter.d.ts +7 -0
  236. package/dist/utils/middlewares/apply-reference-filter.d.ts.map +1 -0
  237. package/dist/utils/middlewares/apply-reference-filter.js +15 -0
  238. package/dist/utils/middlewares/apply-reference-filter.js.map +1 -0
  239. package/dist/utils/middlewares/check-customer-ownership.d.ts +10 -0
  240. package/dist/utils/middlewares/check-customer-ownership.d.ts.map +1 -0
  241. package/dist/utils/middlewares/check-customer-ownership.js +34 -0
  242. package/dist/utils/middlewares/check-customer-ownership.js.map +1 -0
  243. package/dist/utils/middlewares/check-ownership.d.ts +35 -0
  244. package/dist/utils/middlewares/check-ownership.d.ts.map +1 -0
  245. package/dist/utils/middlewares/check-ownership.js +66 -0
  246. package/dist/utils/middlewares/check-ownership.js.map +1 -0
  247. package/dist/utils/middlewares/filter-by-seller-id.d.ts +7 -0
  248. package/dist/utils/middlewares/filter-by-seller-id.d.ts.map +1 -0
  249. package/dist/utils/middlewares/filter-by-seller-id.js +15 -0
  250. package/dist/utils/middlewares/filter-by-seller-id.js.map +1 -0
  251. package/dist/utils/middlewares/index.d.ts +5 -0
  252. package/dist/utils/middlewares/index.d.ts.map +1 -0
  253. package/dist/utils/middlewares/index.js +21 -0
  254. package/dist/utils/middlewares/index.js.map +1 -0
  255. package/dist/utils/money.d.ts +17 -0
  256. package/dist/utils/money.d.ts.map +1 -0
  257. package/dist/utils/money.js +68 -0
  258. package/dist/utils/money.js.map +1 -0
  259. package/dist/utils/seller.d.ts +4 -0
  260. package/dist/utils/seller.d.ts.map +1 -0
  261. package/dist/utils/seller.js +19 -0
  262. package/dist/utils/seller.js.map +1 -0
  263. package/dist/workflows/emit-multiple-events-step.d.ts +7 -0
  264. package/dist/workflows/emit-multiple-events-step.d.ts.map +1 -0
  265. package/dist/workflows/emit-multiple-events-step.js +12 -0
  266. package/dist/workflows/emit-multiple-events-step.js.map +1 -0
  267. package/dist/workflows/index.d.ts +3 -0
  268. package/dist/workflows/index.d.ts.map +1 -0
  269. package/dist/workflows/index.js +19 -0
  270. package/dist/workflows/index.js.map +1 -0
  271. package/dist/workflows/update-product-status.d.ts +10 -0
  272. package/dist/workflows/update-product-status.d.ts.map +1 -0
  273. package/dist/workflows/update-product-status.js +18 -0
  274. package/dist/workflows/update-product-status.js.map +1 -0
  275. package/package.json +55 -0
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=mutations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/types/seller/mutations.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ export type SplitOrderPaymentDTO = {
2
+ id: string;
3
+ status: string;
4
+ currency_code: string;
5
+ authorized_amount: number;
6
+ captured_amount: number;
7
+ refunded_amount: number;
8
+ payment_collection_id: string;
9
+ };
10
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/split-order-payment/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,qBAAqB,EAAE,MAAM,CAAA;CAC9B,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/types/split-order-payment/common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './mutations';
2
+ export * from './common';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/split-order-payment/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./mutations"), exports);
18
+ __exportStar(require("./common"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/split-order-payment/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,2CAAwB"}
@@ -0,0 +1,19 @@
1
+ export type CreateSplitOrderPaymentsDTO = {
2
+ order_id: string;
3
+ status: string;
4
+ currency_code: string;
5
+ authorized_amount: number;
6
+ payment_collection_id: string;
7
+ };
8
+ export type UpdateSplitOrderPaymentsDTO = {
9
+ id: string;
10
+ status?: string;
11
+ authorized_amount?: number;
12
+ captured_amount?: number;
13
+ refunded_amount?: number;
14
+ };
15
+ export type RefundSplitOrderPaymentsDTO = {
16
+ id: string;
17
+ amount: number;
18
+ };
19
+ //# sourceMappingURL=mutations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/types/split-order-payment/mutations.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,qBAAqB,EAAE,MAAM,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;CACf,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=mutations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/types/split-order-payment/mutations.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { PriceDTO, ProductDTO, ProductVariantDTO } from '@medusajs/framework/types';
2
+ export interface WishlistProductVariantDTO extends ProductVariantDTO {
3
+ prices: PriceDTO[];
4
+ }
5
+ export interface WishlistProduct extends ProductDTO {
6
+ variants: WishlistProductVariantDTO[];
7
+ }
8
+ export type Wishlist = {
9
+ id: string;
10
+ products: WishlistProduct[];
11
+ };
12
+ export type WishlistItem = {
13
+ wishlist_id: string;
14
+ wishlist: Wishlist;
15
+ };
16
+ export type WishlistResponse = WishlistItem[];
17
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/wishlist/common.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,iBAAiB,EAClB,MAAM,2BAA2B,CAAA;AAElC,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,MAAM,EAAE,QAAQ,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,QAAQ,EAAE,yBAAyB,EAAE,CAAA;CACtC;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,eAAe,EAAE,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,YAAY,EAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/types/wishlist/common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from "./common";
2
+ export * from "./mutations";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/wishlist/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./common"), exports);
18
+ __exportStar(require("./mutations"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/wishlist/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B"}
@@ -0,0 +1,10 @@
1
+ export type CreateWishlistDTO = {
2
+ reference: 'product';
3
+ reference_id: string;
4
+ customer_id: string;
5
+ };
6
+ export type DeleteWishlistDTO = {
7
+ id: string;
8
+ reference_id: string;
9
+ };
10
+ //# sourceMappingURL=mutations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/types/wishlist/mutations.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,SAAS,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=mutations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/types/wishlist/mutations.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { MedusaContainer } from '@medusajs/framework';
2
+ export declare const fetchAdminEmails: (scope: MedusaContainer) => Promise<string[]>;
3
+ //# sourceMappingURL=admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/utils/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAGrD,eAAO,MAAM,gBAAgB,GAC3B,OAAO,eAAe,KACrB,OAAO,CAAC,MAAM,EAAE,CASlB,CAAA"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchAdminEmails = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const fetchAdminEmails = async (scope) => {
6
+ const query = scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
7
+ const { data: admins } = await query.graph({
8
+ entity: 'user',
9
+ fields: ['email']
10
+ });
11
+ return admins.map((admin) => admin.email);
12
+ };
13
+ exports.fetchAdminEmails = fetchAdminEmails;
14
+ //# sourceMappingURL=admin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin.js","sourceRoot":"","sources":["../../src/utils/admin.ts"],"names":[],"mappings":";;;AACA,qDAAqE;AAE9D,MAAM,gBAAgB,GAAG,KAAK,EACnC,KAAsB,EACH,EAAE;IACrB,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,iCAAyB,CAAC,KAAK,CAAC,CAAA;IAE5D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC;QACzC,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,CAAC,OAAO,CAAC;KAClB,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AAC3C,CAAC,CAAA;AAXY,QAAA,gBAAgB,oBAW5B"}
@@ -0,0 +1,5 @@
1
+ import { MedusaContainer } from "@medusajs/framework";
2
+ import { ConfigurationRuleType } from "../types";
3
+ export declare const ConfigurationRuleDefaults: Map<ConfigurationRuleType, boolean>;
4
+ export declare const checkConfigurationRule: (scope: MedusaContainer, ruleType: ConfigurationRuleType) => Promise<boolean>;
5
+ //# sourceMappingURL=configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/utils/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,eAAO,MAAM,yBAAyB,qCAQpC,CAAC;AAEH,eAAO,MAAM,sBAAsB,GACjC,OAAO,eAAe,EACtB,UAAU,qBAAqB,KAC9B,OAAO,CAAC,OAAO,CAuBjB,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkConfigurationRule = exports.ConfigurationRuleDefaults = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const types_1 = require("../types");
6
+ exports.ConfigurationRuleDefaults = new Map([
7
+ [types_1.ConfigurationRuleType.GLOBAL_PRODUCT_CATALOG, false],
8
+ [types_1.ConfigurationRuleType.PRODUCT_REQUEST_ENABLED, true],
9
+ [types_1.ConfigurationRuleType.REQUIRE_PRODUCT_APPROVAL, false],
10
+ [types_1.ConfigurationRuleType.PRODUCT_IMPORT_ENABLED, true],
11
+ ]);
12
+ const checkConfigurationRule = async (scope, ruleType) => {
13
+ const logger = scope.resolve(utils_1.ContainerRegistrationKeys.LOGGER);
14
+ const query = scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
15
+ let enabled = exports.ConfigurationRuleDefaults.get(ruleType) || false;
16
+ try {
17
+ const { data: [rule], } = await query.graph({
18
+ entity: "configuration_rule",
19
+ fields: ["is_enabled"],
20
+ filters: {
21
+ rule_type: ruleType,
22
+ },
23
+ });
24
+ enabled = rule.is_enabled;
25
+ }
26
+ catch (error) {
27
+ logger.error(`Error checking configuration rule ${ruleType}: ${error}`);
28
+ }
29
+ return enabled;
30
+ };
31
+ exports.checkConfigurationRule = checkConfigurationRule;
32
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/utils/configuration.ts"],"names":[],"mappings":";;;AACA,qDAAsE;AACtE,oCAAiD;AAEpC,QAAA,yBAAyB,GAAG,IAAI,GAAG,CAG9C;IACA,CAAC,6BAAqB,CAAC,sBAAsB,EAAE,KAAK,CAAC;IACrD,CAAC,6BAAqB,CAAC,uBAAuB,EAAE,IAAI,CAAC;IACrD,CAAC,6BAAqB,CAAC,wBAAwB,EAAE,KAAK,CAAC;IACvD,CAAC,6BAAqB,CAAC,sBAAsB,EAAE,IAAI,CAAC;CACrD,CAAC,CAAC;AAEI,MAAM,sBAAsB,GAAG,KAAK,EACzC,KAAsB,EACtB,QAA+B,EACb,EAAE;IACpB,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,iCAAyB,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,iCAAyB,CAAC,KAAK,CAAC,CAAC;IAE7D,IAAI,OAAO,GAAG,iCAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC;IAE/D,IAAI,CAAC;QACH,MAAM,EACJ,IAAI,EAAE,CAAC,IAAI,CAAC,GACb,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC;YACpB,MAAM,EAAE,oBAAoB;YAC5B,MAAM,EAAE,CAAC,YAAY,CAAC;YACtB,OAAO,EAAE;gBACP,SAAS,EAAE,QAAQ;aACpB;SACF,CAAC,CAAC;QAEH,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;IAC5B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,qCAAqC,QAAQ,KAAK,KAAK,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AA1BW,QAAA,sBAAsB,0BA0BjC"}
@@ -0,0 +1,24 @@
1
+ export declare enum Hosts {
2
+ VENDOR_PANEL = "VENDOR_PANEL_URL",
3
+ STOREFRONT = "STOREFRONT_URL",
4
+ BACKEND = "BACKEND_URL"
5
+ }
6
+ export declare const defaultHosts: {
7
+ VENDOR_PANEL_URL: string;
8
+ STOREFRONT_URL: string;
9
+ BACKEND_URL: string;
10
+ };
11
+ export declare const hostTypeToResetPasswordPath: {
12
+ VENDOR_PANEL_URL: string;
13
+ STOREFRONT_URL: string;
14
+ BACKEND_URL: string;
15
+ };
16
+ export declare const actorTypeToHost: {
17
+ customer: Hosts;
18
+ seller: Hosts;
19
+ user: Hosts;
20
+ };
21
+ export declare const buildHostAddress: (hostType: Hosts, path?: string) => import("url").URL;
22
+ export declare const buildResetPasswordUrl: (hostType: Hosts, token?: string) => import("url").URL;
23
+ export declare const buildInviteUrl: (token: string) => import("url").URL;
24
+ //# sourceMappingURL=hosts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosts.d.ts","sourceRoot":"","sources":["../../src/utils/hosts.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK;IACf,YAAY,qBAAqB;IACjC,UAAU,mBAAmB;IAC7B,OAAO,gBAAgB;CACxB;AAED,eAAO,MAAM,YAAY;;;;CAIxB,CAAA;AAED,eAAO,MAAM,2BAA2B;;;;CAIvC,CAAA;AAED,eAAO,MAAM,eAAe;;;;CAI3B,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,UAAU,KAAK,EAAE,OAAO,MAAM,sBAE9D,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,UAAU,KAAK,EAAE,QAAQ,MAAM,sBAQpE,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,sBAK3C,CAAA"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildInviteUrl = exports.buildResetPasswordUrl = exports.buildHostAddress = exports.actorTypeToHost = exports.hostTypeToResetPasswordPath = exports.defaultHosts = exports.Hosts = void 0;
4
+ var Hosts;
5
+ (function (Hosts) {
6
+ Hosts["VENDOR_PANEL"] = "VENDOR_PANEL_URL";
7
+ Hosts["STOREFRONT"] = "STOREFRONT_URL";
8
+ Hosts["BACKEND"] = "BACKEND_URL";
9
+ })(Hosts || (exports.Hosts = Hosts = {}));
10
+ exports.defaultHosts = {
11
+ [Hosts.VENDOR_PANEL]: 'http://localhost:5173',
12
+ [Hosts.STOREFRONT]: 'http://localhost:3000',
13
+ [Hosts.BACKEND]: 'http://localhost:9000'
14
+ };
15
+ exports.hostTypeToResetPasswordPath = {
16
+ [Hosts.VENDOR_PANEL]: '/reset-password',
17
+ [Hosts.STOREFRONT]: '/reset-password',
18
+ [Hosts.BACKEND]: '/app/reset-password'
19
+ };
20
+ exports.actorTypeToHost = {
21
+ ['customer']: Hosts.STOREFRONT,
22
+ ['seller']: Hosts.VENDOR_PANEL,
23
+ ['user']: Hosts.BACKEND
24
+ };
25
+ const buildHostAddress = (hostType, path) => {
26
+ return new URL(path || '', process.env[hostType] || exports.defaultHosts[hostType]);
27
+ };
28
+ exports.buildHostAddress = buildHostAddress;
29
+ const buildResetPasswordUrl = (hostType, token) => {
30
+ const url = (0, exports.buildHostAddress)(hostType, exports.hostTypeToResetPasswordPath[hostType]);
31
+ if (token) {
32
+ url.searchParams.set('token', token);
33
+ }
34
+ return url;
35
+ };
36
+ exports.buildResetPasswordUrl = buildResetPasswordUrl;
37
+ const buildInviteUrl = (token) => {
38
+ const url = (0, exports.buildHostAddress)(Hosts.VENDOR_PANEL, '/invite');
39
+ url.searchParams.set('token', token);
40
+ return url;
41
+ };
42
+ exports.buildInviteUrl = buildInviteUrl;
43
+ //# sourceMappingURL=hosts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosts.js","sourceRoot":"","sources":["../../src/utils/hosts.ts"],"names":[],"mappings":";;;AAAA,IAAY,KAIX;AAJD,WAAY,KAAK;IACf,0CAAiC,CAAA;IACjC,sCAA6B,CAAA;IAC7B,gCAAuB,CAAA;AACzB,CAAC,EAJW,KAAK,qBAAL,KAAK,QAIhB;AAEY,QAAA,YAAY,GAAG;IAC1B,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,uBAAuB;IAC7C,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,uBAAuB;IAC3C,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,uBAAuB;CACzC,CAAA;AAEY,QAAA,2BAA2B,GAAG;IACzC,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,iBAAiB;IACvC,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,iBAAiB;IACrC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,qBAAqB;CACvC,CAAA;AAEY,QAAA,eAAe,GAAG;IAC7B,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU;IAC9B,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY;IAC9B,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,OAAO;CACxB,CAAA;AAEM,MAAM,gBAAgB,GAAG,CAAC,QAAe,EAAE,IAAa,EAAE,EAAE;IACjE,OAAO,IAAI,GAAG,CAAC,IAAI,IAAI,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,oBAAY,CAAC,QAAQ,CAAC,CAAC,CAAA;AAC7E,CAAC,CAAA;AAFY,QAAA,gBAAgB,oBAE5B;AAEM,MAAM,qBAAqB,GAAG,CAAC,QAAe,EAAE,KAAc,EAAE,EAAE;IACvE,MAAM,GAAG,GAAG,IAAA,wBAAgB,EAAC,QAAQ,EAAE,mCAA2B,CAAC,QAAQ,CAAC,CAAC,CAAA;IAE7E,IAAI,KAAK,EAAE,CAAC;QACV,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AARY,QAAA,qBAAqB,yBAQjC;AAEM,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE;IAC9C,MAAM,GAAG,GAAG,IAAA,wBAAgB,EAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;IAC3D,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAEpC,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AALY,QAAA,cAAc,kBAK1B"}
@@ -0,0 +1,7 @@
1
+ export * from "./money";
2
+ export * from "./seller";
3
+ export * from "./middlewares";
4
+ export * from "./admin";
5
+ export * from "./hosts";
6
+ export * from "./configuration";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./money"), exports);
18
+ __exportStar(require("./seller"), exports);
19
+ __exportStar(require("./middlewares"), exports);
20
+ __exportStar(require("./admin"), exports);
21
+ __exportStar(require("./hosts"), exports);
22
+ __exportStar(require("./configuration"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,gDAA8B;AAC9B,0CAAwB;AACxB,0CAAwB;AACxB,kDAAgC"}
@@ -0,0 +1,7 @@
1
+ import { NextFunction } from 'express';
2
+ import { MedusaRequest } from '@medusajs/framework/http';
3
+ /**
4
+ * @desc Adds reference type filterableFileds
5
+ */
6
+ export declare function applyReferenceFilter(): (req: MedusaRequest, _: any, next: NextFunction) => Promise<void>;
7
+ //# sourceMappingURL=apply-reference-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-reference-filter.d.ts","sourceRoot":"","sources":["../../../src/utils/middlewares/apply-reference-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD;;GAEG;AACH,wBAAgB,oBAAoB,KACpB,KAAK,aAAa,EAAE,MAAC,EAAE,MAAM,YAAY,mBAMxD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyReferenceFilter = applyReferenceFilter;
4
+ /**
5
+ * @desc Adds reference type filterableFileds
6
+ */
7
+ function applyReferenceFilter() {
8
+ return async (req, _, next) => {
9
+ if (req.validatedQuery.reference) {
10
+ req.filterableFields.reference = req.validatedQuery.reference;
11
+ }
12
+ return next();
13
+ };
14
+ }
15
+ //# sourceMappingURL=apply-reference-filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-reference-filter.js","sourceRoot":"","sources":["../../../src/utils/middlewares/apply-reference-filter.ts"],"names":[],"mappings":";;AAOA,oDAOC;AAVD;;GAEG;AACH,SAAgB,oBAAoB;IAClC,OAAO,KAAK,EAAE,GAAkB,EAAE,CAAC,EAAE,IAAkB,EAAE,EAAE;QACzD,IAAI,GAAG,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;YACjC,GAAG,CAAC,gBAAgB,CAAC,SAAS,GAAG,GAAG,CAAC,cAAc,CAAC,SAAS,CAAA;QAC/D,CAAC;QACD,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { NextFunction } from 'express';
2
+ import { AuthenticatedMedusaRequest, MedusaResponse } from '@medusajs/framework';
3
+ type CheckResourceOwnershipByResourceIdOptions<Body> = {
4
+ entryPoint: string;
5
+ filterField?: string;
6
+ resourceId?: (req: AuthenticatedMedusaRequest<Body>) => string;
7
+ };
8
+ export declare const checkCustomerResourceOwnershipByResourceId: <Body>({ entryPoint, filterField, resourceId }: CheckResourceOwnershipByResourceIdOptions<Body>) => (req: AuthenticatedMedusaRequest<Body>, res: MedusaResponse, next: NextFunction) => Promise<void>;
9
+ export {};
10
+ //# sourceMappingURL=check-customer-ownership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-customer-ownership.d.ts","sourceRoot":"","sources":["../../../src/utils/middlewares/check-customer-ownership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAMhF,KAAK,yCAAyC,CAAC,IAAI,IAAI;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,0BAA0B,CAAC,IAAI,CAAC,KAAK,MAAM,CAAA;CAC/D,CAAA;AAED,eAAO,MAAM,0CAA0C,GAAI,IAAI,EAAE,yCAI9D,yCAAyC,CAAC,IAAI,CAAC,MAE9C,KAAK,0BAA0B,CAAC,IAAI,CAAC,EACrC,KAAK,cAAc,EACnB,MAAM,YAAY,kBAkCrB,CAAA"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkCustomerResourceOwnershipByResourceId = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ const checkCustomerResourceOwnershipByResourceId = ({ entryPoint, filterField = 'id', resourceId = (req) => req.params.id }) => {
6
+ return async (req, res, next) => {
7
+ const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
8
+ const id = resourceId(req);
9
+ const { data: [resource] } = await query.graph({
10
+ entity: entryPoint,
11
+ fields: ['customer_id'],
12
+ filters: {
13
+ [filterField]: id
14
+ }
15
+ });
16
+ if (!resource) {
17
+ res.status(404).json({
18
+ message: `${entryPoint} with ${filterField}: ${id} not found`,
19
+ type: utils_1.MedusaError.Types.NOT_FOUND
20
+ });
21
+ return;
22
+ }
23
+ if (req.auth_context.actor_id !== resource.customer_id) {
24
+ res.status(403).json({
25
+ message: 'You are not allowed to perform this action',
26
+ type: utils_1.MedusaError.Types.NOT_ALLOWED
27
+ });
28
+ return;
29
+ }
30
+ next();
31
+ };
32
+ };
33
+ exports.checkCustomerResourceOwnershipByResourceId = checkCustomerResourceOwnershipByResourceId;
34
+ //# sourceMappingURL=check-customer-ownership.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-customer-ownership.js","sourceRoot":"","sources":["../../../src/utils/middlewares/check-customer-ownership.ts"],"names":[],"mappings":";;;AAGA,qDAGkC;AAQ3B,MAAM,0CAA0C,GAAG,CAAO,EAC/D,UAAU,EACV,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EACa,EAAE,EAAE;IACpD,OAAO,KAAK,EACV,GAAqC,EACrC,GAAmB,EACnB,IAAkB,EAClB,EAAE;QACF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,iCAAyB,CAAC,KAAK,CAAC,CAAA;QAEhE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;QAE1B,MAAM,EACJ,IAAI,EAAE,CAAC,QAAQ,CAAC,EACjB,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC;YACpB,MAAM,EAAE,UAAU;YAClB,MAAM,EAAE,CAAC,aAAa,CAAC;YACvB,OAAO,EAAE;gBACP,CAAC,WAAW,CAAC,EAAE,EAAE;aAClB;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,GAAG,UAAU,SAAS,WAAW,KAAK,EAAE,YAAY;gBAC7D,IAAI,EAAE,mBAAW,CAAC,KAAK,CAAC,SAAS;aAClC,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,IAAI,GAAG,CAAC,YAAY,CAAC,QAAQ,KAAK,QAAQ,CAAC,WAAW,EAAE,CAAC;YACvD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,4CAA4C;gBACrD,IAAI,EAAE,mBAAW,CAAC,KAAK,CAAC,WAAW;aACpC,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,IAAI,EAAE,CAAA;IACR,CAAC,CAAA;AACH,CAAC,CAAA;AA1CY,QAAA,0CAA0C,8CA0CtD"}
@@ -0,0 +1,35 @@
1
+ import { NextFunction } from 'express';
2
+ import { AuthenticatedMedusaRequest, MedusaResponse } from '@medusajs/framework';
3
+ type CheckResourceOwnershipByResourceIdOptions<Body> = {
4
+ entryPoint: string;
5
+ filterField?: string;
6
+ resourceId?: (req: AuthenticatedMedusaRequest<Body>) => string;
7
+ };
8
+ /**
9
+ * Middleware that verifies if the authenticated member owns/has access to the requested resource.
10
+ * This is done by checking if the member's seller ID matches the resource's seller ID.
11
+ *
12
+ * @param options - Configuration options for the ownership check
13
+ * @param options.entryPoint - The entity type to verify ownership of (e.g. 'seller_product', 'service_zone')
14
+ * @param options.filterField - Field used to filter/lookup the resource (defaults to 'id')
15
+ * @param options.paramIdField - Request parameter containing the resource ID (defaults to 'id')
16
+ *
17
+ * @throws {MedusaError} If the member does not own the resource
18
+ *
19
+ * @example
20
+ * // Basic usage - check ownership of vendor product
21
+ * app.use(checkResourceOwnershipByParamId({
22
+ * entryPoint: 'seller_product'
23
+ * }))
24
+ *
25
+ * @example
26
+ * // Custom field usage - check ownership of service zone
27
+ * app.use(checkResourceOwnershipByParamId({
28
+ * entryPoint: 'service_zone',
29
+ * filterField: 'service_zone_id',
30
+ * resourceId: (req) => req.params.zone_id
31
+ * }))
32
+ */
33
+ export declare const checkResourceOwnershipByResourceId: <Body>({ entryPoint, filterField, resourceId }: CheckResourceOwnershipByResourceIdOptions<Body>) => (req: AuthenticatedMedusaRequest<Body>, res: MedusaResponse, next: NextFunction) => Promise<void>;
34
+ export {};
35
+ //# sourceMappingURL=check-ownership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-ownership.d.ts","sourceRoot":"","sources":["../../../src/utils/middlewares/check-ownership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAMhF,KAAK,yCAAyC,CAAC,IAAI,IAAI;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,0BAA0B,CAAC,IAAI,CAAC,KAAK,MAAM,CAAA;CAC/D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,kCAAkC,GAAI,IAAI,EAAE,yCAItD,yCAAyC,CAAC,IAAI,CAAC,MAE9C,KAAK,0BAA0B,CAAC,IAAI,CAAC,EACrC,KAAK,cAAc,EACnB,MAAM,YAAY,kBA+CrB,CAAA"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkResourceOwnershipByResourceId = void 0;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ /**
6
+ * Middleware that verifies if the authenticated member owns/has access to the requested resource.
7
+ * This is done by checking if the member's seller ID matches the resource's seller ID.
8
+ *
9
+ * @param options - Configuration options for the ownership check
10
+ * @param options.entryPoint - The entity type to verify ownership of (e.g. 'seller_product', 'service_zone')
11
+ * @param options.filterField - Field used to filter/lookup the resource (defaults to 'id')
12
+ * @param options.paramIdField - Request parameter containing the resource ID (defaults to 'id')
13
+ *
14
+ * @throws {MedusaError} If the member does not own the resource
15
+ *
16
+ * @example
17
+ * // Basic usage - check ownership of vendor product
18
+ * app.use(checkResourceOwnershipByParamId({
19
+ * entryPoint: 'seller_product'
20
+ * }))
21
+ *
22
+ * @example
23
+ * // Custom field usage - check ownership of service zone
24
+ * app.use(checkResourceOwnershipByParamId({
25
+ * entryPoint: 'service_zone',
26
+ * filterField: 'service_zone_id',
27
+ * resourceId: (req) => req.params.zone_id
28
+ * }))
29
+ */
30
+ const checkResourceOwnershipByResourceId = ({ entryPoint, filterField = 'id', resourceId = (req) => req.params.id }) => {
31
+ return async (req, res, next) => {
32
+ const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
33
+ const { data: [member] } = await query.graph({
34
+ entity: 'member',
35
+ fields: ['seller.id'],
36
+ filters: {
37
+ id: req.auth_context.actor_id
38
+ }
39
+ }, { throwIfKeyNotFound: true });
40
+ const id = resourceId(req);
41
+ const { data: [resource] } = await query.graph({
42
+ entity: entryPoint,
43
+ fields: ['seller_id'],
44
+ filters: {
45
+ [filterField]: id
46
+ }
47
+ });
48
+ if (!resource) {
49
+ res.status(404).json({
50
+ message: `${entryPoint} with ${filterField}: ${id} not found`,
51
+ type: utils_1.MedusaError.Types.NOT_FOUND
52
+ });
53
+ return;
54
+ }
55
+ if (member.seller.id !== resource.seller_id) {
56
+ res.status(403).json({
57
+ message: 'You are not allowed to perform this action',
58
+ type: utils_1.MedusaError.Types.NOT_ALLOWED
59
+ });
60
+ return;
61
+ }
62
+ next();
63
+ };
64
+ };
65
+ exports.checkResourceOwnershipByResourceId = checkResourceOwnershipByResourceId;
66
+ //# sourceMappingURL=check-ownership.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-ownership.js","sourceRoot":"","sources":["../../../src/utils/middlewares/check-ownership.ts"],"names":[],"mappings":";;;AAGA,qDAGkC;AAQlC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,MAAM,kCAAkC,GAAG,CAAO,EACvD,UAAU,EACV,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EACa,EAAE,EAAE;IACpD,OAAO,KAAK,EACV,GAAqC,EACrC,GAAmB,EACnB,IAAkB,EAClB,EAAE;QACF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,iCAAyB,CAAC,KAAK,CAAC,CAAA;QAEhE,MAAM,EACJ,IAAI,EAAE,CAAC,MAAM,CAAC,EACf,GAAG,MAAM,KAAK,CAAC,KAAK,CACnB;YACE,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,CAAC,WAAW,CAAC;YACrB,OAAO,EAAE;gBACP,EAAE,EAAE,GAAG,CAAC,YAAY,CAAC,QAAQ;aAC9B;SACF,EACD,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAC7B,CAAA;QAED,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;QAE1B,MAAM,EACJ,IAAI,EAAE,CAAC,QAAQ,CAAC,EACjB,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC;YACpB,MAAM,EAAE,UAAU;YAClB,MAAM,EAAE,CAAC,WAAW,CAAC;YACrB,OAAO,EAAE;gBACP,CAAC,WAAW,CAAC,EAAE,EAAE;aAClB;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,GAAG,UAAU,SAAS,WAAW,KAAK,EAAE,YAAY;gBAC7D,IAAI,EAAE,mBAAW,CAAC,KAAK,CAAC,SAAS;aAClC,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ,CAAC,SAAS,EAAE,CAAC;YAC5C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,4CAA4C;gBACrD,IAAI,EAAE,mBAAW,CAAC,KAAK,CAAC,WAAW;aACpC,CAAC,CAAA;YACF,OAAM;QACR,CAAC;QAED,IAAI,EAAE,CAAA;IACR,CAAC,CAAA;AACH,CAAC,CAAA;AAvDY,QAAA,kCAAkC,sCAuD9C"}
@@ -0,0 +1,7 @@
1
+ import { NextFunction } from "express";
2
+ import { AuthenticatedMedusaRequest } from "@medusajs/framework/http";
3
+ /**
4
+ * @desc Adds a seller id to the filterable fields
5
+ */
6
+ export declare function filterBySellerId(): (req: AuthenticatedMedusaRequest, _: any, next: NextFunction) => Promise<void>;
7
+ //# sourceMappingURL=filter-by-seller-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-by-seller-id.d.ts","sourceRoot":"","sources":["../../../src/utils/middlewares/filter-by-seller-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAItE;;GAEG;AACH,wBAAgB,gBAAgB,KAChB,KAAK,0BAA0B,EAAE,MAAC,EAAE,MAAM,YAAY,mBAUrE"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterBySellerId = filterBySellerId;
4
+ const seller_1 = require("../seller");
5
+ /**
6
+ * @desc Adds a seller id to the filterable fields
7
+ */
8
+ function filterBySellerId() {
9
+ return async (req, _, next) => {
10
+ const seller = await (0, seller_1.fetchSellerByAuthActorId)(req.auth_context.actor_id, req.scope);
11
+ req.filterableFields.seller_id = seller.id;
12
+ return next();
13
+ };
14
+ }
15
+ //# sourceMappingURL=filter-by-seller-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-by-seller-id.js","sourceRoot":"","sources":["../../../src/utils/middlewares/filter-by-seller-id.ts"],"names":[],"mappings":";;AASA,4CAWC;AAhBD,sCAAqD;AAErD;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,OAAO,KAAK,EAAE,GAA+B,EAAE,CAAC,EAAE,IAAkB,EAAE,EAAE;QACtE,MAAM,MAAM,GAAG,MAAM,IAAA,iCAAwB,EAC3C,GAAG,CAAC,YAAY,CAAC,QAAQ,EACzB,GAAG,CAAC,KAAK,CACV,CAAC;QAEF,GAAG,CAAC,gBAAgB,CAAC,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC;QAE3C,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}