@vendure/core 1.6.4 → 1.7.1

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 (273) hide show
  1. package/dist/api/common/custom-field-relation-resolver.service.d.ts +3 -1
  2. package/dist/api/common/custom-field-relation-resolver.service.js +7 -5
  3. package/dist/api/common/custom-field-relation-resolver.service.js.map +1 -1
  4. package/dist/api/config/generate-resolvers.d.ts +3 -0
  5. package/dist/api/config/generate-resolvers.js +7 -1
  6. package/dist/api/config/generate-resolvers.js.map +1 -1
  7. package/dist/api/resolvers/admin/collection.resolver.js +8 -2
  8. package/dist/api/resolvers/admin/collection.resolver.js.map +1 -1
  9. package/dist/api/resolvers/admin/order.resolver.d.ts +3 -2
  10. package/dist/api/resolvers/admin/order.resolver.js +15 -3
  11. package/dist/api/resolvers/admin/order.resolver.js.map +1 -1
  12. package/dist/api/resolvers/admin/product-option.resolver.d.ts +2 -1
  13. package/dist/api/resolvers/admin/product-option.resolver.js +13 -0
  14. package/dist/api/resolvers/admin/product-option.resolver.js.map +1 -1
  15. package/dist/api/resolvers/base/base-auth.resolver.d.ts +2 -2
  16. package/dist/api/resolvers/base/base-auth.resolver.js.map +1 -1
  17. package/dist/api/resolvers/entity/fulfillment-entity.resolver.d.ts +8 -2
  18. package/dist/api/resolvers/entity/fulfillment-entity.resolver.js +17 -3
  19. package/dist/api/resolvers/entity/fulfillment-entity.resolver.js.map +1 -1
  20. package/dist/api/resolvers/entity/order-item-entity.resolver.d.ts +3 -1
  21. package/dist/api/resolvers/entity/order-item-entity.resolver.js +9 -3
  22. package/dist/api/resolvers/entity/order-item-entity.resolver.js.map +1 -1
  23. package/dist/api/resolvers/entity/order-line-entity.resolver.d.ts +5 -3
  24. package/dist/api/resolvers/entity/order-line-entity.resolver.js +19 -2
  25. package/dist/api/resolvers/entity/order-line-entity.resolver.js.map +1 -1
  26. package/dist/api/resolvers/entity/payment-entity.resolver.d.ts +3 -1
  27. package/dist/api/resolvers/entity/payment-entity.resolver.js +6 -3
  28. package/dist/api/resolvers/entity/payment-entity.resolver.js.map +1 -1
  29. package/dist/api/resolvers/entity/product-option-group-entity.resolver.js +8 -3
  30. package/dist/api/resolvers/entity/product-option-group-entity.resolver.js.map +1 -1
  31. package/dist/api/resolvers/shop/shop-products.resolver.js +8 -2
  32. package/dist/api/resolvers/shop/shop-products.resolver.js.map +1 -1
  33. package/dist/api/schema/admin-api/order.api.graphql +11 -0
  34. package/dist/api/schema/admin-api/product-option-group.api.graphql +2 -0
  35. package/dist/api/schema/common/order.type.graphql +7 -0
  36. package/dist/bootstrap.js +2 -3
  37. package/dist/bootstrap.js.map +1 -1
  38. package/dist/common/configurable-operation.js +9 -4
  39. package/dist/common/configurable-operation.js.map +1 -1
  40. package/dist/common/constants.d.ts +1 -2
  41. package/dist/common/error/errors.d.ts +1 -0
  42. package/dist/common/error/errors.js.map +1 -1
  43. package/dist/common/error/generated-graphql-admin-errors.d.ts +10 -0
  44. package/dist/common/error/generated-graphql-admin-errors.js +17 -2
  45. package/dist/common/error/generated-graphql-admin-errors.js.map +1 -1
  46. package/dist/config/asset-import-strategy/asset-import-strategy.d.ts +24 -0
  47. package/dist/config/asset-import-strategy/asset-import-strategy.js +3 -0
  48. package/dist/config/asset-import-strategy/asset-import-strategy.js.map +1 -0
  49. package/dist/config/asset-import-strategy/default-asset-import-strategy.d.ts +24 -0
  50. package/dist/config/asset-import-strategy/default-asset-import-strategy.js +91 -0
  51. package/dist/config/asset-import-strategy/default-asset-import-strategy.js.map +1 -0
  52. package/dist/config/asset-naming-strategy/default-asset-naming-strategy.js +1 -1
  53. package/dist/config/asset-naming-strategy/default-asset-naming-strategy.js.map +1 -1
  54. package/dist/config/catalog/default-collection-filters.d.ts +18 -19
  55. package/dist/config/config-helpers.d.ts +4 -0
  56. package/dist/config/config-helpers.js +8 -1
  57. package/dist/config/config-helpers.js.map +1 -1
  58. package/dist/config/config.module.js +11 -0
  59. package/dist/config/config.module.js.map +1 -1
  60. package/dist/config/default-config.js +3 -1
  61. package/dist/config/default-config.js.map +1 -1
  62. package/dist/config/entity-id-strategy/entity-id-strategy.d.ts +7 -0
  63. package/dist/config/fulfillment/custom-fulfillment-process.d.ts +2 -2
  64. package/dist/config/index.d.ts +1 -0
  65. package/dist/config/index.js +1 -0
  66. package/dist/config/index.js.map +1 -1
  67. package/dist/config/logger/vendure-logger.d.ts +1 -0
  68. package/dist/config/logger/vendure-logger.js.map +1 -1
  69. package/dist/config/order/custom-order-process.d.ts +2 -2
  70. package/dist/config/order/order-item-price-calculation-strategy.d.ts +3 -0
  71. package/dist/config/payment/custom-payment-process.d.ts +2 -2
  72. package/dist/config/payment/dummy-payment-method-handler.js +8 -0
  73. package/dist/config/payment/dummy-payment-method-handler.js.map +1 -1
  74. package/dist/config/payment/payment-method-handler.d.ts +66 -0
  75. package/dist/config/payment/payment-method-handler.js +11 -1
  76. package/dist/config/payment/payment-method-handler.js.map +1 -1
  77. package/dist/config/promotion/actions/order-fixed-discount-action.js +1 -1
  78. package/dist/config/promotion/actions/order-fixed-discount-action.js.map +1 -1
  79. package/dist/config/promotion/conditions/buy-x-get-y-free-condition.d.ts +5 -7
  80. package/dist/config/vendure-config.d.ts +18 -0
  81. package/dist/connection/connection.module.d.ts +1 -1
  82. package/dist/connection/remove-custom-fields-with-eager-relations.d.ts +34 -0
  83. package/dist/connection/remove-custom-fields-with-eager-relations.js +55 -0
  84. package/dist/connection/remove-custom-fields-with-eager-relations.js.map +1 -0
  85. package/dist/connection/transaction-subscriber.d.ts +16 -2
  86. package/dist/connection/transaction-subscriber.js +27 -7
  87. package/dist/connection/transaction-subscriber.js.map +1 -1
  88. package/dist/connection/transaction-wrapper.js +6 -9
  89. package/dist/connection/transaction-wrapper.js.map +1 -1
  90. package/dist/connection/transactional-connection.d.ts +2 -33
  91. package/dist/connection/transactional-connection.js +23 -55
  92. package/dist/connection/transactional-connection.js.map +1 -1
  93. package/dist/data-import/providers/asset-importer/asset-importer.js +12 -18
  94. package/dist/data-import/providers/asset-importer/asset-importer.js.map +1 -1
  95. package/dist/entity/asset/asset.entity.js +4 -2
  96. package/dist/entity/asset/asset.entity.js.map +1 -1
  97. package/dist/entity/asset/orderable-asset.entity.js +3 -1
  98. package/dist/entity/asset/orderable-asset.entity.js.map +1 -1
  99. package/dist/entity/authentication-method/external-authentication-method.entity.js +3 -1
  100. package/dist/entity/authentication-method/external-authentication-method.entity.js.map +1 -1
  101. package/dist/entity/authentication-method/native-authentication-method.entity.js +3 -1
  102. package/dist/entity/authentication-method/native-authentication-method.entity.js.map +1 -1
  103. package/dist/entity/channel/channel.entity.js +5 -3
  104. package/dist/entity/channel/channel.entity.js.map +1 -1
  105. package/dist/entity/collection/collection-asset.entity.js +4 -2
  106. package/dist/entity/collection/collection-asset.entity.js.map +1 -1
  107. package/dist/entity/collection/collection-translation.entity.js +4 -2
  108. package/dist/entity/collection/collection-translation.entity.js.map +1 -1
  109. package/dist/entity/country/country-translation.entity.js +4 -2
  110. package/dist/entity/country/country-translation.entity.js.map +1 -1
  111. package/dist/entity/country/country.entity.js +3 -1
  112. package/dist/entity/country/country.entity.js.map +1 -1
  113. package/dist/entity/customer-group/customer-group.entity.js +3 -1
  114. package/dist/entity/customer-group/customer-group.entity.js.map +1 -1
  115. package/dist/entity/fulfillment/fulfillment.entity.js +3 -1
  116. package/dist/entity/fulfillment/fulfillment.entity.js.map +1 -1
  117. package/dist/entity/global-settings/global-settings.entity.js +3 -1
  118. package/dist/entity/global-settings/global-settings.entity.js.map +1 -1
  119. package/dist/entity/order-line/order-line.entity.js +4 -0
  120. package/dist/entity/order-line/order-line.entity.js.map +1 -1
  121. package/dist/entity/product/product-asset.entity.js +4 -2
  122. package/dist/entity/product/product-asset.entity.js.map +1 -1
  123. package/dist/entity/product-option/product-option-translation.entity.js.map +1 -1
  124. package/dist/entity/product-option-group/product-option-group-translation.entity.js.map +1 -1
  125. package/dist/entity/product-variant/product-variant-asset.entity.js +4 -2
  126. package/dist/entity/product-variant/product-variant-asset.entity.js.map +1 -1
  127. package/dist/entity/role/role.entity.js +3 -1
  128. package/dist/entity/role/role.entity.js.map +1 -1
  129. package/dist/entity/tag/tag.entity.js +3 -1
  130. package/dist/entity/tag/tag.entity.js.map +1 -1
  131. package/dist/entity/user/user.entity.js +3 -1
  132. package/dist/entity/user/user.entity.js.map +1 -1
  133. package/dist/entity/zone/zone.entity.js +3 -1
  134. package/dist/entity/zone/zone.entity.js.map +1 -1
  135. package/dist/event-bus/event-bus.js +14 -3
  136. package/dist/event-bus/event-bus.js.map +1 -1
  137. package/dist/event-bus/events/initializer-event.d.ts +12 -0
  138. package/dist/event-bus/events/initializer-event.js +19 -0
  139. package/dist/event-bus/events/initializer-event.js.map +1 -0
  140. package/dist/event-bus/events/product-option-event.d.ts +1 -1
  141. package/dist/event-bus/events/product-option-event.js.map +1 -1
  142. package/dist/event-bus/events/product-option-group-event.d.ts +1 -1
  143. package/dist/event-bus/events/product-option-group-event.js.map +1 -1
  144. package/dist/event-bus/index.d.ts +1 -0
  145. package/dist/event-bus/index.js +1 -0
  146. package/dist/event-bus/index.js.map +1 -1
  147. package/dist/i18n/messages/en.json +3 -0
  148. package/dist/job-queue/in-memory-job-queue-strategy.d.ts +1 -1
  149. package/dist/migrate.js +14 -0
  150. package/dist/migrate.js.map +1 -1
  151. package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js +33 -33
  152. package/dist/plugin/default-search-plugin/search-strategy/mysql-search-strategy.js.map +1 -1
  153. package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js +7 -7
  154. package/dist/plugin/default-search-plugin/search-strategy/postgres-search-strategy.js.map +1 -1
  155. package/dist/plugin/default-search-plugin/search-strategy/search-strategy-common.d.ts +1 -0
  156. package/dist/plugin/default-search-plugin/search-strategy/search-strategy-common.js +8 -1
  157. package/dist/plugin/default-search-plugin/search-strategy/search-strategy-common.js.map +1 -1
  158. package/dist/plugin/default-search-plugin/search-strategy/search-strategy-utils.d.ts +11 -1
  159. package/dist/plugin/default-search-plugin/search-strategy/search-strategy-utils.js +31 -1
  160. package/dist/plugin/default-search-plugin/search-strategy/search-strategy-utils.js.map +1 -1
  161. package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js +29 -29
  162. package/dist/plugin/default-search-plugin/search-strategy/sqlite-search-strategy.js.map +1 -1
  163. package/dist/plugin/plugin-metadata.js +2 -1
  164. package/dist/plugin/plugin-metadata.js.map +1 -1
  165. package/dist/plugin/vendure-plugin.d.ts +11 -2
  166. package/dist/plugin/vendure-plugin.js.map +1 -1
  167. package/dist/service/helpers/config-arg/config-arg.service.d.ts +1 -0
  168. package/dist/service/helpers/config-arg/config-arg.service.js +12 -1
  169. package/dist/service/helpers/config-arg/config-arg.service.js.map +1 -1
  170. package/dist/service/helpers/entity-hydrator/entity-hydrator.service.d.ts +3 -1
  171. package/dist/service/helpers/entity-hydrator/entity-hydrator.service.js +6 -4
  172. package/dist/service/helpers/entity-hydrator/entity-hydrator.service.js.map +1 -1
  173. package/dist/service/helpers/fulfillment-state-machine/fulfillment-state.d.ts +9 -1
  174. package/dist/service/helpers/fulfillment-state-machine/fulfillment-state.js.map +1 -1
  175. package/dist/service/helpers/list-query-builder/connection-utils.js +7 -1
  176. package/dist/service/helpers/list-query-builder/connection-utils.js.map +1 -1
  177. package/dist/service/helpers/list-query-builder/list-query-builder.d.ts +4 -3
  178. package/dist/service/helpers/list-query-builder/list-query-builder.js +17 -8
  179. package/dist/service/helpers/list-query-builder/list-query-builder.js.map +1 -1
  180. package/dist/service/helpers/locale-string-hydrator/locale-string-hydrator.d.ts +3 -1
  181. package/dist/service/helpers/locale-string-hydrator/locale-string-hydrator.js +6 -4
  182. package/dist/service/helpers/locale-string-hydrator/locale-string-hydrator.js.map +1 -1
  183. package/dist/service/helpers/order-calculator/order-calculator.d.ts +18 -0
  184. package/dist/service/helpers/order-calculator/order-calculator.js +18 -0
  185. package/dist/service/helpers/order-calculator/order-calculator.js.map +1 -1
  186. package/dist/service/helpers/order-modifier/order-modifier.d.ts +19 -1
  187. package/dist/service/helpers/order-modifier/order-modifier.js +49 -20
  188. package/dist/service/helpers/order-modifier/order-modifier.js.map +1 -1
  189. package/dist/service/helpers/order-state-machine/order-state-machine.js +1 -1
  190. package/dist/service/helpers/order-state-machine/order-state-machine.js.map +1 -1
  191. package/dist/service/helpers/order-state-machine/order-state.d.ts +9 -1
  192. package/dist/service/helpers/order-state-machine/order-state.js.map +1 -1
  193. package/dist/service/helpers/payment-state-machine/payment-state.d.ts +9 -1
  194. package/dist/service/helpers/payment-state-machine/payment-state.js.map +1 -1
  195. package/dist/service/helpers/product-price-applicator/product-price-applicator.d.ts +26 -2
  196. package/dist/service/helpers/product-price-applicator/product-price-applicator.js +26 -2
  197. package/dist/service/helpers/product-price-applicator/product-price-applicator.js.map +1 -1
  198. package/dist/service/helpers/slug-validator/slug-validator.d.ts +16 -0
  199. package/dist/service/helpers/slug-validator/slug-validator.js +11 -1
  200. package/dist/service/helpers/slug-validator/slug-validator.js.map +1 -1
  201. package/dist/service/helpers/translatable-saver/translatable-saver.d.ts +28 -1
  202. package/dist/service/helpers/translatable-saver/translatable-saver.js +28 -1
  203. package/dist/service/helpers/translatable-saver/translatable-saver.js.map +1 -1
  204. package/dist/service/helpers/translator/translator.service.d.ts +10 -0
  205. package/dist/service/helpers/translator/translator.service.js +29 -0
  206. package/dist/service/helpers/translator/translator.service.js.map +1 -0
  207. package/dist/service/helpers/utils/translate-entity.d.ts +3 -3
  208. package/dist/service/helpers/utils/translate-entity.js +11 -2
  209. package/dist/service/helpers/utils/translate-entity.js.map +1 -1
  210. package/dist/service/index.d.ts +1 -0
  211. package/dist/service/index.js +1 -0
  212. package/dist/service/index.js.map +1 -1
  213. package/dist/service/initializer.service.d.ts +3 -1
  214. package/dist/service/initializer.service.js +7 -2
  215. package/dist/service/initializer.service.js.map +1 -1
  216. package/dist/service/service.module.js +2 -0
  217. package/dist/service/service.module.js.map +1 -1
  218. package/dist/service/services/asset.service.d.ts +2 -1
  219. package/dist/service/services/asset.service.js +19 -4
  220. package/dist/service/services/asset.service.js.map +1 -1
  221. package/dist/service/services/collection.service.d.ts +3 -1
  222. package/dist/service/services/collection.service.js +16 -16
  223. package/dist/service/services/collection.service.js.map +1 -1
  224. package/dist/service/services/country.service.d.ts +3 -1
  225. package/dist/service/services/country.service.js +9 -7
  226. package/dist/service/services/country.service.js.map +1 -1
  227. package/dist/service/services/customer.service.d.ts +3 -1
  228. package/dist/service/services/customer.service.js +8 -6
  229. package/dist/service/services/customer.service.js.map +1 -1
  230. package/dist/service/services/facet-value.service.d.ts +3 -1
  231. package/dist/service/services/facet-value.service.js +11 -6
  232. package/dist/service/services/facet-value.service.js.map +1 -1
  233. package/dist/service/services/facet.service.d.ts +3 -1
  234. package/dist/service/services/facet.service.js +18 -8
  235. package/dist/service/services/facet.service.js.map +1 -1
  236. package/dist/service/services/fulfillment.service.d.ts +9 -0
  237. package/dist/service/services/fulfillment.service.js +48 -8
  238. package/dist/service/services/fulfillment.service.js.map +1 -1
  239. package/dist/service/services/order-testing.service.d.ts +3 -1
  240. package/dist/service/services/order-testing.service.js +6 -4
  241. package/dist/service/services/order-testing.service.js.map +1 -1
  242. package/dist/service/services/order.service.d.ts +10 -2
  243. package/dist/service/services/order.service.js +50 -27
  244. package/dist/service/services/order.service.js.map +1 -1
  245. package/dist/service/services/payment.service.d.ts +2 -0
  246. package/dist/service/services/payment.service.js +30 -10
  247. package/dist/service/services/payment.service.js.map +1 -1
  248. package/dist/service/services/product-option-group.service.d.ts +24 -2
  249. package/dist/service/services/product-option-group.service.js +92 -6
  250. package/dist/service/services/product-option-group.service.js.map +1 -1
  251. package/dist/service/services/product-option.service.d.ts +15 -2
  252. package/dist/service/services/product-option.service.js +66 -5
  253. package/dist/service/services/product-option.service.js.map +1 -1
  254. package/dist/service/services/product-variant.service.d.ts +3 -1
  255. package/dist/service/services/product-variant.service.js +12 -10
  256. package/dist/service/services/product-variant.service.js.map +1 -1
  257. package/dist/service/services/product.service.d.ts +5 -1
  258. package/dist/service/services/product.service.js +55 -20
  259. package/dist/service/services/product.service.js.map +1 -1
  260. package/dist/service/services/promotion.service.js +4 -1
  261. package/dist/service/services/promotion.service.js.map +1 -1
  262. package/dist/service/services/shipping-method.service.d.ts +3 -1
  263. package/dist/service/services/shipping-method.service.js +8 -6
  264. package/dist/service/services/shipping-method.service.js.map +1 -1
  265. package/dist/service/services/stock-movement.service.js +8 -7
  266. package/dist/service/services/stock-movement.service.js.map +1 -1
  267. package/dist/service/services/user.service.d.ts +1 -1
  268. package/dist/service/services/user.service.js +5 -0
  269. package/dist/service/services/user.service.js.map +1 -1
  270. package/dist/service/services/zone.service.d.ts +3 -1
  271. package/dist/service/services/zone.service.js +8 -6
  272. package/dist/service/services/zone.service.js.map +1 -1
  273. package/package.json +4 -4
@@ -63,7 +63,7 @@ class PaymentMethodHandler extends configurable_operation_1.ConfigurableOperatio
63
63
  super(config);
64
64
  this.createPaymentFn = config.createPayment;
65
65
  this.settlePaymentFn = config.settlePayment;
66
- this.settlePaymentFn = config.settlePayment;
66
+ this.cancelPaymentFn = config.cancelPayment;
67
67
  this.createRefundFn = config.createRefund;
68
68
  this.onTransitionStartFn = config.onStateTransitionStart;
69
69
  }
@@ -86,6 +86,16 @@ class PaymentMethodHandler extends configurable_operation_1.ConfigurableOperatio
86
86
  async settlePayment(ctx, order, payment, args, method) {
87
87
  return this.settlePaymentFn(ctx, order, payment, this.argsArrayToHash(args), method);
88
88
  }
89
+ /**
90
+ * @description
91
+ * Called internally to cancel a payment
92
+ *
93
+ * @internal
94
+ */
95
+ async cancelPayment(ctx, order, payment, args, method) {
96
+ var _a;
97
+ return (_a = this.cancelPaymentFn) === null || _a === void 0 ? void 0 : _a.call(this, ctx, order, payment, this.argsArrayToHash(args), method);
98
+ }
89
99
  /**
90
100
  * @description
91
101
  * Called internally to create a refund
@@ -1 +1 @@
1
- {"version":3,"file":"payment-method-handler.js","sourceRoot":"","sources":["../../../src/config/payment/pay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iB,EACjB,MAAqB;QAErB,OAAO,IAAI,CAAC,cAAc;YACtB,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAC7F,CAAC,CAAC,KAAK,CAAC;IAChB,CAAC;IAED;;;;;;;OAOG;IACH,sBAAsB,CAClB,SAAuB,EACvB,OAAqB,EACrB,IAA2B;QAE3B,IAAI,OAAO,IAAI,CAAC,mBAAmB,KAAK,UAAU,EAAE;YAChD,OAAO,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;SAC7D;aAAM;YACH,OAAO,IAAI,CAAC;SACf;IACL,CAAC;CACJ;AAnGD,oDAmGC"}
1
+ {"version":3,"file":"payment-method-handler.js","sourceRoot":"","sources":["../../../src/config/payment/payment-method-handler.ts"],"names":[],"mappings":";;;AAGA,gFAK6C;AAiS7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAa,oBAAwD,SAAQ,iDAA2B;IAOpG,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC;QAC5C,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC;QAC5C,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC;QAC5C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,sBAAsB,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CACf,GAAmB,EACnB,KAAY,EACZ,MAAc,EACd,IAAiB,EACjB,QAAyB,EACzB,MAAqB;QAErB,MAAM,aAAa,GA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E;YAChD,OAAO,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;SAC7D;aAAM;YACH,OAAO,IAAI,CAAC;SACf;IACL,CAAC;CACJ;AApHD,oDAoHC"}
@@ -14,7 +14,7 @@ exports.orderFixedDiscount = new promotion_action_1.PromotionOrderAction({
14
14
  },
15
15
  },
16
16
  execute(ctx, order, args) {
17
- return -args.discount;
17
+ return -Math.min(args.discount, order.total);
18
18
  },
19
19
  description: [{ languageCode: generated_types_1.LanguageCode.en, value: 'Discount order by fixed amount' }],
20
20
  });
@@ -1 +1 @@
1
- {"version":3,"file":"order-fixed-discount-action.js","sourceRoot":"","sources":["../../../../src/config/promotion/actions/order-fixed-discount-action.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE,0DAA2D;AAE9C,QAAA,kBAAkB,GAAG,IAAI,uCAAoB,CAAC;IACvD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACF,QAAQ,EAAE;YACN,IAAI,EAAE,KAAK;YACX,EAAE,EAAE;gBACA,SAAS,EAAE,qBAAqB;aACnC;SACJ;KACJ;IACD,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI;QACpB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;IAC1B,CAAC;IACD,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,8BAAY,CAAC,EAAE,EAAE,KAAK,EAAE,gCAAgC,EAAE,CAAC;CAC5F,CAAC,CAAC"}
1
+ {"version":3,"file":"order-fixed-discount-action.js","sourceRoot":"","sources":["../../../../src/config/promotion/actions/order-fixed-discount-action.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE,0DAA2D;AAE9C,QAAA,kBAAkB,GAAG,IAAI,uCAAoB,CAAC;IACvD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACF,QAAQ,EAAE;YACN,IAAI,EAAE,KAAK;YACX,EAAE,EAAE;gBACA,SAAS,EAAE,qBAAqB;aACnC;SACJ;KACJ;IACD,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI;QACpB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IACD,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,8BAAY,CAAC,EAAE,EAAE,KAAK,EAAE,gCAAgC,EAAE,CAAC;CAC5F,CAAC,CAAC"}
@@ -1,5 +1,3 @@
1
- import { LanguageCode } from '@vendure/common/lib/generated-types';
2
- import { ID } from '@vendure/common/lib/shared-types';
3
1
  import { PromotionCondition } from '../promotion-condition';
4
2
  export declare const buyXGetYFreeCondition: PromotionCondition<{
5
3
  amountX: {
@@ -7,13 +5,13 @@ export declare const buyXGetYFreeCondition: PromotionCondition<{
7
5
  defaultValue: number;
8
6
  };
9
7
  variantIdsX: {
10
- type: "ID";
8
+ type: string;
11
9
  list: true;
12
10
  ui: {
13
11
  component: string;
14
12
  };
15
13
  label: {
16
- languageCode: LanguageCode.en;
14
+ languageCode: any;
17
15
  value: string;
18
16
  }[];
19
17
  };
@@ -22,16 +20,16 @@ export declare const buyXGetYFreeCondition: PromotionCondition<{
22
20
  defaultValue: number;
23
21
  };
24
22
  variantIdsY: {
25
- type: "ID";
23
+ type: string;
26
24
  list: true;
27
25
  ui: {
28
26
  component: string;
29
27
  };
30
28
  label: {
31
- languageCode: LanguageCode.en;
29
+ languageCode: any;
32
30
  value: string;
33
31
  }[];
34
32
  };
35
33
  }, "buy_x_get_y_free", false | {
36
- freeItemIds: ID[];
34
+ freeItemIds: any[];
37
35
  }>;
@@ -7,6 +7,7 @@ import { ConnectionOptions } from 'typeorm';
7
7
  import { Middleware } from '../common';
8
8
  import { PermissionDefinition } from '../common/permission-definition';
9
9
  import { JobBufferStorageStrategy } from '../job-queue/job-buffer/job-buffer-storage-strategy';
10
+ import { AssetImportStrategy } from './asset-import-strategy/asset-import-strategy';
10
11
  import { AssetNamingStrategy } from './asset-naming-strategy/asset-naming-strategy';
11
12
  import { AssetPreviewStrategy } from './asset-preview-strategy/asset-preview-strategy';
12
13
  import { AssetStorageStrategy } from './asset-storage-strategy/asset-storage-strategy';
@@ -747,6 +748,14 @@ export interface ImportExportOptions {
747
748
  * @default __dirname
748
749
  */
749
750
  importAssetsDir?: string;
751
+ /**
752
+ * @description
753
+ * This strategy determines how asset files get imported based on the path given in the
754
+ * import CSV or via the {@link AssetImporter} `getAssets()` method.
755
+ *
756
+ * @since 1.7.0
757
+ */
758
+ assetImportStrategy?: AssetImportStrategy;
750
759
  }
751
760
  /**
752
761
  * @description
@@ -805,6 +814,8 @@ export interface JobQueueOptions {
805
814
  *
806
815
  * @since 1.3.0
807
816
  * @docsCategory configuration
817
+ * @docsPage EntityOptions
818
+ * @docsWeight 0
808
819
  */
809
820
  export interface EntityOptions {
810
821
  /**
@@ -814,6 +825,13 @@ export interface EntityOptions {
814
825
  * entities via the API. The default uses a simple auto-increment integer
815
826
  * strategy.
816
827
  *
828
+ * {{% alert "warning" %}}
829
+ * Note: changing from an integer-based strategy to a uuid-based strategy
830
+ * on an existing Vendure database will lead to problems with broken foreign-key
831
+ * references. To change primary key types like this, you'll need to start with
832
+ * a fresh database.
833
+ * {{% /alert %}}
834
+ *
817
835
  * @since 1.3.0
818
836
  * @default AutoIncrementIdStrategy
819
837
  */
@@ -3,5 +3,5 @@ import { ConnectionOptions } from 'typeorm';
3
3
  export declare class ConnectionModule {
4
4
  static forRoot(): DynamicModule;
5
5
  static forPlugin(): DynamicModule;
6
- static getTypeOrmLogger(dbConnectionOptions: ConnectionOptions): import("typeorm").Logger | "debug" | "advanced-console" | "simple-console" | "file";
6
+ static getTypeOrmLogger(dbConnectionOptions: ConnectionOptions): "debug" | import("typeorm").Logger | "advanced-console" | "simple-console" | "file";
7
7
  }
@@ -0,0 +1,34 @@
1
+ import { SelectQueryBuilder } from 'typeorm';
2
+ /**
3
+ * This is a work-around for this issue: https://github.com/vendure-ecommerce/vendure/issues/1664
4
+ *
5
+ * Explanation:
6
+ * When calling `FindOptionsUtils.joinEagerRelations()`, there appears to be a bug in TypeORM whereby
7
+ * it will throw the following error *if* the `options.relations` array contains any customField relations
8
+ * where the related entity itself has eagerly-loaded relations.
9
+ *
10
+ * For example, let's say we define a custom field on the Product entity like this:
11
+ * ```
12
+ * Product: [{
13
+ * name: 'featuredFacet',
14
+ * type: 'relation',
15
+ * entity: Facet,
16
+ * }],
17
+ * ```
18
+ * and then we pass into `TransactionalConnection.findOneInChannel()` an options array of:
19
+ *
20
+ * ```
21
+ * { relations: ['customFields.featuredFacet'] }
22
+ * ```
23
+ * it will throw an error because the `Facet` entity itself has eager relations (namely the `translations` property).
24
+ * This will cause TypeORM to throw the error:
25
+ * ```
26
+ * TypeORMError: "entity__customFields" alias was not found. Maybe you forgot to join it?
27
+ * ```
28
+ *
29
+ * So this method introspects the QueryBuilder metadata and checks for any custom field relations which
30
+ * themselves have eager relations. If found, it removes those items from the `options.relations` array.
31
+ *
32
+ * TODO: Ideally create a minimal reproduction case and report in the TypeORM repo for an upstream fix.
33
+ */
34
+ export declare function removeCustomFieldsWithEagerRelations(qb: SelectQueryBuilder<any>, relations?: string[]): string[];
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeCustomFieldsWithEagerRelations = void 0;
4
+ const index_1 = require("../config/index");
5
+ /**
6
+ * This is a work-around for this issue: https://github.com/vendure-ecommerce/vendure/issues/1664
7
+ *
8
+ * Explanation:
9
+ * When calling `FindOptionsUtils.joinEagerRelations()`, there appears to be a bug in TypeORM whereby
10
+ * it will throw the following error *if* the `options.relations` array contains any customField relations
11
+ * where the related entity itself has eagerly-loaded relations.
12
+ *
13
+ * For example, let's say we define a custom field on the Product entity like this:
14
+ * ```
15
+ * Product: [{
16
+ * name: 'featuredFacet',
17
+ * type: 'relation',
18
+ * entity: Facet,
19
+ * }],
20
+ * ```
21
+ * and then we pass into `TransactionalConnection.findOneInChannel()` an options array of:
22
+ *
23
+ * ```
24
+ * { relations: ['customFields.featuredFacet'] }
25
+ * ```
26
+ * it will throw an error because the `Facet` entity itself has eager relations (namely the `translations` property).
27
+ * This will cause TypeORM to throw the error:
28
+ * ```
29
+ * TypeORMError: "entity__customFields" alias was not found. Maybe you forgot to join it?
30
+ * ```
31
+ *
32
+ * So this method introspects the QueryBuilder metadata and checks for any custom field relations which
33
+ * themselves have eager relations. If found, it removes those items from the `options.relations` array.
34
+ *
35
+ * TODO: Ideally create a minimal reproduction case and report in the TypeORM repo for an upstream fix.
36
+ */
37
+ function removeCustomFieldsWithEagerRelations(qb, relations = []) {
38
+ let resultingRelations = relations;
39
+ const mainAlias = qb.expressionMap.mainAlias;
40
+ const customFieldsMetadata = mainAlias === null || mainAlias === void 0 ? void 0 : mainAlias.metadata.embeddeds.find(metadata => metadata.propertyName === 'customFields');
41
+ if (customFieldsMetadata) {
42
+ const customFieldRelationsWithEagerRelations = customFieldsMetadata.relations.filter(relation => !!relation.inverseEntityMetadata.ownRelations.find(or => or.isEager === true));
43
+ for (const relation of customFieldRelationsWithEagerRelations) {
44
+ const propertyName = relation.propertyName;
45
+ const relationsToRemove = relations.filter(r => r.startsWith(`customFields.${propertyName}`));
46
+ if (relationsToRemove.length) {
47
+ index_1.Logger.debug(`TransactionalConnection.findOneInChannel cannot automatically join relation [${mainAlias === null || mainAlias === void 0 ? void 0 : mainAlias.metadata.name}.customFields.${propertyName}]`);
48
+ resultingRelations = relations.filter(r => !r.startsWith(`customFields.${propertyName}`));
49
+ }
50
+ }
51
+ }
52
+ return resultingRelations;
53
+ }
54
+ exports.removeCustomFieldsWithEagerRelations = removeCustomFieldsWithEagerRelations;
55
+ //# sourceMappingURL=remove-custom-fields-with-eager-relations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-custom-fields-with-eager-relations.js","sourceRoot":"","sources":["../../src/connection/remove-custom-fields-with-eager-relations.ts"],"names":[],"mappings":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AAC9B,CAAC;AAzBD,oFAyBC"}
@@ -3,7 +3,19 @@ import { EntityManager } from 'typeorm/entity-manager/EntityManager';
3
3
  import { QueryRunner } from 'typeorm/query-runner/QueryRunner';
4
4
  import { TransactionCommitEvent } from 'typeorm/subscriber/event/TransactionCommitEvent';
5
5
  import { TransactionRollbackEvent } from 'typeorm/subscriber/event/TransactionRollbackEvent';
6
+ /**
7
+ * This error should be thrown by an event subscription if types do not match
8
+ *
9
+ * @internal
10
+ */
11
+ export declare class TransactionSubscriberError extends Error {
12
+ }
13
+ export declare type TransactionSubscriberEventType = 'commit' | 'rollback';
6
14
  export interface TransactionSubscriberEvent {
15
+ /**
16
+ * Event type. Either commit or rollback.
17
+ */
18
+ type: TransactionSubscriberEventType;
7
19
  /**
8
20
  * Connection used in the event.
9
21
  */
@@ -28,10 +40,12 @@ export interface TransactionSubscriberEvent {
28
40
  */
29
41
  export declare class TransactionSubscriber implements EntitySubscriberInterface {
30
42
  private connection;
31
- private commit$;
32
- private rollback$;
43
+ private subject$;
33
44
  constructor(connection: Connection);
34
45
  afterTransactionCommit(event: TransactionCommitEvent): void;
35
46
  afterTransactionRollback(event: TransactionRollbackEvent): void;
47
+ awaitCommit(queryRunner: QueryRunner): Promise<QueryRunner>;
48
+ awaitRollback(queryRunner: QueryRunner): Promise<QueryRunner>;
36
49
  awaitRelease(queryRunner: QueryRunner): Promise<QueryRunner>;
50
+ private awaitTransactionEvent;
37
51
  }
@@ -13,12 +13,20 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  };
14
14
  var TransactionSubscriber_1;
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.TransactionSubscriber = void 0;
16
+ exports.TransactionSubscriber = exports.TransactionSubscriberError = void 0;
17
17
  const common_1 = require("@nestjs/common");
18
18
  const typeorm_1 = require("@nestjs/typeorm");
19
19
  const rxjs_1 = require("rxjs");
20
20
  const operators_1 = require("rxjs/operators");
21
21
  const typeorm_2 = require("typeorm");
22
+ /**
23
+ * This error should be thrown by an event subscription if types do not match
24
+ *
25
+ * @internal
26
+ */
27
+ class TransactionSubscriberError extends Error {
28
+ }
29
+ exports.TransactionSubscriberError = TransactionSubscriberError;
22
30
  /**
23
31
  * This subscriber listens to all transaction commit/rollback events emitted by TypeORM
24
32
  * so that we can be notified as soon as a particular queryRunner's transactions ends.
@@ -29,22 +37,34 @@ const typeorm_2 = require("typeorm");
29
37
  let TransactionSubscriber = TransactionSubscriber_1 = class TransactionSubscriber {
30
38
  constructor(connection) {
31
39
  this.connection = connection;
32
- this.commit$ = new rxjs_1.Subject();
33
- this.rollback$ = new rxjs_1.Subject();
40
+ this.subject$ = new rxjs_1.Subject();
34
41
  if (!connection.subscribers.find(subscriber => subscriber.constructor === TransactionSubscriber_1)) {
35
42
  connection.subscribers.push(this);
36
43
  }
37
44
  }
38
45
  afterTransactionCommit(event) {
39
- this.commit$.next(event);
46
+ this.subject$.next(Object.assign({ type: 'commit' }, event));
40
47
  }
41
48
  afterTransactionRollback(event) {
42
- this.rollback$.next(event);
49
+ this.subject$.next(Object.assign({ type: 'rollback' }, event));
50
+ }
51
+ awaitCommit(queryRunner) {
52
+ return this.awaitTransactionEvent(queryRunner, 'commit');
53
+ }
54
+ awaitRollback(queryRunner) {
55
+ return this.awaitTransactionEvent(queryRunner, 'rollback');
43
56
  }
44
57
  awaitRelease(queryRunner) {
58
+ return this.awaitTransactionEvent(queryRunner);
59
+ }
60
+ awaitTransactionEvent(queryRunner, type) {
45
61
  if (queryRunner.isTransactionActive) {
46
- return rxjs_1.merge(this.commit$, this.rollback$)
47
- .pipe(operators_1.filter(event => event.queryRunner === queryRunner), operators_1.take(1), operators_1.map(event => event.queryRunner),
62
+ return this.subject$
63
+ .pipe(operators_1.filter(event => !event.queryRunner.isTransactionActive && event.queryRunner === queryRunner), operators_1.take(1), operators_1.tap(event => {
64
+ if (type && event.type !== type) {
65
+ throw new TransactionSubscriberError(`Unexpected event type: ${event.type}. Expected ${type}.`);
66
+ }
67
+ }), operators_1.map(event => event.queryRunner),
48
68
  // This `delay(0)` call appears to be necessary with the upgrade to TypeORM
49
69
  // v0.2.41, otherwise an active queryRunner can still get picked up in an event
50
70
  // subscriber function. This is manifested by the e2e test
@@ -1 +1 @@
1
- {"version":3,"file":"transaction-subscriber.js","sourceRoot":"","sources":["../../src/connection/transaction-subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,+BAAsC;AACtC,8CAA0D;AAC1D,qCAAgE;AAuBhE;;;;;;GAMG;AAEH,IAAa,qBAAqB,6BAAlC,MAAa,qBAAqB;IAI9B,YAAwC,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAHtD,YAAO,GAAG,IAAI,cAAO,EAA8B,CAAC;QACpD,cAAS,GAAG,IAAI,cAAO,EAA8B,CAAC;QAG1D,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,KAAK,uBAAqB,CAAC,EAAE;YAC9F,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrC;IACL,CAAC;IAED,sBAAsB,CAAC,KAA6B;QAChD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,wBAAwB,CAAC,KAA+B;QACpD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY,CAAC,WAAwB;QACjC,IAAI,WAAW,CAAC,mBAAmB,EAAE;YACjC,OAAO,YAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;iBACrC,IAAI,CACD,kBAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,WAAW,CAAC,EAClD,gBAAI,CAAC,CAAC,CAAC,EACP,eAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;YAC/B,2EAA2E;YAC3E,+EAA+E;YAC/E,0DAA0D;YAC1D,0EAA0E;YAC1E,wEAAwE;YACxE,mEAAmE;YACnE,iBAAK,CAAC,CAAC,CAAC,CACX;iBACA,SAAS,EAAE,CAAC;SACpB;aAAM;YACH,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACvC;IACL,CAAC;CACJ,CAAA;AAtCY,qBAAqB;IADjC,mBAAU,EAAE;IAKI,WAAA,0BAAgB,EAAE,CAAA;qCAAqB,oBAAU;GAJrD,qBAAqB,CAsCjC;AAtCY,sDAAqB"}
1
+ {"version":3,"file":"transaction-subscriber.js","sourceRoot":"","sources":["../../src/connection/transaction-subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,+BAAuD;AACvD,8CAA+D;AAC/D,qCAAgE;AAMhE;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,KAAK;CAAG;AAAxD,gEAAwD;AA0BxD;;;;;;GAMG;AAEH,IAAa,qBAAqB,6BAAlC,MAAa,qBAAqB;IAG9B,YAAwC,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAFtD,aAAQ,GAAG,IAAI,cAAO,EAA8B,CAAC;QAGzD,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,KAAK,uBAAqB,CAAC,EAAE;YAC9F,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrC;IACL,CAAC;IAED,sBAAsB,CAAC,KAA6B;QAChD,IAAI,CAAC,QAAQ,CAAC,IAAI,iBACd,IAAI,EAAE,QAAQ,IACX,KAAK,EACV,CAAC;IACP,CAAC;IAED,wBAAwB,CAAC,KAA+B;QACpD,IAAI,CAAC,QAAQ,CAAC,IAAI,iBACd,IAAI,EAAE,UAAU,IACb,KAAK,EACV,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sDAAqB"}
@@ -24,14 +24,8 @@ class TransactionWrapper {
24
24
  async executeInTransaction(originalCtx, work, mode, connection) {
25
25
  // Copy to make sure original context will remain valid after transaction completes
26
26
  const ctx = originalCtx.copy();
27
- const queryRunnerExists = !!ctx[constants_1.TRANSACTION_MANAGER_KEY];
28
- if (queryRunnerExists) {
29
- // If a QueryRunner already exists on the RequestContext, there must be an existing
30
- // outer transaction in progress. In that case, we just execute the work function
31
- // as usual without needing to further wrap in a transaction.
32
- return rxjs_1.from(work(ctx)).toPromise();
33
- }
34
- const queryRunner = connection.createQueryRunner();
27
+ const entityManager = ctx[constants_1.TRANSACTION_MANAGER_KEY];
28
+ const queryRunner = (entityManager === null || entityManager === void 0 ? void 0 : entityManager.queryRunner) || connection.createQueryRunner();
35
29
  if (mode === 'auto') {
36
30
  await this.startTransaction(queryRunner);
37
31
  }
@@ -57,7 +51,10 @@ class TransactionWrapper {
57
51
  throw error;
58
52
  }
59
53
  finally {
60
- if ((queryRunner === null || queryRunner === void 0 ? void 0 : queryRunner.isReleased) === false) {
54
+ if (!queryRunner.isTransactionActive
55
+ && queryRunner.isReleased === false) {
56
+ // There is a check for an active transaction
57
+ // because this could be a nested transaction (savepoint).
61
58
  await queryRunner.release();
62
59
  }
63
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transaction-wrapper.js","sourceRoot":"","sources":["../../src/connection/transaction-wrapper.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAC5C,8CAAsD;AAEtD,iGAA8F;AAI9F,mDAA8D;AAE9D;;;;GAIG;AACH,MAAa,kBAAkB;IAC3B;;;;;;;;;OASG;IACH,KAAK,CAAC,oBAAoB,CACtB,WAA2B,EAC3B,IAAyD,EACzD,IAAqB,EACrB,UAAsB;QAEtB,mFAAmF;QACnF,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;QAE/B,MAAM,iBAAiB,GAAG,CAAC,CAAE,GAAW,CAAC,mCAAuB,CAAC,CAAC;QAClE,IA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1D,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;aAC/B;SACJ;IACL,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,gBAAgB,CAAC,WAAwB;QACnD,MAAM,UAAU,GAAG,EAAE,CAAC;QACtB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,IAAI,SAAc,CAAC;QAEnB,wDAAwD;QACxD,KAAK,UAAU,uBAAuB;YAClC,IAAI;gBACA,MAAM,WAAW,CAAC,gBAAgB,EAAE,CAAC;gBACrC,OAAO,IAAI,CAAC;aACf;YAAC,OAAO,GAAG,EAAE;gBACV,SAAS,GAAG,GAAG,CAAC;gBAChB,IAAI,GAAG,YAAY,+DAA8B,EAAE;oBAC/C,OAAO,KAAK,CAAC;iBAChB;gBACD,MAAM,GAAG,CAAC;aACb;QACL,CAAC;QAED,OAAO,QAAQ,GAAG,UAAU,EAAE;YAC1B,MAAM,MAAM,GAAG,MAAM,uBAAuB,EAAE,CAAC;YAC/C,IAAI,MAAM,EAAE;gBACR,OAAO;aACV;YACD,QAAQ,EAAE,CAAC;YACX,6CAA6C;YAC7C,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC;SACpE;QACD,MAAM,SAAS,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACK,gBAAgB,CAAC,GAAQ;QAC7B,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,KAAK,kBAAkB,CAAC;QACtD,MAAM,gBAAgB,GAAG,GAAG,CAAC,IAAI,KAAK,mBAAmB,CAAC;QAC1D,OAAO,aAAa,IAAI,gBAAgB,CAAC;IAC7C,CAAC;CACJ;AA7GD,gDA6GC"}
@@ -33,6 +33,8 @@ export declare class TransactionalConnection {
33
33
  * Returns a TypeORM repository. Note that when no RequestContext is supplied, the repository will not
34
34
  * be aware of any existing transaction. Therefore calling this method without supplying a RequestContext
35
35
  * is discouraged without a deliberate reason.
36
+ *
37
+ * @deprecated since 1.7.0: Use {@link TransactionalConnection.rawConnection rawConnection.getRepository()} function instead.
36
38
  */
37
39
  getRepository<Entity>(target: ObjectType<Entity> | EntitySchema<Entity> | string): Repository<Entity>;
38
40
  /**
@@ -119,39 +121,6 @@ export declare class TransactionalConnection {
119
121
  * the given Channel.
120
122
  */
121
123
  findOneInChannel<T extends ChannelAware & VendureEntity>(ctx: RequestContext, entity: Type<T>, id: ID, channelId: ID, options?: FindOneOptions): Promise<T | undefined>;
122
- /**
123
- * This is a work-around for this issue: https://github.com/vendure-ecommerce/vendure/issues/1664
124
- *
125
- * Explanation:
126
- * When calling `FindOptionsUtils.joinEagerRelations()`, there appears to be a bug in TypeORM whereby
127
- * it will throw the following error *if* the `options.relations` array contains any customField relations
128
- * where the related entity itself has eagerly-loaded relations.
129
- *
130
- * For example, let's say we define a custom field on the Product entity like this:
131
- * ```
132
- * Product: [{
133
- * name: 'featuredFacet',
134
- * type: 'relation',
135
- * entity: Facet,
136
- * }],
137
- * ```
138
- * and then we pass into `TransactionalConnection.findOneInChannel()` an options array of:
139
- *
140
- * ```
141
- * { relations: ['customFields.featuredFacet'] }
142
- * ```
143
- * it will throw an error because the `Facet` entity itself has eager relations (namely the `translations` property).
144
- * This will cause TypeORM to throw the error:
145
- * ```
146
- * TypeORMError: "entity__customFields" alias was not found. Maybe you forgot to join it?
147
- * ```
148
- *
149
- * So this method introspects the QueryBuilder metadata and checks for any custom field relations which
150
- * themselves have eager relations. If found, it removes those items from the `options.relations` array.
151
- *
152
- * TODO: Ideally create a minimal reproduction case and report in the TypeORM repo for an upstream fix.
153
- */
154
- private removeCustomFieldsWithEagerRelations;
155
124
  /**
156
125
  * @description
157
126
  * Like the TypeOrm `Repository.findByIds()` method, but limits the results to
@@ -31,6 +31,7 @@ const request_context_1 = require("../api/common/request-context");
31
31
  const constants_1 = require("../common/constants");
32
32
  const errors_1 = require("../common/error/errors");
33
33
  const index_1 = require("../config/index");
34
+ const remove_custom_fields_with_eager_relations_1 = require("./remove-custom-fields-with-eager-relations");
34
35
  const transaction_wrapper_1 = require("./transaction-wrapper");
35
36
  /**
36
37
  * @description
@@ -67,12 +68,12 @@ let TransactionalConnection = class TransactionalConnection {
67
68
  }
68
69
  else {
69
70
  // tslint:disable-next-line:no-non-null-assertion
70
- return typeorm_2.getRepository(maybeTarget);
71
+ return this.rawConnection.getRepository(maybeTarget);
71
72
  }
72
73
  }
73
74
  else {
74
75
  // tslint:disable-next-line:no-non-null-assertion
75
- return typeorm_2.getRepository(ctxOrTarget !== null && ctxOrTarget !== void 0 ? ctxOrTarget : maybeTarget);
76
+ return this.rawConnection.getRepository(ctxOrTarget !== null && ctxOrTarget !== void 0 ? ctxOrTarget : maybeTarget);
76
77
  }
77
78
  }
78
79
  async withTransaction(ctxOrWork, maybeWork) {
@@ -180,10 +181,26 @@ let TransactionalConnection = class TransactionalConnection {
180
181
  * the given Channel.
181
182
  */
182
183
  findOneInChannel(ctx, entity, id, channelId, options = {}) {
183
- const qb = this.getRepository(ctx, entity).createQueryBuilder('entity');
184
- options.relations = this.removeCustomFieldsWithEagerRelations(qb, options.relations);
185
- typeorm_2.FindOptionsUtils.applyFindManyOptionsOrConditionsToQueryBuilder(qb, options);
186
- if (options.loadEagerRelations !== false) {
184
+ let qb = this.getRepository(ctx, entity).createQueryBuilder('entity');
185
+ options.relations = remove_custom_fields_with_eager_relations_1.removeCustomFieldsWithEagerRelations(qb, options.relations);
186
+ let skipEagerRelations = false;
187
+ try {
188
+ typeorm_2.FindOptionsUtils.applyFindManyOptionsOrConditionsToQueryBuilder(qb, options);
189
+ }
190
+ catch (e) {
191
+ // https://github.com/vendure-ecommerce/vendure/issues/1664
192
+ // This is a failsafe to catch edge cases related to the TypeORM
193
+ // bug described in the doc block of `removeCustomFieldsWithEagerRelations`.
194
+ // In this case, a nested custom field relation has an eager-loaded relation,
195
+ // and is throwing an error. In this case we throw our hands up and say
196
+ // "sod it!", refuse to load _any_ relations at all, and rely on the
197
+ // GraphQL entity resolvers to take care of them.
198
+ index_1.Logger.debug(`TransactionalConnection.findOneInChannel ran into issues joining nested custom field relations. Running the query without joining any relations instead.`);
199
+ qb = this.getRepository(ctx, entity).createQueryBuilder('entity');
200
+ typeorm_2.FindOptionsUtils.applyFindManyOptionsOrConditionsToQueryBuilder(qb, Object.assign(Object.assign({}, options), { relations: [], loadEagerRelations: false }));
201
+ skipEagerRelations = true;
202
+ }
203
+ if (options.loadEagerRelations !== false && !skipEagerRelations) {
187
204
  // tslint:disable-next-line:no-non-null-assertion
188
205
  typeorm_2.FindOptionsUtils.joinEagerRelations(qb, qb.alias, qb.expressionMap.mainAlias.metadata);
189
206
  }
@@ -193,55 +210,6 @@ let TransactionalConnection = class TransactionalConnection {
193
210
  .andWhere('channel.id = :channelId', { channelId })
194
211
  .getOne();
195
212
  }
196
- /**
197
- * This is a work-around for this issue: https://github.com/vendure-ecommerce/vendure/issues/1664
198
- *
199
- * Explanation:
200
- * When calling `FindOptionsUtils.joinEagerRelations()`, there appears to be a bug in TypeORM whereby
201
- * it will throw the following error *if* the `options.relations` array contains any customField relations
202
- * where the related entity itself has eagerly-loaded relations.
203
- *
204
- * For example, let's say we define a custom field on the Product entity like this:
205
- * ```
206
- * Product: [{
207
- * name: 'featuredFacet',
208
- * type: 'relation',
209
- * entity: Facet,
210
- * }],
211
- * ```
212
- * and then we pass into `TransactionalConnection.findOneInChannel()` an options array of:
213
- *
214
- * ```
215
- * { relations: ['customFields.featuredFacet'] }
216
- * ```
217
- * it will throw an error because the `Facet` entity itself has eager relations (namely the `translations` property).
218
- * This will cause TypeORM to throw the error:
219
- * ```
220
- * TypeORMError: "entity__customFields" alias was not found. Maybe you forgot to join it?
221
- * ```
222
- *
223
- * So this method introspects the QueryBuilder metadata and checks for any custom field relations which
224
- * themselves have eager relations. If found, it removes those items from the `options.relations` array.
225
- *
226
- * TODO: Ideally create a minimal reproduction case and report in the TypeORM repo for an upstream fix.
227
- */
228
- removeCustomFieldsWithEagerRelations(qb, relations = []) {
229
- let resultingRelations = relations;
230
- const mainAlias = qb.expressionMap.mainAlias;
231
- const customFieldsMetadata = mainAlias === null || mainAlias === void 0 ? void 0 : mainAlias.metadata.embeddeds.find(metadata => metadata.propertyName === 'customFields');
232
- if (customFieldsMetadata) {
233
- const customFieldRelationsWithEagerRelations = customFieldsMetadata.relations.filter(relation => !!relation.inverseEntityMetadata.ownRelations.find(or => or.isEager === true));
234
- for (const relation of customFieldRelationsWithEagerRelations) {
235
- const propertyName = relation.propertyName;
236
- const relationsToRemove = relations.filter(r => r.startsWith(`customFields.${propertyName}`));
237
- if (relationsToRemove.length) {
238
- index_1.Logger.debug(`TransactionalConnection.findOneInChannel cannot automatically join relation [${mainAlias === null || mainAlias === void 0 ? void 0 : mainAlias.metadata.name}.customFields.${propertyName}]`);
239
- resultingRelations = relations.filter(r => !r.startsWith(`customFields.${propertyName}`));
240
- }
241
- }
242
- }
243
- return resultingRelations;
244
- }
245
213
  /**
246
214
  * @description
247
215
  * Like the TypeOrm `Repository.findByIds()` method, but limits the results to
@@ -1 +1 @@
1
- {"version":3,"file":"transactional-connection.js","sourceRoot":"","sources":["../../src/connection/transactional-connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AAEnD,qCAUiB;AAEjB,mEAA+D;AAC/D,mDAA8D;AAC9D,mDAA6D;AAE7D,2CAAyC;AAGzC,+DAA2D;AAG3D;;;;;;;;;;;GAWG;AAEH,IAAa,uBAAuB,GAApC,MAAa,uBAAuB;IAChC,YACgC,UAAsB,EAC1C,kBAAsC;QADlB,eAAU,GAAV,UAAU,CAAY;QAC1C,uBAAkB,GAAlB,kBAAkB,CAAoB;IAC/C,CAAC;IAEJ;;;;;OAKG;IACH,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAmBD,aAAa,CACT,WAA4F,EAC5F,WAAgE;QAEhE,IAAI,WAAW,YAAY,gC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,CAAC,CAAC;SAC3F;QACD,OAAO,EAAE;aACJ,QAAQ,CAAC,iBAAiB,EAAE,SAAS,CAAC;aACtC,QAAQ,CAAC,wBAAwB,EAAE,EAAE,GAAG,EAAE,CAAC;aAC3C,QAAQ,CAAC,yBAAyB,EAAE,EAAE,SAAS,EAAE,CAAC;aAClD,OAAO,EAAE,CAAC;IACnB,CAAC;IAEO,qBAAqB,CAAC,GAAmB;QAC7C,OAAQ,GAAW,CAAC,mCAAuB,CAAC,CAAC;IACjD,CAAC;CACJ,CAAA;AA7UY,uBAAuB;IADnC,mBAAU,EAAE;IAGJ,WAAA,0BAAgB,EAAE,CAAA;qCAAqB,oBAAU;QACtB,wCAAkB;GAHzC,uBAAuB,CA6UnC;AA7UY,0DAAuB"}
1
+ {"version":3,"file":"transactional-connection.js","sourceRoot":"","sources":["../../src/connection/transactional-connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AAEnD,qCASiB;AAEjB,mEAA+D;AAC/D,mDAA8D;AAC9D,mDAA6D;AAE7D,2CAAyC;AAGzC,2GAAmG;AACnG,+DAA2D;AAG3D;;;;;;;;;;;GAWG;AAEH,IAAa,uBAAuB,GAApC,MAAa,uBAAuB;IAChC,YACgC,UAAsB,EAC1C,kBAAsC;QADlB,eAAU,GAAV,UAAU,CAAY;QAC1C,uBAAkB,GAAlB,kBAAkB,CAAoB;IAC/C,CAAC;IAEJ;;;;;OAKG;IACH,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAqBD,aAAa,CACT,WAA4F,EAC5F,WAAgE;QAEhE,IAAI,WAAW,YAAY,gCAAc,EAAE;YACvC,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;YACnE,IAAI,kBAAkB,EAAE;gBACpB,iDAAiD;gBACjD,OAAO,kBAAkB,CAAC,aAAa,CAAC,WAAY,CAAC,CA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