@vendure/core 1.4.7 → 1.5.2

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 (1176) hide show
  1. package/cli/api/common/extract-session-token.d.ts +3 -0
  2. package/cli/api/common/extract-session-token.js +35 -0
  3. package/cli/api/common/extract-session-token.js.map +1 -0
  4. package/cli/api/common/get-api-type.d.ts +3 -0
  5. package/cli/api/common/get-api-type.js +12 -0
  6. package/cli/api/common/get-api-type.js.map +1 -0
  7. package/cli/api/common/graphql-value-transformer.d.ts +30 -0
  8. package/cli/api/common/graphql-value-transformer.js +199 -0
  9. package/cli/api/common/graphql-value-transformer.js.map +1 -0
  10. package/cli/api/common/id-codec.d.ts +11 -0
  11. package/cli/api/common/id-codec.js +94 -0
  12. package/cli/api/common/id-codec.js.map +1 -0
  13. package/cli/api/common/id-codec.service.d.ts +7 -0
  14. package/cli/api/common/id-codec.service.js +33 -0
  15. package/cli/api/common/id-codec.service.js.map +1 -0
  16. package/cli/api/common/parse-context.d.ts +16 -0
  17. package/cli/api/common/parse-context.js +39 -0
  18. package/cli/api/common/parse-context.js.map +1 -0
  19. package/cli/api/common/request-context.d.ts +55 -0
  20. package/cli/api/common/request-context.js +143 -0
  21. package/cli/api/common/request-context.js.map +1 -0
  22. package/cli/api/common/set-session-token.d.ts +9 -0
  23. package/cli/api/common/set-session-token.js +27 -0
  24. package/cli/api/common/set-session-token.js.map +1 -0
  25. package/cli/api/decorators/allow.decorator.d.ts +3 -0
  26. package/cli/api/decorators/allow.decorator.js +8 -0
  27. package/cli/api/decorators/allow.decorator.js.map +1 -0
  28. package/cli/api/decorators/api.decorator.d.ts +1 -0
  29. package/cli/api/decorators/api.decorator.js +10 -0
  30. package/cli/api/decorators/api.decorator.js.map +1 -0
  31. package/cli/api/decorators/request-context.decorator.d.ts +1 -0
  32. package/cli/api/decorators/request-context.decorator.js +14 -0
  33. package/cli/api/decorators/request-context.decorator.js.map +1 -0
  34. package/cli/api/decorators/transaction.decorator.d.ts +3 -0
  35. package/cli/api/decorators/transaction.decorator.js +11 -0
  36. package/cli/api/decorators/transaction.decorator.js.map +1 -0
  37. package/cli/api/index.d.ts +11 -0
  38. package/cli/api/index.js +23 -0
  39. package/cli/api/index.js.map +1 -0
  40. package/cli/api/middleware/auth-guard.d.ts +21 -0
  41. package/cli/api/middleware/auth-guard.js +151 -0
  42. package/cli/api/middleware/auth-guard.js.map +1 -0
  43. package/cli/api/middleware/exception-logger.filter.d.ts +6 -0
  44. package/cli/api/middleware/exception-logger.filter.js +82 -0
  45. package/cli/api/middleware/exception-logger.filter.js.map +1 -0
  46. package/cli/api/middleware/id-interceptor.d.ts +12 -0
  47. package/cli/api/middleware/id-interceptor.js +56 -0
  48. package/cli/api/middleware/id-interceptor.js.map +1 -0
  49. package/cli/api/middleware/transaction-interceptor.d.ts +12 -0
  50. package/cli/api/middleware/transaction-interceptor.js +46 -0
  51. package/cli/api/middleware/transaction-interceptor.js.map +1 -0
  52. package/cli/api/resolvers/admin/search.resolver.d.ts +17 -0
  53. package/cli/api/resolvers/admin/search.resolver.js +81 -0
  54. package/cli/api/resolvers/admin/search.resolver.js.map +1 -0
  55. package/cli/cache/index.d.ts +1 -0
  56. package/cli/cache/index.js +14 -0
  57. package/cli/cache/index.js.map +1 -0
  58. package/cli/cache/request-context-cache.service.d.ts +9 -0
  59. package/cli/cache/request-context-cache.service.js +39 -0
  60. package/cli/cache/request-context-cache.service.js.map +1 -0
  61. package/cli/cli/cli-utils.d.ts +1 -0
  62. package/cli/cli/cli-utils.js +8 -0
  63. package/cli/cli/cli-utils.js.map +1 -0
  64. package/cli/cli/index.d.ts +1 -0
  65. package/cli/cli/index.js +14 -0
  66. package/cli/cli/index.js.map +1 -0
  67. package/cli/cli/populate.d.ts +5 -0
  68. package/cli/cli/populate.js +106 -0
  69. package/cli/cli/populate.js.map +1 -0
  70. package/cli/cli/vendure-cli.d.ts +2 -0
  71. package/cli/cli/vendure-cli.js +119 -0
  72. package/cli/cli/vendure-cli.js.map +1 -0
  73. package/cli/common/async-queue.d.ts +17 -0
  74. package/cli/common/async-queue.js +56 -0
  75. package/cli/common/async-queue.js.map +1 -0
  76. package/cli/common/calculated-decorator.d.ts +12 -0
  77. package/cli/common/calculated-decorator.js +22 -0
  78. package/cli/common/calculated-decorator.js.map +1 -0
  79. package/cli/common/configurable-operation.d.ts +53 -0
  80. package/cli/common/configurable-operation.js +96 -0
  81. package/cli/common/configurable-operation.js.map +1 -0
  82. package/cli/common/constants.d.ts +7 -0
  83. package/cli/common/constants.js +66 -0
  84. package/cli/common/constants.js.map +1 -0
  85. package/cli/common/error/error-result.d.ts +8 -0
  86. package/cli/common/error/error-result.js +11 -0
  87. package/cli/common/error/error-result.js.map +1 -0
  88. package/cli/common/error/errors.d.ts +31 -0
  89. package/cli/common/error/errors.js +48 -0
  90. package/cli/common/error/errors.js.map +1 -0
  91. package/cli/common/error/generated-graphql-admin-errors.d.ts +309 -0
  92. package/cli/common/error/generated-graphql-admin-errors.js +446 -0
  93. package/cli/common/error/generated-graphql-admin-errors.js.map +1 -0
  94. package/cli/common/error/generated-graphql-shop-errors.d.ts +254 -0
  95. package/cli/common/error/generated-graphql-shop-errors.js +370 -0
  96. package/cli/common/error/generated-graphql-shop-errors.js.map +1 -0
  97. package/cli/common/finite-state-machine/finite-state-machine.d.ts +14 -0
  98. package/cli/common/finite-state-machine/finite-state-machine.js +55 -0
  99. package/cli/common/finite-state-machine/finite-state-machine.js.map +1 -0
  100. package/cli/common/finite-state-machine/merge-transition-definitions.d.ts +2 -0
  101. package/cli/common/finite-state-machine/merge-transition-definitions.js +27 -0
  102. package/cli/common/finite-state-machine/merge-transition-definitions.js.map +1 -0
  103. package/cli/common/finite-state-machine/types.d.ts +16 -0
  104. package/cli/common/finite-state-machine/types.js +3 -0
  105. package/cli/common/finite-state-machine/types.js.map +1 -0
  106. package/cli/common/finite-state-machine/validate-transition-definition.d.ts +5 -0
  107. package/cli/common/finite-state-machine/validate-transition-definition.js +41 -0
  108. package/cli/common/finite-state-machine/validate-transition-definition.js.map +1 -0
  109. package/cli/common/generate-public-id.d.ts +1 -0
  110. package/cli/common/generate-public-id.js +10 -0
  111. package/cli/common/generate-public-id.js.map +1 -0
  112. package/cli/common/index.d.ts +15 -0
  113. package/cli/common/index.js +28 -0
  114. package/cli/common/index.js.map +1 -0
  115. package/cli/common/injector.d.ts +8 -0
  116. package/cli/common/injector.js +16 -0
  117. package/cli/common/injector.js.map +1 -0
  118. package/cli/common/permission-definition.d.ts +23 -0
  119. package/cli/common/permission-definition.js +53 -0
  120. package/cli/common/permission-definition.js.map +1 -0
  121. package/cli/common/self-refreshing-cache.d.ts +15 -0
  122. package/cli/common/self-refreshing-cache.js +56 -0
  123. package/cli/common/self-refreshing-cache.js.map +1 -0
  124. package/cli/common/tax-utils.d.ts +4 -0
  125. package/cli/common/tax-utils.js +20 -0
  126. package/cli/common/tax-utils.js.map +1 -0
  127. package/cli/common/ttl-cache.d.ts +13 -0
  128. package/cli/common/ttl-cache.js +48 -0
  129. package/cli/common/ttl-cache.js.map +1 -0
  130. package/cli/common/types/adjustment-source.d.ts +14 -0
  131. package/cli/common/types/adjustment-source.js +18 -0
  132. package/cli/common/types/adjustment-source.js.map +1 -0
  133. package/cli/common/types/common-types.d.ts +97 -0
  134. package/cli/common/types/common-types.js +3 -0
  135. package/cli/common/types/common-types.js.map +1 -0
  136. package/cli/common/types/entity-relation-paths.d.ts +16 -0
  137. package/cli/common/types/entity-relation-paths.js +3 -0
  138. package/cli/common/types/entity-relation-paths.js.map +1 -0
  139. package/cli/common/types/injectable-strategy.d.ts +5 -0
  140. package/cli/common/types/injectable-strategy.js +3 -0
  141. package/cli/common/types/injectable-strategy.js.map +1 -0
  142. package/cli/common/types/locale-types.d.ts +43 -0
  143. package/cli/common/types/locale-types.js +3 -0
  144. package/cli/common/types/locale-types.js.map +1 -0
  145. package/cli/common/utils.d.ts +11 -0
  146. package/cli/common/utils.js +66 -0
  147. package/cli/common/utils.js.map +1 -0
  148. package/cli/config/asset-naming-strategy/asset-naming-strategy.d.ts +6 -0
  149. package/cli/config/asset-naming-strategy/asset-naming-strategy.js +3 -0
  150. package/cli/config/asset-naming-strategy/asset-naming-strategy.js.map +1 -0
  151. package/cli/config/asset-naming-strategy/default-asset-naming-strategy.d.ts +11 -0
  152. package/cli/config/asset-naming-strategy/default-asset-naming-strategy.js +55 -0
  153. package/cli/config/asset-naming-strategy/default-asset-naming-strategy.js.map +1 -0
  154. package/cli/config/asset-preview-strategy/asset-preview-strategy.d.ts +6 -0
  155. package/cli/config/asset-preview-strategy/asset-preview-strategy.js +3 -0
  156. package/cli/config/asset-preview-strategy/asset-preview-strategy.js.map +1 -0
  157. package/cli/config/asset-preview-strategy/no-asset-preview-strategy.d.ts +6 -0
  158. package/cli/config/asset-preview-strategy/no-asset-preview-strategy.js +11 -0
  159. package/cli/config/asset-preview-strategy/no-asset-preview-strategy.js.map +1 -0
  160. package/cli/config/asset-storage-strategy/asset-storage-strategy.d.ts +13 -0
  161. package/cli/config/asset-storage-strategy/asset-storage-strategy.js +3 -0
  162. package/cli/config/asset-storage-strategy/asset-storage-strategy.js.map +1 -0
  163. package/cli/config/asset-storage-strategy/no-asset-storage-strategy.d.ts +13 -0
  164. package/cli/config/asset-storage-strategy/no-asset-storage-strategy.js +30 -0
  165. package/cli/config/asset-storage-strategy/no-asset-storage-strategy.js.map +1 -0
  166. package/cli/config/auth/authentication-strategy.d.ts +10 -0
  167. package/cli/config/auth/authentication-strategy.js +3 -0
  168. package/cli/config/auth/authentication-strategy.js.map +1 -0
  169. package/cli/config/auth/bcrypt-password-hashing-strategy.d.ts +7 -0
  170. package/cli/config/auth/bcrypt-password-hashing-strategy.js +21 -0
  171. package/cli/config/auth/bcrypt-password-hashing-strategy.js.map +1 -0
  172. package/cli/config/auth/default-password-validation-strategy.d.ts +10 -0
  173. package/cli/config/auth/default-password-validation-strategy.js +24 -0
  174. package/cli/config/auth/default-password-validation-strategy.js.map +1 -0
  175. package/cli/config/auth/native-authentication-strategy.d.ts +21 -0
  176. package/cli/config/auth/native-authentication-strategy.js +87 -0
  177. package/cli/config/auth/native-authentication-strategy.js.map +1 -0
  178. package/cli/config/auth/password-hashing-strategy.d.ts +5 -0
  179. package/cli/config/auth/password-hashing-strategy.js +3 -0
  180. package/cli/config/auth/password-hashing-strategy.js.map +1 -0
  181. package/cli/config/auth/password-validation-strategy.d.ts +5 -0
  182. package/cli/config/auth/password-validation-strategy.js +3 -0
  183. package/cli/config/auth/password-validation-strategy.js.map +1 -0
  184. package/cli/config/catalog/collection-filter.d.ts +13 -0
  185. package/cli/config/catalog/collection-filter.js +15 -0
  186. package/cli/config/catalog/collection-filter.js.map +1 -0
  187. package/cli/config/catalog/default-collection-filters.d.ts +52 -0
  188. package/cli/config/catalog/default-collection-filters.js +112 -0
  189. package/cli/config/catalog/default-collection-filters.js.map +1 -0
  190. package/cli/config/catalog/default-product-variant-price-calculation-strategy.d.ts +8 -0
  191. package/cli/config/catalog/default-product-variant-price-calculation-strategy.js +31 -0
  192. package/cli/config/catalog/default-product-variant-price-calculation-strategy.js.map +1 -0
  193. package/cli/config/catalog/default-stock-display-strategy.d.ts +8 -0
  194. package/cli/config/catalog/default-stock-display-strategy.js +17 -0
  195. package/cli/config/catalog/default-stock-display-strategy.js.map +1 -0
  196. package/cli/config/catalog/product-variant-price-calculation-strategy.d.ts +13 -0
  197. package/cli/config/catalog/product-variant-price-calculation-strategy.js +3 -0
  198. package/cli/config/catalog/product-variant-price-calculation-strategy.js.map +1 -0
  199. package/cli/config/catalog/stock-display-strategy.d.ts +6 -0
  200. package/cli/config/catalog/stock-display-strategy.js +3 -0
  201. package/cli/config/catalog/stock-display-strategy.js.map +1 -0
  202. package/cli/config/config-helpers.d.ts +3 -0
  203. package/cli/config/config-helpers.js +15 -0
  204. package/cli/config/config-helpers.js.map +1 -0
  205. package/cli/config/config.module.d.ts +16 -0
  206. package/cli/config/config.module.js +120 -0
  207. package/cli/config/config.module.js.map +1 -0
  208. package/cli/config/config.service.d.ts +30 -0
  209. package/cli/config/config.service.js +86 -0
  210. package/cli/config/config.service.js.map +1 -0
  211. package/cli/config/custom-field/custom-field-types.d.ts +65 -0
  212. package/cli/config/custom-field/custom-field-types.js +3 -0
  213. package/cli/config/custom-field/custom-field-types.js.map +1 -0
  214. package/cli/config/default-config.d.ts +2 -0
  215. package/cli/config/default-config.js +174 -0
  216. package/cli/config/default-config.js.map +1 -0
  217. package/cli/config/entity-id-strategy/auto-increment-id-strategy.d.ts +6 -0
  218. package/cli/config/entity-id-strategy/auto-increment-id-strategy.js +17 -0
  219. package/cli/config/entity-id-strategy/auto-increment-id-strategy.js.map +1 -0
  220. package/cli/config/entity-id-strategy/entity-id-strategy.d.ts +7 -0
  221. package/cli/config/entity-id-strategy/entity-id-strategy.js +3 -0
  222. package/cli/config/entity-id-strategy/entity-id-strategy.js.map +1 -0
  223. package/cli/config/entity-id-strategy/uuid-id-strategy.d.ts +6 -0
  224. package/cli/config/entity-id-strategy/uuid-id-strategy.js +16 -0
  225. package/cli/config/entity-id-strategy/uuid-id-strategy.js.map +1 -0
  226. package/cli/config/fulfillment/custom-fulfillment-process.d.ts +9 -0
  227. package/cli/config/fulfillment/custom-fulfillment-process.js +3 -0
  228. package/cli/config/fulfillment/custom-fulfillment-process.js.map +1 -0
  229. package/cli/config/fulfillment/fulfillment-handler.d.ts +21 -0
  230. package/cli/config/fulfillment/fulfillment-handler.js +23 -0
  231. package/cli/config/fulfillment/fulfillment-handler.js.map +1 -0
  232. package/cli/config/fulfillment/manual-fulfillment-handler.d.ts +11 -0
  233. package/cli/config/fulfillment/manual-fulfillment-handler.js +26 -0
  234. package/cli/config/fulfillment/manual-fulfillment-handler.js.map +1 -0
  235. package/cli/config/index.d.ts +61 -0
  236. package/cli/config/index.js +74 -0
  237. package/cli/config/index.js.map +1 -0
  238. package/cli/config/job-queue/inspectable-job-queue-strategy.d.ts +12 -0
  239. package/cli/config/job-queue/inspectable-job-queue-strategy.js +11 -0
  240. package/cli/config/job-queue/inspectable-job-queue-strategy.js.map +1 -0
  241. package/cli/config/job-queue/job-queue-strategy.d.ts +8 -0
  242. package/cli/config/job-queue/job-queue-strategy.js +3 -0
  243. package/cli/config/job-queue/job-queue-strategy.js.map +1 -0
  244. package/cli/config/logger/default-logger.d.ts +24 -0
  245. package/cli/config/logger/default-logger.js +90 -0
  246. package/cli/config/logger/default-logger.js.map +1 -0
  247. package/cli/config/logger/noop-logger.d.ts +8 -0
  248. package/cli/config/logger/noop-logger.js +17 -0
  249. package/cli/config/logger/noop-logger.js.map +1 -0
  250. package/cli/config/logger/typeorm-logger.d.ts +15 -0
  251. package/cli/config/logger/typeorm-logger.js +74 -0
  252. package/cli/config/logger/typeorm-logger.js.map +1 -0
  253. package/cli/config/logger/vendure-logger.d.ts +32 -0
  254. package/cli/config/logger/vendure-logger.js +68 -0
  255. package/cli/config/logger/vendure-logger.js.map +1 -0
  256. package/cli/config/merge-config.d.ts +2 -0
  257. package/cli/config/merge-config.js +34 -0
  258. package/cli/config/merge-config.js.map +1 -0
  259. package/cli/config/order/changed-price-handling-strategy.d.ts +7 -0
  260. package/cli/config/order/changed-price-handling-strategy.js +3 -0
  261. package/cli/config/order/changed-price-handling-strategy.js.map +1 -0
  262. package/cli/config/order/custom-order-process.d.ts +9 -0
  263. package/cli/config/order/custom-order-process.js +3 -0
  264. package/cli/config/order/custom-order-process.js.map +1 -0
  265. package/cli/config/order/default-changed-price-handling-strategy.d.ts +6 -0
  266. package/cli/config/order/default-changed-price-handling-strategy.js +10 -0
  267. package/cli/config/order/default-changed-price-handling-strategy.js.map +1 -0
  268. package/cli/config/order/default-order-item-price-calculation-strategy.d.ts +7 -0
  269. package/cli/config/order/default-order-item-price-calculation-strategy.js +13 -0
  270. package/cli/config/order/default-order-item-price-calculation-strategy.js.map +1 -0
  271. package/cli/config/order/default-order-placed-strategy.d.ts +7 -0
  272. package/cli/config/order/default-order-placed-strategy.js +13 -0
  273. package/cli/config/order/default-order-placed-strategy.js.map +1 -0
  274. package/cli/config/order/default-stock-allocation-strategy.d.ts +7 -0
  275. package/cli/config/order/default-stock-allocation-strategy.js +11 -0
  276. package/cli/config/order/default-stock-allocation-strategy.js.map +1 -0
  277. package/cli/config/order/merge-orders-strategy.d.ts +7 -0
  278. package/cli/config/order/merge-orders-strategy.js +29 -0
  279. package/cli/config/order/merge-orders-strategy.js.map +1 -0
  280. package/cli/config/order/order-by-code-access-strategy.d.ts +11 -0
  281. package/cli/config/order/order-by-code-access-strategy.js +25 -0
  282. package/cli/config/order/order-by-code-access-strategy.js.map +1 -0
  283. package/cli/config/order/order-code-strategy.d.ts +8 -0
  284. package/cli/config/order/order-code-strategy.js +11 -0
  285. package/cli/config/order/order-code-strategy.js.map +1 -0
  286. package/cli/config/order/order-item-price-calculation-strategy.d.ts +9 -0
  287. package/cli/config/order/order-item-price-calculation-strategy.js +3 -0
  288. package/cli/config/order/order-item-price-calculation-strategy.js.map +1 -0
  289. package/cli/config/order/order-merge-strategy.d.ts +14 -0
  290. package/cli/config/order/order-merge-strategy.js +12 -0
  291. package/cli/config/order/order-merge-strategy.js.map +1 -0
  292. package/cli/config/order/order-placed-strategy.d.ts +7 -0
  293. package/cli/config/order/order-placed-strategy.js +3 -0
  294. package/cli/config/order/order-placed-strategy.js.map +1 -0
  295. package/cli/config/order/stock-allocation-strategy.d.ts +7 -0
  296. package/cli/config/order/stock-allocation-strategy.js +3 -0
  297. package/cli/config/order/stock-allocation-strategy.js.map +1 -0
  298. package/cli/config/order/use-existing-strategy.d.ts +6 -0
  299. package/cli/config/order/use-existing-strategy.js +11 -0
  300. package/cli/config/order/use-existing-strategy.js.map +1 -0
  301. package/cli/config/order/use-guest-if-existing-empty-strategy.d.ts +6 -0
  302. package/cli/config/order/use-guest-if-existing-empty-strategy.js +13 -0
  303. package/cli/config/order/use-guest-if-existing-empty-strategy.js.map +1 -0
  304. package/cli/config/order/use-guest-strategy.d.ts +6 -0
  305. package/cli/config/order/use-guest-strategy.js +11 -0
  306. package/cli/config/order/use-guest-strategy.js.map +1 -0
  307. package/cli/config/payment/custom-payment-process.d.ts +9 -0
  308. package/cli/config/payment/custom-payment-process.js +3 -0
  309. package/cli/config/payment/custom-payment-process.js.map +1 -0
  310. package/cli/config/payment/dummy-payment-method-handler.d.ts +17 -0
  311. package/cli/config/payment/dummy-payment-method-handler.js +74 -0
  312. package/cli/config/payment/dummy-payment-method-handler.js.map +1 -0
  313. package/cli/config/payment/example-payment-method-handler.d.ts +11 -0
  314. package/cli/config/payment/example-payment-method-handler.js +59 -0
  315. package/cli/config/payment/example-payment-method-handler.js.map +1 -0
  316. package/cli/config/payment/payment-method-eligibility-checker.d.ts +13 -0
  317. package/cli/config/payment/payment-method-eligibility-checker.js +15 -0
  318. package/cli/config/payment/payment-method-eligibility-checker.js.map +1 -0
  319. package/cli/config/payment/payment-method-handler.d.ts +73 -0
  320. package/cli/config/payment/payment-method-handler.js +36 -0
  321. package/cli/config/payment/payment-method-handler.js.map +1 -0
  322. package/cli/config/promotion/actions/buy-x-get-y-free-action.d.ts +37 -0
  323. package/cli/config/promotion/actions/buy-x-get-y-free-action.js +30 -0
  324. package/cli/config/promotion/actions/buy-x-get-y-free-action.js.map +1 -0
  325. package/cli/config/promotion/actions/facet-values-percentage-discount-action.d.ts +17 -0
  326. package/cli/config/promotion/actions/facet-values-percentage-discount-action.js +39 -0
  327. package/cli/config/promotion/actions/facet-values-percentage-discount-action.js.map +1 -0
  328. package/cli/config/promotion/actions/free-shipping-action.d.ts +2 -0
  329. package/cli/config/promotion/actions/free-shipping-action.js +14 -0
  330. package/cli/config/promotion/actions/free-shipping-action.js.map +1 -0
  331. package/cli/config/promotion/actions/order-fixed-discount-action.d.ts +9 -0
  332. package/cli/config/promotion/actions/order-fixed-discount-action.js +21 -0
  333. package/cli/config/promotion/actions/order-fixed-discount-action.js.map +1 -0
  334. package/cli/config/promotion/actions/order-percentage-discount-action.d.ts +10 -0
  335. package/cli/config/promotion/actions/order-percentage-discount-action.js +23 -0
  336. package/cli/config/promotion/actions/order-percentage-discount-action.js.map +1 -0
  337. package/cli/config/promotion/actions/product-percentage-discount-action.d.ts +22 -0
  338. package/cli/config/promotion/actions/product-percentage-discount-action.js +36 -0
  339. package/cli/config/promotion/actions/product-percentage-discount-action.js.map +1 -0
  340. package/cli/config/promotion/conditions/buy-x-get-y-free-condition.d.ts +37 -0
  341. package/cli/config/promotion/conditions/buy-x-get-y-free-condition.js +71 -0
  342. package/cli/config/promotion/conditions/buy-x-get-y-free-condition.js.map +1 -0
  343. package/cli/config/promotion/conditions/contains-products-condition.d.ts +19 -0
  344. package/cli/config/promotion/conditions/contains-products-condition.js +38 -0
  345. package/cli/config/promotion/conditions/contains-products-condition.js.map +1 -0
  346. package/cli/config/promotion/conditions/customer-group-condition.d.ts +14 -0
  347. package/cli/config/promotion/conditions/customer-group-condition.js +72 -0
  348. package/cli/config/promotion/conditions/customer-group-condition.js.map +1 -0
  349. package/cli/config/promotion/conditions/has-facet-values-condition.d.ts +14 -0
  350. package/cli/config/promotion/conditions/has-facet-values-condition.js +31 -0
  351. package/cli/config/promotion/conditions/has-facet-values-condition.js.map +1 -0
  352. package/cli/config/promotion/conditions/min-order-amount-condition.d.ts +14 -0
  353. package/cli/config/promotion/conditions/min-order-amount-condition.js +27 -0
  354. package/cli/config/promotion/conditions/min-order-amount-condition.js.map +1 -0
  355. package/cli/config/promotion/index.d.ts +170 -0
  356. package/cli/config/promotion/index.js +50 -0
  357. package/cli/config/promotion/index.js.map +1 -0
  358. package/cli/config/promotion/promotion-action.d.ts +56 -0
  359. package/cli/config/promotion/promotion-action.js +49 -0
  360. package/cli/config/promotion/promotion-action.js.map +1 -0
  361. package/cli/config/promotion/promotion-condition.d.ts +19 -0
  362. package/cli/config/promotion/promotion-condition.js +19 -0
  363. package/cli/config/promotion/promotion-condition.js.map +1 -0
  364. package/cli/config/promotion/utils/facet-value-checker.d.ts +9 -0
  365. package/cli/config/promotion/utils/facet-value-checker.js +31 -0
  366. package/cli/config/promotion/utils/facet-value-checker.js.map +1 -0
  367. package/cli/config/session-cache/in-memory-session-cache-strategy.d.ts +11 -0
  368. package/cli/config/session-cache/in-memory-session-cache-strategy.js +44 -0
  369. package/cli/config/session-cache/in-memory-session-cache-strategy.js.map +1 -0
  370. package/cli/config/session-cache/noop-session-cache-strategy.d.ts +7 -0
  371. package/cli/config/session-cache/noop-session-cache-strategy.js +19 -0
  372. package/cli/config/session-cache/noop-session-cache-strategy.js.map +1 -0
  373. package/cli/config/session-cache/session-cache-strategy.d.ts +25 -0
  374. package/cli/config/session-cache/session-cache-strategy.js +3 -0
  375. package/cli/config/session-cache/session-cache-strategy.js.map +1 -0
  376. package/cli/config/shipping-method/default-shipping-calculator.d.ts +51 -0
  377. package/cli/config/shipping-method/default-shipping-calculator.js +69 -0
  378. package/cli/config/shipping-method/default-shipping-calculator.js.map +1 -0
  379. package/cli/config/shipping-method/default-shipping-eligibility-checker.d.ts +19 -0
  380. package/cli/config/shipping-method/default-shipping-eligibility-checker.js +27 -0
  381. package/cli/config/shipping-method/default-shipping-eligibility-checker.js.map +1 -0
  382. package/cli/config/shipping-method/shipping-calculator.d.ts +20 -0
  383. package/cli/config/shipping-method/shipping-calculator.js +15 -0
  384. package/cli/config/shipping-method/shipping-calculator.js.map +1 -0
  385. package/cli/config/shipping-method/shipping-eligibility-checker.d.ts +19 -0
  386. package/cli/config/shipping-method/shipping-eligibility-checker.js +38 -0
  387. package/cli/config/shipping-method/shipping-eligibility-checker.js.map +1 -0
  388. package/cli/config/tax/default-tax-line-calculation-strategy.d.ts +5 -0
  389. package/cli/config/tax/default-tax-line-calculation-strategy.js +11 -0
  390. package/cli/config/tax/default-tax-line-calculation-strategy.js.map +1 -0
  391. package/cli/config/tax/default-tax-zone-strategy.d.ts +6 -0
  392. package/cli/config/tax/default-tax-zone-strategy.js +10 -0
  393. package/cli/config/tax/default-tax-zone-strategy.js.map +1 -0
  394. package/cli/config/tax/tax-line-calculation-strategy.d.ts +17 -0
  395. package/cli/config/tax/tax-line-calculation-strategy.js +3 -0
  396. package/cli/config/tax/tax-line-calculation-strategy.js.map +1 -0
  397. package/cli/config/tax/tax-zone-strategy.d.ts +6 -0
  398. package/cli/config/tax/tax-zone-strategy.js +3 -0
  399. package/cli/config/tax/tax-zone-strategy.js.map +1 -0
  400. package/cli/config/vendure-config.d.ts +192 -0
  401. package/cli/config/vendure-config.js +3 -0
  402. package/cli/config/vendure-config.js.map +1 -0
  403. package/cli/connection/connection.module.d.ts +7 -0
  404. package/cli/connection/connection.module.js +61 -0
  405. package/cli/connection/connection.module.js.map +1 -0
  406. package/cli/connection/transaction-subscriber.d.ts +19 -0
  407. package/cli/connection/transaction-subscriber.js +54 -0
  408. package/cli/connection/transaction-subscriber.js.map +1 -0
  409. package/cli/connection/transaction-wrapper.d.ts +9 -0
  410. package/cli/connection/transaction-wrapper.js +79 -0
  411. package/cli/connection/transaction-wrapper.js.map +1 -0
  412. package/cli/connection/transactional-connection.d.ts +25 -0
  413. package/cli/connection/transactional-connection.js +170 -0
  414. package/cli/connection/transactional-connection.js.map +1 -0
  415. package/cli/connection/types.d.ts +8 -0
  416. package/cli/connection/types.js +3 -0
  417. package/cli/connection/types.js.map +1 -0
  418. package/cli/entity/address/address.entity.d.ts +22 -0
  419. package/cli/entity/address/address.entity.js +80 -0
  420. package/cli/entity/address/address.entity.js.map +1 -0
  421. package/cli/entity/administrator/administrator.entity.d.ts +15 -0
  422. package/cli/entity/administrator/administrator.entity.js +52 -0
  423. package/cli/entity/administrator/administrator.entity.js.map +1 -0
  424. package/cli/entity/asset/asset.entity.d.ts +26 -0
  425. package/cli/entity/asset/asset.entity.js +79 -0
  426. package/cli/entity/asset/asset.entity.js.map +1 -0
  427. package/cli/entity/asset/orderable-asset.entity.d.ts +10 -0
  428. package/cli/entity/asset/orderable-asset.entity.js +34 -0
  429. package/cli/entity/asset/orderable-asset.entity.js.map +1 -0
  430. package/cli/entity/authentication-method/authentication-method.entity.d.ts +5 -0
  431. package/cli/entity/authentication-method/authentication-method.entity.js +27 -0
  432. package/cli/entity/authentication-method/authentication-method.entity.js.map +1 -0
  433. package/cli/entity/authentication-method/external-authentication-method.entity.d.ts +8 -0
  434. package/cli/entity/authentication-method/external-authentication-method.entity.js +37 -0
  435. package/cli/entity/authentication-method/external-authentication-method.entity.js.map +1 -0
  436. package/cli/entity/authentication-method/native-authentication-method.entity.d.ts +11 -0
  437. package/cli/entity/authentication-method/native-authentication-method.entity.js +49 -0
  438. package/cli/entity/authentication-method/native-authentication-method.entity.js.map +1 -0
  439. package/cli/entity/base/base.entity.d.ts +7 -0
  440. package/cli/entity/base/base.entity.js +37 -0
  441. package/cli/entity/base/base.entity.js.map +1 -0
  442. package/cli/entity/channel/channel.entity.d.ts +17 -0
  443. package/cli/entity/channel/channel.entity.js +67 -0
  444. package/cli/entity/channel/channel.entity.js.map +1 -0
  445. package/cli/entity/collection/collection-asset.entity.d.ts +8 -0
  446. package/cli/entity/collection/collection-asset.entity.js +34 -0
  447. package/cli/entity/collection/collection-asset.entity.js.map +1 -0
  448. package/cli/entity/collection/collection-translation.entity.d.ts +16 -0
  449. package/cli/entity/collection/collection-translation.entity.js +52 -0
  450. package/cli/entity/collection/collection-translation.entity.js.map +1 -0
  451. package/cli/entity/collection/collection.entity.d.ts +29 -0
  452. package/cli/entity/collection/collection.entity.js +81 -0
  453. package/cli/entity/collection/collection.entity.js.map +1 -0
  454. package/cli/entity/country/country-translation.entity.d.ts +14 -0
  455. package/cli/entity/country/country-translation.entity.js +44 -0
  456. package/cli/entity/country/country-translation.entity.js.map +1 -0
  457. package/cli/entity/country/country.entity.d.ts +13 -0
  458. package/cli/entity/country/country.entity.js +43 -0
  459. package/cli/entity/country/country.entity.js.map +1 -0
  460. package/cli/entity/custom-entity-fields.d.ts +68 -0
  461. package/cli/entity/custom-entity-fields.js +106 -0
  462. package/cli/entity/custom-entity-fields.js.map +1 -0
  463. package/cli/entity/customer/customer.entity.d.ts +25 -0
  464. package/cli/entity/customer/customer.entity.js +82 -0
  465. package/cli/entity/customer/customer.entity.js.map +1 -0
  466. package/cli/entity/customer-group/customer-group.entity.d.ts +11 -0
  467. package/cli/entity/customer-group/customer-group.entity.js +39 -0
  468. package/cli/entity/customer-group/customer-group.entity.js.map +1 -0
  469. package/cli/entity/entities.d.ts +124 -0
  470. package/cli/entity/entities.js +128 -0
  471. package/cli/entity/entities.js.map +1 -0
  472. package/cli/entity/entity-id.decorator.d.ts +18 -0
  473. package/cli/entity/entity-id.decorator.js +40 -0
  474. package/cli/entity/entity-id.decorator.js.map +1 -0
  475. package/cli/entity/facet/facet-translation.entity.d.ts +14 -0
  476. package/cli/entity/facet/facet-translation.entity.js +44 -0
  477. package/cli/entity/facet/facet-translation.entity.js.map +1 -0
  478. package/cli/entity/facet/facet.entity.d.ts +18 -0
  479. package/cli/entity/facet/facet.entity.js +54 -0
  480. package/cli/entity/facet/facet.entity.js.map +1 -0
  481. package/cli/entity/facet-value/facet-value-translation.entity.d.ts +13 -0
  482. package/cli/entity/facet-value/facet-value-translation.entity.js +44 -0
  483. package/cli/entity/facet-value/facet-value-translation.entity.js.map +1 -0
  484. package/cli/entity/facet-value/facet-value.entity.d.ts +17 -0
  485. package/cli/entity/facet-value/facet-value.entity.js +50 -0
  486. package/cli/entity/facet-value/facet-value.entity.js.map +1 -0
  487. package/cli/entity/fulfillment/fulfillment.entity.d.ts +15 -0
  488. package/cli/entity/fulfillment/fulfillment.entity.js +51 -0
  489. package/cli/entity/fulfillment/fulfillment.entity.js.map +1 -0
  490. package/cli/entity/global-settings/global-settings.entity.d.ts +12 -0
  491. package/cli/entity/global-settings/global-settings.entity.js +42 -0
  492. package/cli/entity/global-settings/global-settings.entity.js.map +1 -0
  493. package/cli/entity/history-entry/customer-history-entry.entity.d.ts +7 -0
  494. package/cli/entity/history-entry/customer-history-entry.entity.js +30 -0
  495. package/cli/entity/history-entry/customer-history-entry.entity.js.map +1 -0
  496. package/cli/entity/history-entry/history-entry.entity.d.ts +9 -0
  497. package/cli/entity/history-entry/history-entry.entity.js +40 -0
  498. package/cli/entity/history-entry/history-entry.entity.js.map +1 -0
  499. package/cli/entity/history-entry/order-history-entry.entity.d.ts +7 -0
  500. package/cli/entity/history-entry/order-history-entry.entity.js +30 -0
  501. package/cli/entity/history-entry/order-history-entry.entity.js.map +1 -0
  502. package/cli/entity/index.d.ts +52 -0
  503. package/cli/entity/index.js +65 -0
  504. package/cli/entity/index.js.map +1 -0
  505. package/cli/entity/order/order.entity.d.ts +48 -0
  506. package/cli/entity/order/order.entity.js +277 -0
  507. package/cli/entity/order/order.entity.js.map +1 -0
  508. package/cli/entity/order-item/order-item.entity.d.ts +35 -0
  509. package/cli/entity/order-item/order-item.entity.js +182 -0
  510. package/cli/entity/order-item/order-item.entity.js.map +1 -0
  511. package/cli/entity/order-line/order-line.entity.d.ts +44 -0
  512. package/cli/entity/order-line/order-line.entity.js +275 -0
  513. package/cli/entity/order-line/order-line.entity.js.map +1 -0
  514. package/cli/entity/order-modification/order-modification.entity.d.ts +21 -0
  515. package/cli/entity/order-modification/order-modification.entity.js +81 -0
  516. package/cli/entity/order-modification/order-modification.entity.js.map +1 -0
  517. package/cli/entity/payment/payment.entity.d.ts +17 -0
  518. package/cli/entity/payment/payment.entity.js +59 -0
  519. package/cli/entity/payment/payment.entity.js.map +1 -0
  520. package/cli/entity/payment-method/payment-method.entity.d.ts +18 -0
  521. package/cli/entity/payment-method/payment-method.entity.js +60 -0
  522. package/cli/entity/payment-method/payment-method.entity.js.map +1 -0
  523. package/cli/entity/product/product-asset.entity.d.ts +8 -0
  524. package/cli/entity/product/product-asset.entity.js +34 -0
  525. package/cli/entity/product/product-asset.entity.js.map +1 -0
  526. package/cli/entity/product/product-translation.entity.d.ts +16 -0
  527. package/cli/entity/product/product-translation.entity.js +52 -0
  528. package/cli/entity/product/product-translation.entity.js.map +1 -0
  529. package/cli/entity/product/product.entity.d.ts +28 -0
  530. package/cli/entity/product/product.entity.js +75 -0
  531. package/cli/entity/product/product.entity.js.map +1 -0
  532. package/cli/entity/product-option/product-option-translation.entity.d.ts +14 -0
  533. package/cli/entity/product-option/product-option-translation.entity.js +44 -0
  534. package/cli/entity/product-option/product-option-translation.entity.js.map +1 -0
  535. package/cli/entity/product-option/product-option.entity.d.ts +17 -0
  536. package/cli/entity/product-option/product-option.entity.js +53 -0
  537. package/cli/entity/product-option/product-option.entity.js.map +1 -0
  538. package/cli/entity/product-option-group/product-option-group-translation.entity.d.ts +14 -0
  539. package/cli/entity/product-option-group/product-option-group-translation.entity.js +44 -0
  540. package/cli/entity/product-option-group/product-option-group-translation.entity.js.map +1 -0
  541. package/cli/entity/product-option-group/product-option-group.entity.d.ts +18 -0
  542. package/cli/entity/product-option-group/product-option-group.entity.js +53 -0
  543. package/cli/entity/product-option-group/product-option-group.entity.js.map +1 -0
  544. package/cli/entity/product-variant/product-variant-asset.entity.d.ts +8 -0
  545. package/cli/entity/product-variant/product-variant-asset.entity.js +34 -0
  546. package/cli/entity/product-variant/product-variant-asset.entity.js.map +1 -0
  547. package/cli/entity/product-variant/product-variant-price.entity.d.ts +9 -0
  548. package/cli/entity/product-variant/product-variant-price.entity.js +39 -0
  549. package/cli/entity/product-variant/product-variant-price.entity.js.map +1 -0
  550. package/cli/entity/product-variant/product-variant-translation.entity.d.ts +14 -0
  551. package/cli/entity/product-variant/product-variant-translation.entity.js +44 -0
  552. package/cli/entity/product-variant/product-variant-translation.entity.js.map +1 -0
  553. package/cli/entity/product-variant/product-variant.entity.d.ts +49 -0
  554. package/cli/entity/product-variant/product-variant.entity.js +155 -0
  555. package/cli/entity/product-variant/product-variant.entity.js.map +1 -0
  556. package/cli/entity/promotion/promotion.entity.d.ts +56 -0
  557. package/cli/entity/promotion/promotion.entity.js +157 -0
  558. package/cli/entity/promotion/promotion.entity.js.map +1 -0
  559. package/cli/entity/refund/refund.entity.d.ts +21 -0
  560. package/cli/entity/refund/refund.entity.js +78 -0
  561. package/cli/entity/refund/refund.entity.js.map +1 -0
  562. package/cli/entity/role/role.entity.d.ts +12 -0
  563. package/cli/entity/role/role.entity.js +43 -0
  564. package/cli/entity/role/role.entity.js.map +1 -0
  565. package/cli/entity/session/anonymous-session.entity.d.ts +5 -0
  566. package/cli/entity/session/anonymous-session.entity.js +25 -0
  567. package/cli/entity/session/anonymous-session.entity.js.map +1 -0
  568. package/cli/entity/session/authenticated-session.entity.d.ts +8 -0
  569. package/cli/entity/session/authenticated-session.entity.js +34 -0
  570. package/cli/entity/session/authenticated-session.entity.js.map +1 -0
  571. package/cli/entity/session/session.entity.d.ts +13 -0
  572. package/cli/entity/session/session.entity.js +54 -0
  573. package/cli/entity/session/session.entity.js.map +1 -0
  574. package/cli/entity/shipping-line/shipping-line.entity.d.ts +24 -0
  575. package/cli/entity/shipping-line/shipping-line.entity.js +128 -0
  576. package/cli/entity/shipping-line/shipping-line.entity.js.map +1 -0
  577. package/cli/entity/shipping-method/shipping-method-translation.entity.d.ts +16 -0
  578. package/cli/entity/shipping-method/shipping-method-translation.entity.js +48 -0
  579. package/cli/entity/shipping-method/shipping-method-translation.entity.js.map +1 -0
  580. package/cli/entity/shipping-method/shipping-method.entity.d.ts +28 -0
  581. package/cli/entity/shipping-method/shipping-method.entity.js +92 -0
  582. package/cli/entity/shipping-method/shipping-method.entity.js.map +1 -0
  583. package/cli/entity/stock-movement/allocation.entity.d.ts +9 -0
  584. package/cli/entity/stock-movement/allocation.entity.js +32 -0
  585. package/cli/entity/stock-movement/allocation.entity.js.map +1 -0
  586. package/cli/entity/stock-movement/cancellation.entity.d.ts +9 -0
  587. package/cli/entity/stock-movement/cancellation.entity.js +32 -0
  588. package/cli/entity/stock-movement/cancellation.entity.js.map +1 -0
  589. package/cli/entity/stock-movement/release.entity.d.ts +9 -0
  590. package/cli/entity/stock-movement/release.entity.js +32 -0
  591. package/cli/entity/stock-movement/release.entity.js.map +1 -0
  592. package/cli/entity/stock-movement/sale.entity.d.ts +9 -0
  593. package/cli/entity/stock-movement/sale.entity.js +32 -0
  594. package/cli/entity/stock-movement/sale.entity.js.map +1 -0
  595. package/cli/entity/stock-movement/stock-adjustment.entity.d.ts +7 -0
  596. package/cli/entity/stock-movement/stock-adjustment.entity.js +27 -0
  597. package/cli/entity/stock-movement/stock-adjustment.entity.js.map +1 -0
  598. package/cli/entity/stock-movement/stock-movement.entity.d.ts +8 -0
  599. package/cli/entity/stock-movement/stock-movement.entity.js +36 -0
  600. package/cli/entity/stock-movement/stock-movement.entity.js.map +1 -0
  601. package/cli/entity/surcharge/surcharge.entity.d.ts +18 -0
  602. package/cli/entity/surcharge/surcharge.entity.js +82 -0
  603. package/cli/entity/surcharge/surcharge.entity.js.map +1 -0
  604. package/cli/entity/tag/tag.entity.d.ts +6 -0
  605. package/cli/entity/tag/tag.entity.js +29 -0
  606. package/cli/entity/tag/tag.entity.js.map +1 -0
  607. package/cli/entity/tax-category/tax-category.entity.d.ts +10 -0
  608. package/cli/entity/tax-category/tax-category.entity.js +38 -0
  609. package/cli/entity/tax-category/tax-category.entity.js.map +1 -0
  610. package/cli/entity/tax-rate/tax-rate.entity.d.ts +24 -0
  611. package/cli/entity/tax-rate/tax-rate.entity.js +81 -0
  612. package/cli/entity/tax-rate/tax-rate.entity.js.map +1 -0
  613. package/cli/entity/user/user.entity.d.ts +19 -0
  614. package/cli/entity/user/user.entity.js +69 -0
  615. package/cli/entity/user/user.entity.js.map +1 -0
  616. package/cli/entity/value-transformers.d.ts +5 -0
  617. package/cli/entity/value-transformers.js +13 -0
  618. package/cli/entity/value-transformers.js.map +1 -0
  619. package/cli/entity/zone/zone.entity.d.ts +11 -0
  620. package/cli/entity/zone/zone.entity.js +40 -0
  621. package/cli/entity/zone/zone.entity.js.map +1 -0
  622. package/cli/event-bus/event-bus.d.ts +15 -0
  623. package/cli/event-bus/event-bus.js +51 -0
  624. package/cli/event-bus/event-bus.js.map +1 -0
  625. package/cli/event-bus/event-bus.module.d.ts +2 -0
  626. package/cli/event-bus/event-bus.module.js +23 -0
  627. package/cli/event-bus/event-bus.module.js.map +1 -0
  628. package/cli/event-bus/events/account-registration-event.d.ts +8 -0
  629. package/cli/event-bus/events/account-registration-event.js +13 -0
  630. package/cli/event-bus/events/account-registration-event.js.map +1 -0
  631. package/cli/event-bus/events/account-verified-event.d.ts +8 -0
  632. package/cli/event-bus/events/account-verified-event.js +13 -0
  633. package/cli/event-bus/events/account-verified-event.js.map +1 -0
  634. package/cli/event-bus/events/administrator-event.d.ts +10 -0
  635. package/cli/event-bus/events/administrator-event.js +11 -0
  636. package/cli/event-bus/events/administrator-event.js.map +1 -0
  637. package/cli/event-bus/events/asset-channel-event.d.ts +11 -0
  638. package/cli/event-bus/events/asset-channel-event.js +15 -0
  639. package/cli/event-bus/events/asset-channel-event.js.map +1 -0
  640. package/cli/event-bus/events/asset-event.d.ts +11 -0
  641. package/cli/event-bus/events/asset-event.js +14 -0
  642. package/cli/event-bus/events/asset-event.js.map +1 -0
  643. package/cli/event-bus/events/attempted-login-event.d.ts +8 -0
  644. package/cli/event-bus/events/attempted-login-event.js +14 -0
  645. package/cli/event-bus/events/attempted-login-event.js.map +1 -0
  646. package/cli/event-bus/events/change-channel-event.d.ts +13 -0
  647. package/cli/event-bus/events/change-channel-event.js +16 -0
  648. package/cli/event-bus/events/change-channel-event.js.map +1 -0
  649. package/cli/event-bus/events/channel-event.d.ts +10 -0
  650. package/cli/event-bus/events/channel-event.js +11 -0
  651. package/cli/event-bus/events/channel-event.js.map +1 -0
  652. package/cli/event-bus/events/collection-event.d.ts +10 -0
  653. package/cli/event-bus/events/collection-event.js +11 -0
  654. package/cli/event-bus/events/collection-event.js.map +1 -0
  655. package/cli/event-bus/events/collection-modification-event.d.ts +10 -0
  656. package/cli/event-bus/events/collection-modification-event.js +14 -0
  657. package/cli/event-bus/events/collection-modification-event.js.map +1 -0
  658. package/cli/event-bus/events/country-event.d.ts +10 -0
  659. package/cli/event-bus/events/country-event.js +11 -0
  660. package/cli/event-bus/events/country-event.js.map +1 -0
  661. package/cli/event-bus/events/coupon-code-event.d.ts +10 -0
  662. package/cli/event-bus/events/coupon-code-event.js +15 -0
  663. package/cli/event-bus/events/coupon-code-event.js.map +1 -0
  664. package/cli/event-bus/events/customer-address-event.d.ts +15 -0
  665. package/cli/event-bus/events/customer-address-event.js +18 -0
  666. package/cli/event-bus/events/customer-address-event.js.map +1 -0
  667. package/cli/event-bus/events/customer-event.d.ts +13 -0
  668. package/cli/event-bus/events/customer-event.js +14 -0
  669. package/cli/event-bus/events/customer-event.js.map +1 -0
  670. package/cli/event-bus/events/customer-group-entity-event.d.ts +10 -0
  671. package/cli/event-bus/events/customer-group-entity-event.js +11 -0
  672. package/cli/event-bus/events/customer-group-entity-event.js.map +1 -0
  673. package/cli/event-bus/events/customer-group-event.d.ts +18 -0
  674. package/cli/event-bus/events/customer-group-event.js +25 -0
  675. package/cli/event-bus/events/customer-group-event.js.map +1 -0
  676. package/cli/event-bus/events/facet-event.d.ts +10 -0
  677. package/cli/event-bus/events/facet-event.js +11 -0
  678. package/cli/event-bus/events/facet-event.js.map +1 -0
  679. package/cli/event-bus/events/facet-value-event.d.ts +10 -0
  680. package/cli/event-bus/events/facet-value-event.js +11 -0
  681. package/cli/event-bus/events/facet-value-event.js.map +1 -0
  682. package/cli/event-bus/events/fulfillment-event.d.ts +14 -0
  683. package/cli/event-bus/events/fulfillment-event.js +11 -0
  684. package/cli/event-bus/events/fulfillment-event.js.map +1 -0
  685. package/cli/event-bus/events/fulfillment-state-transition-event.d.ts +11 -0
  686. package/cli/event-bus/events/fulfillment-state-transition-event.js +15 -0
  687. package/cli/event-bus/events/fulfillment-state-transition-event.js.map +1 -0
  688. package/cli/event-bus/events/global-settings-event.d.ts +7 -0
  689. package/cli/event-bus/events/global-settings-event.js +11 -0
  690. package/cli/event-bus/events/global-settings-event.js.map +1 -0
  691. package/cli/event-bus/events/history-entry-event.d.ts +14 -0
  692. package/cli/event-bus/events/history-entry-event.js +12 -0
  693. package/cli/event-bus/events/history-entry-event.js.map +1 -0
  694. package/cli/event-bus/events/identifier-change-event.d.ts +9 -0
  695. package/cli/event-bus/events/identifier-change-event.js +14 -0
  696. package/cli/event-bus/events/identifier-change-event.js.map +1 -0
  697. package/cli/event-bus/events/identifier-change-request-event.d.ts +8 -0
  698. package/cli/event-bus/events/identifier-change-request-event.js +13 -0
  699. package/cli/event-bus/events/identifier-change-request-event.js.map +1 -0
  700. package/cli/event-bus/events/login-event.d.ts +8 -0
  701. package/cli/event-bus/events/login-event.js +13 -0
  702. package/cli/event-bus/events/login-event.js.map +1 -0
  703. package/cli/event-bus/events/logout-event.d.ts +6 -0
  704. package/cli/event-bus/events/logout-event.js +12 -0
  705. package/cli/event-bus/events/logout-event.js.map +1 -0
  706. package/cli/event-bus/events/order-event.d.ts +9 -0
  707. package/cli/event-bus/events/order-event.js +14 -0
  708. package/cli/event-bus/events/order-event.js.map +1 -0
  709. package/cli/event-bus/events/order-line-event.d.ts +10 -0
  710. package/cli/event-bus/events/order-line-event.js +15 -0
  711. package/cli/event-bus/events/order-line-event.js.map +1 -0
  712. package/cli/event-bus/events/order-placed-event.d.ts +11 -0
  713. package/cli/event-bus/events/order-placed-event.js +15 -0
  714. package/cli/event-bus/events/order-placed-event.js.map +1 -0
  715. package/cli/event-bus/events/order-state-transition-event.d.ts +11 -0
  716. package/cli/event-bus/events/order-state-transition-event.js +15 -0
  717. package/cli/event-bus/events/order-state-transition-event.js.map +1 -0
  718. package/cli/event-bus/events/password-reset-event.d.ts +8 -0
  719. package/cli/event-bus/events/password-reset-event.js +13 -0
  720. package/cli/event-bus/events/password-reset-event.js.map +1 -0
  721. package/cli/event-bus/events/password-reset-verified-event.d.ts +8 -0
  722. package/cli/event-bus/events/password-reset-verified-event.js +13 -0
  723. package/cli/event-bus/events/password-reset-verified-event.js.map +1 -0
  724. package/cli/event-bus/events/payment-method-event.d.ts +10 -0
  725. package/cli/event-bus/events/payment-method-event.js +11 -0
  726. package/cli/event-bus/events/payment-method-event.js.map +1 -0
  727. package/cli/event-bus/events/payment-state-transition-event.d.ts +13 -0
  728. package/cli/event-bus/events/payment-state-transition-event.js +16 -0
  729. package/cli/event-bus/events/payment-state-transition-event.js.map +1 -0
  730. package/cli/event-bus/events/product-channel-event.d.ts +11 -0
  731. package/cli/event-bus/events/product-channel-event.js +15 -0
  732. package/cli/event-bus/events/product-channel-event.js.map +1 -0
  733. package/cli/event-bus/events/product-event.d.ts +11 -0
  734. package/cli/event-bus/events/product-event.js +14 -0
  735. package/cli/event-bus/events/product-event.js.map +1 -0
  736. package/cli/event-bus/events/product-option-event.d.ts +10 -0
  737. package/cli/event-bus/events/product-option-event.js +11 -0
  738. package/cli/event-bus/events/product-option-event.js.map +1 -0
  739. package/cli/event-bus/events/product-option-group-change-event.d.ts +11 -0
  740. package/cli/event-bus/events/product-option-group-change-event.js +15 -0
  741. package/cli/event-bus/events/product-option-group-change-event.js.map +1 -0
  742. package/cli/event-bus/events/product-option-group-event.d.ts +10 -0
  743. package/cli/event-bus/events/product-option-group-event.js +11 -0
  744. package/cli/event-bus/events/product-option-group-event.js.map +1 -0
  745. package/cli/event-bus/events/product-variant-channel-event.d.ts +11 -0
  746. package/cli/event-bus/events/product-variant-channel-event.js +15 -0
  747. package/cli/event-bus/events/product-variant-channel-event.js.map +1 -0
  748. package/cli/event-bus/events/product-variant-event.d.ts +11 -0
  749. package/cli/event-bus/events/product-variant-event.js +14 -0
  750. package/cli/event-bus/events/product-variant-event.js.map +1 -0
  751. package/cli/event-bus/events/promotion-event.d.ts +10 -0
  752. package/cli/event-bus/events/promotion-event.js +11 -0
  753. package/cli/event-bus/events/promotion-event.js.map +1 -0
  754. package/cli/event-bus/events/refund-state-transition-event.d.ts +13 -0
  755. package/cli/event-bus/events/refund-state-transition-event.js +16 -0
  756. package/cli/event-bus/events/refund-state-transition-event.js.map +1 -0
  757. package/cli/event-bus/events/role-change-event.d.ts +11 -0
  758. package/cli/event-bus/events/role-change-event.js +15 -0
  759. package/cli/event-bus/events/role-change-event.js.map +1 -0
  760. package/cli/event-bus/events/role-event.d.ts +10 -0
  761. package/cli/event-bus/events/role-event.js +11 -0
  762. package/cli/event-bus/events/role-event.js.map +1 -0
  763. package/cli/event-bus/events/shipping-method-event.d.ts +10 -0
  764. package/cli/event-bus/events/shipping-method-event.js +11 -0
  765. package/cli/event-bus/events/shipping-method-event.js.map +1 -0
  766. package/cli/event-bus/events/stock-movement-event.d.ts +10 -0
  767. package/cli/event-bus/events/stock-movement-event.js +15 -0
  768. package/cli/event-bus/events/stock-movement-event.js.map +1 -0
  769. package/cli/event-bus/events/tax-category-event.d.ts +10 -0
  770. package/cli/event-bus/events/tax-category-event.js +11 -0
  771. package/cli/event-bus/events/tax-category-event.js.map +1 -0
  772. package/cli/event-bus/events/tax-rate-event.d.ts +10 -0
  773. package/cli/event-bus/events/tax-rate-event.js +11 -0
  774. package/cli/event-bus/events/tax-rate-event.js.map +1 -0
  775. package/cli/event-bus/events/tax-rate-modification-event.d.ts +8 -0
  776. package/cli/event-bus/events/tax-rate-modification-event.js +13 -0
  777. package/cli/event-bus/events/tax-rate-modification-event.js.map +1 -0
  778. package/cli/event-bus/events/zone-event.d.ts +10 -0
  779. package/cli/event-bus/events/zone-event.js +11 -0
  780. package/cli/event-bus/events/zone-event.js.map +1 -0
  781. package/cli/event-bus/events/zone-members-event.d.ts +11 -0
  782. package/cli/event-bus/events/zone-members-event.js +15 -0
  783. package/cli/event-bus/events/zone-members-event.js.map +1 -0
  784. package/cli/event-bus/index.d.ts +55 -0
  785. package/cli/event-bus/index.js +68 -0
  786. package/cli/event-bus/index.js.map +1 -0
  787. package/cli/event-bus/vendure-entity-event.d.ts +9 -0
  788. package/cli/event-bus/vendure-entity-event.js +15 -0
  789. package/cli/event-bus/vendure-entity-event.js.map +1 -0
  790. package/cli/event-bus/vendure-event.d.ts +4 -0
  791. package/cli/event-bus/vendure-event.js +10 -0
  792. package/cli/event-bus/vendure-event.js.map +1 -0
  793. package/cli/health-check/constants.d.ts +1 -0
  794. package/cli/health-check/constants.js +5 -0
  795. package/cli/health-check/constants.js.map +1 -0
  796. package/cli/i18n/i18n-error.d.ts +13 -0
  797. package/cli/i18n/i18n-error.js +16 -0
  798. package/cli/i18n/i18n-error.js.map +1 -0
  799. package/cli/job-queue/constants.d.ts +1 -0
  800. package/cli/job-queue/constants.js +5 -0
  801. package/cli/job-queue/constants.js.map +1 -0
  802. package/cli/job-queue/in-memory-job-queue-strategy.d.ts +34 -0
  803. package/cli/job-queue/in-memory-job-queue-strategy.js +187 -0
  804. package/cli/job-queue/in-memory-job-queue-strategy.js.map +1 -0
  805. package/cli/job-queue/index.d.ts +11 -0
  806. package/cli/job-queue/index.js +24 -0
  807. package/cli/job-queue/index.js.map +1 -0
  808. package/cli/job-queue/injectable-job-queue-strategy.d.ts +12 -0
  809. package/cli/job-queue/injectable-job-queue-strategy.js +21 -0
  810. package/cli/job-queue/injectable-job-queue-strategy.js.map +1 -0
  811. package/cli/job-queue/job-buffer/in-memory-job-buffer-storage-strategy.d.ts +13 -0
  812. package/cli/job-queue/job-buffer/in-memory-job-buffer-storage-strategy.js +47 -0
  813. package/cli/job-queue/job-buffer/in-memory-job-buffer-storage-strategy.js.map +1 -0
  814. package/cli/job-queue/job-buffer/job-buffer-storage-strategy.d.ts +11 -0
  815. package/cli/job-queue/job-buffer/job-buffer-storage-strategy.js +3 -0
  816. package/cli/job-queue/job-buffer/job-buffer-storage-strategy.js.map +1 -0
  817. package/cli/job-queue/job-buffer/job-buffer.d.ts +7 -0
  818. package/cli/job-queue/job-buffer/job-buffer.js +3 -0
  819. package/cli/job-queue/job-buffer/job-buffer.js.map +1 -0
  820. package/cli/job-queue/job-buffer/job-buffer.service.d.ts +16 -0
  821. package/cli/job-queue/job-buffer/job-buffer.service.js +76 -0
  822. package/cli/job-queue/job-buffer/job-buffer.service.js.map +1 -0
  823. package/cli/job-queue/job-queue.d.ts +16 -0
  824. package/cli/job-queue/job-queue.js +59 -0
  825. package/cli/job-queue/job-queue.js.map +1 -0
  826. package/cli/job-queue/job-queue.service.d.ts +27 -0
  827. package/cli/job-queue/job-queue.service.js +84 -0
  828. package/cli/job-queue/job-queue.service.js.map +1 -0
  829. package/cli/job-queue/job.d.ts +41 -0
  830. package/cli/job-queue/job.js +160 -0
  831. package/cli/job-queue/job.js.map +1 -0
  832. package/cli/job-queue/polling-job-queue-strategy.d.ts +26 -0
  833. package/cli/job-queue/polling-job-queue-strategy.js +163 -0
  834. package/cli/job-queue/polling-job-queue-strategy.js.map +1 -0
  835. package/cli/job-queue/queue-name-process-storage.d.ts +7 -0
  836. package/cli/job-queue/queue-name-process-storage.js +40 -0
  837. package/cli/job-queue/queue-name-process-storage.js.map +1 -0
  838. package/cli/job-queue/subscribable-job.d.ts +13 -0
  839. package/cli/job-queue/subscribable-job.js +52 -0
  840. package/cli/job-queue/subscribable-job.js.map +1 -0
  841. package/cli/job-queue/types.d.ts +22 -0
  842. package/cli/job-queue/types.js +3 -0
  843. package/cli/job-queue/types.js.map +1 -0
  844. package/cli/populate.d.ts +4 -4
  845. package/cli/populate.js +38 -25
  846. package/cli/populate.js.map +1 -1
  847. package/cli/process-context/process-context.d.ts +7 -0
  848. package/cli/process-context/process-context.js +18 -0
  849. package/cli/process-context/process-context.js.map +1 -0
  850. package/cli/service/helpers/config-arg/config-arg.service.d.ts +31 -0
  851. package/cli/service/helpers/config-arg/config-arg.service.js +88 -0
  852. package/cli/service/helpers/config-arg/config-arg.service.js.map +1 -0
  853. package/cli/service/helpers/custom-field-relation/custom-field-relation.service.d.ts +18 -0
  854. package/cli/service/helpers/custom-field-relation/custom-field-relation.service.js +63 -0
  855. package/cli/service/helpers/custom-field-relation/custom-field-relation.service.js.map +1 -0
  856. package/cli/service/helpers/fulfillment-state-machine/fulfillment-state-machine.d.ts +21 -0
  857. package/cli/service/helpers/fulfillment-state-machine/fulfillment-state-machine.js +113 -0
  858. package/cli/service/helpers/fulfillment-state-machine/fulfillment-state-machine.js.map +1 -0
  859. package/cli/service/helpers/fulfillment-state-machine/fulfillment-state.d.ts +11 -0
  860. package/cli/service/helpers/fulfillment-state-machine/fulfillment-state.js +21 -0
  861. package/cli/service/helpers/fulfillment-state-machine/fulfillment-state.js.map +1 -0
  862. package/cli/service/helpers/list-query-builder/connection-utils.d.ts +10 -0
  863. package/cli/service/helpers/list-query-builder/connection-utils.js +26 -0
  864. package/cli/service/helpers/list-query-builder/connection-utils.js.map +1 -0
  865. package/cli/service/helpers/list-query-builder/get-calculated-columns.d.ts +3 -0
  866. package/cli/service/helpers/list-query-builder/get-calculated-columns.js +16 -0
  867. package/cli/service/helpers/list-query-builder/get-calculated-columns.js.map +1 -0
  868. package/cli/service/helpers/list-query-builder/list-query-builder.d.ts +30 -0
  869. package/cli/service/helpers/list-query-builder/list-query-builder.js +204 -0
  870. package/cli/service/helpers/list-query-builder/list-query-builder.js.map +1 -0
  871. package/cli/service/helpers/list-query-builder/parse-channel-param.d.ts +5 -0
  872. package/cli/service/helpers/list-query-builder/parse-channel-param.js +18 -0
  873. package/cli/service/helpers/list-query-builder/parse-channel-param.js.map +1 -0
  874. package/cli/service/helpers/list-query-builder/parse-filter-params.d.ts +13 -0
  875. package/cli/service/helpers/list-query-builder/parse-filter-params.js +155 -0
  876. package/cli/service/helpers/list-query-builder/parse-filter-params.js.map +1 -0
  877. package/cli/service/helpers/list-query-builder/parse-sort-params.d.ts +7 -0
  878. package/cli/service/helpers/list-query-builder/parse-sort-params.js +50 -0
  879. package/cli/service/helpers/list-query-builder/parse-sort-params.js.map +1 -0
  880. package/cli/service/helpers/order-calculator/order-calculator.d.ts +32 -0
  881. package/cli/service/helpers/order-calculator/order-calculator.js +311 -0
  882. package/cli/service/helpers/order-calculator/order-calculator.js.map +1 -0
  883. package/cli/service/helpers/order-calculator/prorate.d.ts +1 -0
  884. package/cli/service/helpers/order-calculator/prorate.js +35 -0
  885. package/cli/service/helpers/order-calculator/prorate.js.map +1 -0
  886. package/cli/service/helpers/order-merger/order-merger.d.ts +40 -0
  887. package/cli/service/helpers/order-merger/order-merger.js +97 -0
  888. package/cli/service/helpers/order-merger/order-merger.js.map +1 -0
  889. package/cli/service/helpers/order-modifier/order-modifier.d.ts +45 -0
  890. package/cli/service/helpers/order-modifier/order-modifier.js +423 -0
  891. package/cli/service/helpers/order-modifier/order-modifier.js.map +1 -0
  892. package/cli/service/helpers/order-state-machine/order-state-machine.d.ts +29 -0
  893. package/cli/service/helpers/order-state-machine/order-state-machine.js +240 -0
  894. package/cli/service/helpers/order-state-machine/order-state-machine.js.map +1 -0
  895. package/cli/service/helpers/order-state-machine/order-state.d.ts +9 -0
  896. package/cli/service/helpers/order-state-machine/order-state.js +64 -0
  897. package/cli/service/helpers/order-state-machine/order-state.js.map +1 -0
  898. package/cli/service/helpers/password-cipher/password-cipher.d.ts +7 -0
  899. package/cli/service/helpers/password-cipher/password-cipher.js +31 -0
  900. package/cli/service/helpers/password-cipher/password-cipher.js.map +1 -0
  901. package/cli/service/helpers/payment-state-machine/payment-state-machine.d.ts +20 -0
  902. package/cli/service/helpers/payment-state-machine/payment-state-machine.js +113 -0
  903. package/cli/service/helpers/payment-state-machine/payment-state-machine.js.map +1 -0
  904. package/cli/service/helpers/payment-state-machine/payment-state.d.ts +11 -0
  905. package/cli/service/helpers/payment-state-machine/payment-state.js +24 -0
  906. package/cli/service/helpers/payment-state-machine/payment-state.js.map +1 -0
  907. package/cli/service/helpers/product-price-applicator/product-price-applicator.d.ts +15 -0
  908. package/cli/service/helpers/product-price-applicator/product-price-applicator.js +64 -0
  909. package/cli/service/helpers/product-price-applicator/product-price-applicator.js.map +1 -0
  910. package/cli/service/helpers/refund-state-machine/refund-state-machine.d.ts +14 -0
  911. package/cli/service/helpers/refund-state-machine/refund-state-machine.js +65 -0
  912. package/cli/service/helpers/refund-state-machine/refund-state-machine.js.map +1 -0
  913. package/cli/service/helpers/refund-state-machine/refund-state.d.ts +11 -0
  914. package/cli/service/helpers/refund-state-machine/refund-state.js +15 -0
  915. package/cli/service/helpers/refund-state-machine/refund-state.js.map +1 -0
  916. package/cli/service/helpers/request-context/request-context.service.d.ts +29 -0
  917. package/{dist/api/common → cli/service/helpers/request-context}/request-context.service.js +50 -18
  918. package/cli/service/helpers/request-context/request-context.service.js.map +1 -0
  919. package/cli/service/helpers/shipping-calculator/shipping-calculator.d.ts +18 -0
  920. package/cli/service/helpers/shipping-calculator/shipping-calculator.js +50 -0
  921. package/cli/service/helpers/shipping-calculator/shipping-calculator.js.map +1 -0
  922. package/cli/service/helpers/translatable-saver/translatable-saver.d.ts +24 -0
  923. package/cli/service/helpers/translatable-saver/translatable-saver.js +64 -0
  924. package/cli/service/helpers/translatable-saver/translatable-saver.js.map +1 -0
  925. package/cli/service/helpers/translatable-saver/translation-differ.d.ts +17 -0
  926. package/cli/service/helpers/translatable-saver/translation-differ.js +65 -0
  927. package/cli/service/helpers/translatable-saver/translation-differ.js.map +1 -0
  928. package/cli/service/helpers/utils/address-to-line.d.ts +3 -0
  929. package/cli/service/helpers/utils/address-to-line.js +21 -0
  930. package/cli/service/helpers/utils/address-to-line.js.map +1 -0
  931. package/cli/service/helpers/utils/get-user-channels-permissions.d.ts +10 -0
  932. package/cli/service/helpers/utils/get-user-channels-permissions.js +26 -0
  933. package/cli/service/helpers/utils/get-user-channels-permissions.js.map +1 -0
  934. package/cli/service/helpers/utils/order-utils.d.ts +9 -0
  935. package/cli/service/helpers/utils/order-utils.js +64 -0
  936. package/cli/service/helpers/utils/order-utils.js.map +1 -0
  937. package/cli/service/helpers/utils/patch-entity.d.ts +5 -0
  938. package/cli/service/helpers/utils/patch-entity.js +17 -0
  939. package/cli/service/helpers/utils/patch-entity.js.map +1 -0
  940. package/cli/service/helpers/utils/samples-each.d.ts +1 -0
  941. package/cli/service/helpers/utils/samples-each.js +18 -0
  942. package/cli/service/helpers/utils/samples-each.js.map +1 -0
  943. package/cli/service/helpers/utils/translate-entity.d.ts +24 -0
  944. package/cli/service/helpers/utils/translate-entity.js +99 -0
  945. package/cli/service/helpers/utils/translate-entity.js.map +1 -0
  946. package/cli/service/helpers/verification-token-generator/verification-token-generator.d.ts +7 -0
  947. package/cli/service/helpers/verification-token-generator/verification-token-generator.js +44 -0
  948. package/cli/service/helpers/verification-token-generator/verification-token-generator.js.map +1 -0
  949. package/cli/service/services/administrator.service.d.ts +36 -0
  950. package/cli/service/services/administrator.service.js +230 -0
  951. package/cli/service/services/administrator.service.js.map +1 -0
  952. package/cli/service/services/asset.service.d.ts +63 -0
  953. package/cli/service/services/asset.service.js +478 -0
  954. package/cli/service/services/asset.service.js.map +1 -0
  955. package/cli/service/services/channel.service.d.ts +38 -0
  956. package/cli/service/services/channel.service.js +222 -0
  957. package/cli/service/services/channel.service.js.map +1 -0
  958. package/cli/service/services/country.service.d.ts +24 -0
  959. package/cli/service/services/country.service.js +119 -0
  960. package/cli/service/services/country.service.js.map +1 -0
  961. package/cli/service/services/customer.service.d.ts +62 -0
  962. package/cli/service/services/customer.service.js +662 -0
  963. package/cli/service/services/customer.service.js.map +1 -0
  964. package/cli/service/services/facet-value.service.d.ts +32 -0
  965. package/cli/service/services/facet-value.service.js +151 -0
  966. package/cli/service/services/facet-value.service.js.map +1 -0
  967. package/cli/service/services/fulfillment.service.d.ts +32 -0
  968. package/cli/service/services/fulfillment.service.js +106 -0
  969. package/cli/service/services/fulfillment.service.js.map +1 -0
  970. package/cli/service/services/global-settings.service.d.ts +17 -0
  971. package/cli/service/services/global-settings.service.js +74 -0
  972. package/cli/service/services/global-settings.service.js.map +1 -0
  973. package/cli/service/services/history.service.d.ts +139 -0
  974. package/cli/service/services/history.service.js +143 -0
  975. package/cli/service/services/history.service.js.map +1 -0
  976. package/cli/service/services/order.service.d.ts +136 -0
  977. package/cli/service/services/order.service.js +1158 -0
  978. package/cli/service/services/order.service.js.map +1 -0
  979. package/cli/service/services/payment-method.service.d.ts +37 -0
  980. package/cli/service/services/payment-method.service.js +178 -0
  981. package/cli/service/services/payment-method.service.js.map +1 -0
  982. package/cli/service/services/payment.service.d.ts +32 -0
  983. package/cli/service/services/payment.service.js +216 -0
  984. package/cli/service/services/payment.service.js.map +1 -0
  985. package/cli/service/services/product-variant.service.d.ts +70 -0
  986. package/cli/service/services/product-variant.service.js +560 -0
  987. package/cli/service/services/product-variant.service.js.map +1 -0
  988. package/cli/service/services/promotion.service.d.ts +41 -0
  989. package/cli/service/services/promotion.service.js +219 -0
  990. package/cli/service/services/promotion.service.js.map +1 -0
  991. package/cli/service/services/role.service.d.ts +39 -0
  992. package/cli/service/services/role.service.js +240 -0
  993. package/cli/service/services/role.service.js.map +1 -0
  994. package/cli/service/services/session.service.d.ts +38 -0
  995. package/cli/service/services/session.service.js +228 -0
  996. package/cli/service/services/session.service.js.map +1 -0
  997. package/cli/service/services/shipping-method.service.d.ts +36 -0
  998. package/cli/service/services/shipping-method.service.js +181 -0
  999. package/cli/service/services/shipping-method.service.js.map +1 -0
  1000. package/cli/service/services/stock-movement.service.d.ts +39 -0
  1001. package/cli/service/services/stock-movement.service.js +214 -0
  1002. package/cli/service/services/stock-movement.service.js.map +1 -0
  1003. package/cli/service/services/tag.service.d.ts +21 -0
  1004. package/cli/service/services/tag.service.js +82 -0
  1005. package/cli/service/services/tag.service.js.map +1 -0
  1006. package/cli/service/services/tax-category.service.d.ts +16 -0
  1007. package/cli/service/services/tax-category.service.js +95 -0
  1008. package/cli/service/services/tax-category.service.js.map +1 -0
  1009. package/cli/service/services/tax-rate.service.d.ts +28 -0
  1010. package/cli/service/services/tax-rate.service.js +134 -0
  1011. package/cli/service/services/tax-rate.service.js.map +1 -0
  1012. package/cli/service/services/user.service.d.ts +37 -0
  1013. package/cli/service/services/user.service.js +287 -0
  1014. package/cli/service/services/user.service.js.map +1 -0
  1015. package/cli/service/services/zone.service.d.ts +26 -0
  1016. package/cli/service/services/zone.service.js +168 -0
  1017. package/cli/service/services/zone.service.js.map +1 -0
  1018. package/dist/api/api.module.js +0 -2
  1019. package/dist/api/api.module.js.map +1 -1
  1020. package/dist/api/common/request-context.d.ts +3 -1
  1021. package/dist/api/common/request-context.js +3 -1
  1022. package/dist/api/common/request-context.js.map +1 -1
  1023. package/dist/api/config/configure-graphql-module.js +2 -0
  1024. package/dist/api/config/configure-graphql-module.js.map +1 -1
  1025. package/dist/api/config/generate-permissions.js +29 -4
  1026. package/dist/api/config/generate-permissions.js.map +1 -1
  1027. package/dist/api/config/graphql-custom-fields.js +27 -16
  1028. package/dist/api/config/graphql-custom-fields.js.map +1 -1
  1029. package/dist/api/decorators/request-context.decorator.js +9 -2
  1030. package/dist/api/decorators/request-context.decorator.js.map +1 -1
  1031. package/dist/api/middleware/auth-guard.d.ts +1 -1
  1032. package/dist/api/middleware/auth-guard.js +1 -1
  1033. package/dist/api/middleware/auth-guard.js.map +1 -1
  1034. package/dist/api/middleware/transaction-interceptor.d.ts +9 -0
  1035. package/dist/api/middleware/transaction-interceptor.js +16 -1
  1036. package/dist/api/middleware/transaction-interceptor.js.map +1 -1
  1037. package/dist/api/resolvers/admin/global-settings.resolver.js +1 -1
  1038. package/dist/api/resolvers/admin/global-settings.resolver.js.map +1 -1
  1039. package/dist/api/resolvers/entity/order-line-entity.resolver.d.ts +5 -3
  1040. package/dist/api/resolvers/entity/order-line-entity.resolver.js +16 -2
  1041. package/dist/api/resolvers/entity/order-line-entity.resolver.js.map +1 -1
  1042. package/dist/api/schema/admin-api/customer.api.graphql +4 -0
  1043. package/dist/api/schema/admin-api/order.api.graphql +6 -0
  1044. package/dist/api/schema/common/common-enums.graphql +1 -0
  1045. package/dist/api/schema/common/common-error-results.graphql +22 -0
  1046. package/dist/api/schema/common/common-types.graphql +25 -0
  1047. package/dist/api/schema/shop-api/shop-error-results.graphql +7 -29
  1048. package/dist/api/schema/shop-api/shop.api.graphql +4 -2
  1049. package/dist/bootstrap.js +6 -3
  1050. package/dist/bootstrap.js.map +1 -1
  1051. package/dist/common/constants.d.ts +1 -0
  1052. package/dist/common/constants.js +2 -1
  1053. package/dist/common/constants.js.map +1 -1
  1054. package/dist/common/error/generated-graphql-admin-errors.d.ts +22 -0
  1055. package/dist/common/error/generated-graphql-admin-errors.js +33 -2
  1056. package/dist/common/error/generated-graphql-admin-errors.js.map +1 -1
  1057. package/dist/common/error/generated-graphql-shop-errors.d.ts +7 -0
  1058. package/dist/common/error/generated-graphql-shop-errors.js +12 -2
  1059. package/dist/common/error/generated-graphql-shop-errors.js.map +1 -1
  1060. package/dist/common/finite-state-machine/finite-state-machine.js +2 -1
  1061. package/dist/common/finite-state-machine/finite-state-machine.js.map +1 -1
  1062. package/dist/common/types/common-types.d.ts +3 -0
  1063. package/dist/config/auth/default-password-validation-strategy.d.ts +23 -0
  1064. package/dist/config/auth/default-password-validation-strategy.js +37 -0
  1065. package/dist/config/auth/default-password-validation-strategy.js.map +1 -0
  1066. package/dist/config/auth/password-validation-strategy.d.ts +22 -0
  1067. package/dist/config/auth/password-validation-strategy.js +3 -0
  1068. package/dist/config/auth/password-validation-strategy.js.map +1 -0
  1069. package/dist/config/config.module.js +2 -1
  1070. package/dist/config/config.module.js.map +1 -1
  1071. package/dist/config/default-config.js +4 -0
  1072. package/dist/config/default-config.js.map +1 -1
  1073. package/dist/config/index.d.ts +4 -0
  1074. package/dist/config/index.js +4 -0
  1075. package/dist/config/index.js.map +1 -1
  1076. package/dist/config/promotion/index.d.ts +4 -0
  1077. package/dist/config/promotion/index.js +4 -0
  1078. package/dist/config/promotion/index.js.map +1 -1
  1079. package/dist/config/vendure-config.d.ts +53 -0
  1080. package/dist/connection/connection.module.d.ts +1 -1
  1081. package/dist/connection/transaction-wrapper.d.ts +5 -1
  1082. package/dist/connection/transaction-wrapper.js +9 -3
  1083. package/dist/connection/transaction-wrapper.js.map +1 -1
  1084. package/dist/connection/transactional-connection.d.ts +7 -3
  1085. package/dist/connection/transactional-connection.js +3 -3
  1086. package/dist/connection/transactional-connection.js.map +1 -1
  1087. package/dist/data-import/data-import.module.js +1 -1
  1088. package/dist/data-import/data-import.module.js.map +1 -1
  1089. package/dist/data-import/index.d.ts +3 -0
  1090. package/dist/data-import/index.js +3 -0
  1091. package/dist/data-import/index.js.map +1 -1
  1092. package/dist/data-import/providers/asset-importer/asset-importer.d.ts +12 -1
  1093. package/dist/data-import/providers/asset-importer/asset-importer.js +12 -2
  1094. package/dist/data-import/providers/asset-importer/asset-importer.js.map +1 -1
  1095. package/dist/data-import/providers/import-parser/import-parser.d.ts +59 -0
  1096. package/dist/data-import/providers/import-parser/import-parser.js +12 -0
  1097. package/dist/data-import/providers/import-parser/import-parser.js.map +1 -1
  1098. package/dist/data-import/providers/importer/fast-importer.service.d.ts +21 -3
  1099. package/dist/data-import/providers/importer/fast-importer.service.js +53 -17
  1100. package/dist/data-import/providers/importer/fast-importer.service.js.map +1 -1
  1101. package/dist/data-import/providers/importer/importer.d.ts +18 -0
  1102. package/dist/data-import/providers/importer/importer.js +35 -19
  1103. package/dist/data-import/providers/importer/importer.js.map +1 -1
  1104. package/dist/data-import/providers/populator/populator.d.ts +13 -4
  1105. package/dist/data-import/providers/populator/populator.js +32 -20
  1106. package/dist/data-import/providers/populator/populator.js.map +1 -1
  1107. package/dist/event-bus/event-bus.js +12 -3
  1108. package/dist/event-bus/event-bus.js.map +1 -1
  1109. package/dist/event-bus/events/order-event.d.ts +17 -0
  1110. package/dist/event-bus/events/order-event.js +22 -0
  1111. package/dist/event-bus/events/order-event.js.map +1 -0
  1112. package/dist/event-bus/events/order-line-event.d.ts +18 -0
  1113. package/dist/event-bus/events/order-line-event.js +23 -0
  1114. package/dist/event-bus/events/order-line-event.js.map +1 -0
  1115. package/dist/event-bus/index.d.ts +2 -0
  1116. package/dist/event-bus/index.js +2 -0
  1117. package/dist/event-bus/index.js.map +1 -1
  1118. package/dist/i18n/messages/en.json +1 -0
  1119. package/dist/job-queue/job-queue.service.js +3 -0
  1120. package/dist/job-queue/job-queue.service.js.map +1 -1
  1121. package/dist/plugin/plugin-common.module.js +3 -0
  1122. package/dist/plugin/plugin-common.module.js.map +1 -1
  1123. package/dist/service/helpers/list-query-builder/list-query-builder.d.ts +19 -2
  1124. package/dist/service/helpers/list-query-builder/list-query-builder.js +1 -1
  1125. package/dist/service/helpers/list-query-builder/list-query-builder.js.map +1 -1
  1126. package/dist/service/helpers/list-query-builder/parse-filter-params.js +4 -1
  1127. package/dist/service/helpers/list-query-builder/parse-filter-params.js.map +1 -1
  1128. package/dist/service/helpers/order-calculator/order-calculator.d.ts +11 -1
  1129. package/dist/service/helpers/order-calculator/order-calculator.js +10 -0
  1130. package/dist/service/helpers/order-calculator/order-calculator.js.map +1 -1
  1131. package/dist/service/helpers/order-calculator/prorate.js +1 -1
  1132. package/dist/service/helpers/order-calculator/prorate.js.map +1 -1
  1133. package/dist/service/helpers/order-modifier/order-modifier.d.ts +10 -1
  1134. package/dist/service/helpers/order-modifier/order-modifier.js +86 -3
  1135. package/dist/service/helpers/order-modifier/order-modifier.js.map +1 -1
  1136. package/dist/service/helpers/request-context/request-context.service.d.ts +57 -0
  1137. package/dist/service/helpers/request-context/request-context.service.js +155 -0
  1138. package/dist/service/helpers/request-context/request-context.service.js.map +1 -0
  1139. package/dist/service/helpers/slug-validator/slug-validator.js +15 -6
  1140. package/dist/service/helpers/slug-validator/slug-validator.js.map +1 -1
  1141. package/dist/service/helpers/utils/order-utils.js +1 -1
  1142. package/dist/service/helpers/utils/order-utils.js.map +1 -1
  1143. package/dist/service/helpers/utils/translate-entity.js +1 -2
  1144. package/dist/service/helpers/utils/translate-entity.js.map +1 -1
  1145. package/dist/service/index.d.ts +3 -0
  1146. package/dist/service/index.js +3 -0
  1147. package/dist/service/index.js.map +1 -1
  1148. package/dist/service/service.module.js +2 -0
  1149. package/dist/service/service.module.js.map +1 -1
  1150. package/dist/service/services/asset.service.d.ts +1 -1
  1151. package/dist/service/services/asset.service.js +5 -3
  1152. package/dist/service/services/asset.service.js.map +1 -1
  1153. package/dist/service/services/customer-group.service.d.ts +3 -1
  1154. package/dist/service/services/customer-group.service.js +8 -3
  1155. package/dist/service/services/customer-group.service.js.map +1 -1
  1156. package/dist/service/services/customer.service.d.ts +3 -3
  1157. package/dist/service/services/customer.service.js +32 -4
  1158. package/dist/service/services/customer.service.js.map +1 -1
  1159. package/dist/service/services/history.service.d.ts +1 -0
  1160. package/dist/service/services/history.service.js.map +1 -1
  1161. package/dist/service/services/order.service.d.ts +15 -0
  1162. package/dist/service/services/order.service.js +85 -31
  1163. package/dist/service/services/order.service.js.map +1 -1
  1164. package/dist/service/services/product-variant.service.d.ts +1 -0
  1165. package/dist/service/services/product-variant.service.js +18 -5
  1166. package/dist/service/services/product-variant.service.js.map +1 -1
  1167. package/dist/service/services/promotion.service.js +2 -1
  1168. package/dist/service/services/promotion.service.js.map +1 -1
  1169. package/dist/service/services/session.service.js +1 -2
  1170. package/dist/service/services/session.service.js.map +1 -1
  1171. package/dist/service/services/user.service.d.ts +5 -4
  1172. package/dist/service/services/user.service.js +30 -3
  1173. package/dist/service/services/user.service.js.map +1 -1
  1174. package/package.json +3 -3
  1175. package/dist/api/common/request-context.service.d.ts +0 -30
  1176. package/dist/api/common/request-context.service.js.map +0 -1
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.StockMovementService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const generated_types_1 = require("@vendure/common/lib/generated-types");
15
+ const errors_1 = require("../../common/error/errors");
16
+ const transactional_connection_1 = require("../../connection/transactional-connection");
17
+ const order_item_entity_1 = require("../../entity/order-item/order-item.entity");
18
+ const product_variant_entity_1 = require("../../entity/product-variant/product-variant.entity");
19
+ const allocation_entity_1 = require("../../entity/stock-movement/allocation.entity");
20
+ const cancellation_entity_1 = require("../../entity/stock-movement/cancellation.entity");
21
+ const release_entity_1 = require("../../entity/stock-movement/release.entity");
22
+ const sale_entity_1 = require("../../entity/stock-movement/sale.entity");
23
+ const stock_adjustment_entity_1 = require("../../entity/stock-movement/stock-adjustment.entity");
24
+ const stock_movement_entity_1 = require("../../entity/stock-movement/stock-movement.entity");
25
+ const event_bus_1 = require("../../event-bus/event-bus");
26
+ const stock_movement_event_1 = require("../../event-bus/events/stock-movement-event");
27
+ const list_query_builder_1 = require("../helpers/list-query-builder/list-query-builder");
28
+ const global_settings_service_1 = require("./global-settings.service");
29
+ let StockMovementService = class StockMovementService {
30
+ constructor(connection, listQueryBuilder, globalSettingsService, eventBus) {
31
+ this.connection = connection;
32
+ this.listQueryBuilder = listQueryBuilder;
33
+ this.globalSettingsService = globalSettingsService;
34
+ this.eventBus = eventBus;
35
+ }
36
+ getStockMovementsByProductVariantId(ctx, productVariantId, options) {
37
+ return this.listQueryBuilder
38
+ .build(stock_movement_entity_1.StockMovement, options, { ctx })
39
+ .leftJoin('stockmovement.productVariant', 'productVariant')
40
+ .andWhere('productVariant.id = :productVariantId', { productVariantId })
41
+ .getManyAndCount()
42
+ .then(async ([items, totalItems]) => {
43
+ return {
44
+ items,
45
+ totalItems,
46
+ };
47
+ });
48
+ }
49
+ async adjustProductVariantStock(ctx, productVariantId, oldStockLevel, newStockLevel) {
50
+ if (oldStockLevel === newStockLevel) {
51
+ return;
52
+ }
53
+ const delta = newStockLevel - oldStockLevel;
54
+ const adjustment = await this.connection.getRepository(ctx, stock_adjustment_entity_1.StockAdjustment).save(new stock_adjustment_entity_1.StockAdjustment({
55
+ quantity: delta,
56
+ productVariant: { id: productVariantId },
57
+ }));
58
+ this.eventBus.publish(new stock_movement_event_1.StockMovementEvent(ctx, [adjustment]));
59
+ return adjustment;
60
+ }
61
+ async createAllocationsForOrder(ctx, order) {
62
+ if (order.active !== false) {
63
+ throw new errors_1.InternalServerError('error.cannot-create-allocations-for-active-order');
64
+ }
65
+ const lines = order.lines.map(orderLine => ({ orderLine, quantity: orderLine.quantity }));
66
+ return this.createAllocationsForOrderLines(ctx, lines);
67
+ }
68
+ async createAllocationsForOrderLines(ctx, lines) {
69
+ const allocations = [];
70
+ const globalTrackInventory = (await this.globalSettingsService.getSettings(ctx)).trackInventory;
71
+ for (const { orderLine, quantity } of lines) {
72
+ const productVariant = await this.connection.getEntityOrThrow(ctx, product_variant_entity_1.ProductVariant, orderLine.productVariant.id);
73
+ const allocation = new allocation_entity_1.Allocation({
74
+ productVariant,
75
+ quantity,
76
+ orderLine,
77
+ });
78
+ allocations.push(allocation);
79
+ if (this.trackInventoryForVariant(productVariant, globalTrackInventory)) {
80
+ productVariant.stockAllocated += quantity;
81
+ await this.connection
82
+ .getRepository(ctx, product_variant_entity_1.ProductVariant)
83
+ .save(productVariant, { reload: false });
84
+ }
85
+ }
86
+ const savedAllocations = await this.connection.getRepository(ctx, allocation_entity_1.Allocation).save(allocations);
87
+ if (savedAllocations.length) {
88
+ this.eventBus.publish(new stock_movement_event_1.StockMovementEvent(ctx, savedAllocations));
89
+ }
90
+ return savedAllocations;
91
+ }
92
+ async createSalesForOrder(ctx, orderItems) {
93
+ const sales = [];
94
+ const globalTrackInventory = (await this.globalSettingsService.getSettings(ctx)).trackInventory;
95
+ const orderItemsWithVariants = await this.connection.getRepository(ctx, order_item_entity_1.OrderItem).findByIds(orderItems.map(i => i.id), {
96
+ relations: ['line', 'line.productVariant'],
97
+ });
98
+ const orderLinesMap = new Map();
99
+ for (const orderItem of orderItemsWithVariants) {
100
+ let value = orderLinesMap.get(orderItem.line.id);
101
+ if (!value) {
102
+ value = { line: orderItem.line, items: [] };
103
+ orderLinesMap.set(orderItem.line.id, value);
104
+ }
105
+ value.items.push(orderItem);
106
+ }
107
+ for (const lineRow of orderLinesMap.values()) {
108
+ const productVariant = await this.connection.getEntityOrThrow(ctx, product_variant_entity_1.ProductVariant, lineRow.line.productVariant.id);
109
+ const sale = new sale_entity_1.Sale({
110
+ productVariant,
111
+ quantity: lineRow.items.length * -1,
112
+ orderLine: lineRow.line,
113
+ });
114
+ sales.push(sale);
115
+ if (this.trackInventoryForVariant(productVariant, globalTrackInventory)) {
116
+ productVariant.stockOnHand -= lineRow.items.length;
117
+ productVariant.stockAllocated -= lineRow.items.length;
118
+ await this.connection
119
+ .getRepository(ctx, product_variant_entity_1.ProductVariant)
120
+ .save(productVariant, { reload: false });
121
+ }
122
+ }
123
+ const savedSales = await this.connection.getRepository(ctx, sale_entity_1.Sale).save(sales);
124
+ if (savedSales.length) {
125
+ this.eventBus.publish(new stock_movement_event_1.StockMovementEvent(ctx, savedSales));
126
+ }
127
+ return savedSales;
128
+ }
129
+ async createCancellationsForOrderItems(ctx, items) {
130
+ const orderItems = await this.connection.getRepository(ctx, order_item_entity_1.OrderItem).findByIds(items.map(i => i.id), {
131
+ relations: ['line', 'line.productVariant'],
132
+ });
133
+ const cancellations = [];
134
+ const globalTrackInventory = (await this.globalSettingsService.getSettings(ctx)).trackInventory;
135
+ const variantsMap = new Map();
136
+ for (const item of orderItems) {
137
+ let productVariant;
138
+ const productVariantId = item.line.productVariant.id;
139
+ if (variantsMap.has(productVariantId)) {
140
+ productVariant = variantsMap.get(productVariantId);
141
+ }
142
+ else {
143
+ productVariant = item.line.productVariant;
144
+ variantsMap.set(productVariantId, productVariant);
145
+ }
146
+ const cancellation = new cancellation_entity_1.Cancellation({
147
+ productVariant,
148
+ quantity: 1,
149
+ orderItem: item,
150
+ });
151
+ cancellations.push(cancellation);
152
+ if (this.trackInventoryForVariant(productVariant, globalTrackInventory)) {
153
+ productVariant.stockOnHand += 1;
154
+ await this.connection
155
+ .getRepository(ctx, product_variant_entity_1.ProductVariant)
156
+ .save(productVariant, { reload: false });
157
+ }
158
+ }
159
+ const savedCancellations = await this.connection.getRepository(ctx, cancellation_entity_1.Cancellation).save(cancellations);
160
+ if (savedCancellations.length) {
161
+ this.eventBus.publish(new stock_movement_event_1.StockMovementEvent(ctx, savedCancellations));
162
+ }
163
+ return savedCancellations;
164
+ }
165
+ async createReleasesForOrderItems(ctx, items) {
166
+ const orderItems = await this.connection.getRepository(ctx, order_item_entity_1.OrderItem).findByIds(items.map(i => i.id), {
167
+ relations: ['line', 'line.productVariant'],
168
+ });
169
+ const releases = [];
170
+ const globalTrackInventory = (await this.globalSettingsService.getSettings(ctx)).trackInventory;
171
+ const variantsMap = new Map();
172
+ for (const item of orderItems) {
173
+ let productVariant;
174
+ const productVariantId = item.line.productVariant.id;
175
+ if (variantsMap.has(productVariantId)) {
176
+ productVariant = variantsMap.get(productVariantId);
177
+ }
178
+ else {
179
+ productVariant = item.line.productVariant;
180
+ variantsMap.set(productVariantId, productVariant);
181
+ }
182
+ const release = new release_entity_1.Release({
183
+ productVariant,
184
+ quantity: 1,
185
+ orderItem: item,
186
+ });
187
+ releases.push(release);
188
+ if (this.trackInventoryForVariant(productVariant, globalTrackInventory)) {
189
+ productVariant.stockAllocated -= 1;
190
+ await this.connection
191
+ .getRepository(ctx, product_variant_entity_1.ProductVariant)
192
+ .save(productVariant, { reload: false });
193
+ }
194
+ }
195
+ const savedReleases = await this.connection.getRepository(ctx, release_entity_1.Release).save(releases);
196
+ if (savedReleases.length) {
197
+ this.eventBus.publish(new stock_movement_event_1.StockMovementEvent(ctx, savedReleases));
198
+ }
199
+ return savedReleases;
200
+ }
201
+ trackInventoryForVariant(variant, globalTrackInventory) {
202
+ return (variant.trackInventory === generated_types_1.GlobalFlag.TRUE ||
203
+ (variant.trackInventory === generated_types_1.GlobalFlag.INHERIT && globalTrackInventory));
204
+ }
205
+ };
206
+ StockMovementService = __decorate([
207
+ common_1.Injectable(),
208
+ __metadata("design:paramtypes", [transactional_connection_1.TransactionalConnection,
209
+ list_query_builder_1.ListQueryBuilder,
210
+ global_settings_service_1.GlobalSettingsService,
211
+ event_bus_1.EventBus])
212
+ ], StockMovementService);
213
+ exports.StockMovementService = StockMovementService;
214
+ //# sourceMappingURL=stock-movement.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stock-movement.service.js","sourceRoot":"","sources":["../../../src/service/services/stock-movement.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yEAA2F;AAI3F,sDAAgE;AAGhE,wFAAoF;AACpF,iFAAsE;AAGtE,gGAAqF;AAErF,qFAA2E;AAC3E,yFAA+E;AAC/E,+EAAqE;AACrE,yEAA+D;AAC/D,iGAAsF;AACtF,6FAAkF;AAClF,yDAAqD;AACrD,sFAAiF;AACjF,yFAAoF;AAEpF,uEAAkE;AASlE,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAK7B,YACY,UAAmC,EACnC,gBAAkC,EAClC,qBAA4C,EAC5C,QAAkB;QAHlB,eAAU,GAAV,UAAU,CAAyB;QACnC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,aAAQ,GAAR,QAAQ,CAAU;IAC3B,CAAC;IAMJ,mCAAmC,CAC/B,GAAmB,EACnB,gBAAoB,EACpB,OAAiC;QAEjC,OAAO,IAAI,CAAC,gBAAgB;aACvB,KAAK,CAAgB,qCAAoB,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC;aAC5D,QAAQ,CAAC,8BAA8B,EAAE,gBAAgB,CAAC;aAC1D,QAAQ,CAAC,uCAAuC,EAAE,EAAE,gBAAgB,EAAE,CAAC;aACvE,eAAe,EAAE;aACjB,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,EAAE;YAChC,OAAO;gBACH,KAAK;gBACL,UAAU;aACb,CAAC;QACN,CAAC,CAAC,CAAC;IACX,CAAC;IAOD,KAAK,CAAC,yBAAyB,CAC3B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AC,CAAC,CAAC;SACrE;QACD,OAAO,aAAa,CAAC;IACzB,CAAC;IAEO,wBAAwB,CAAC,OAAuB,EAAE,oBAA6B;QACnF,OAAO,CACH,OAAO,CAAC,cAAc,KAAK,4BAAU,CAAC,IAAI;YAC1C,CAAC,OAAO,CAAC,cAAc,KAAK,4BAAU,CAAC,OAAO,IAAI,oBAAoB,CAAC,CAC1E,CAAC;IACN,CAAC;CACJ,CAAA;AA3QY,oBAAoB;IADhC,mBAAU,EAAE;qCAOe,kDAAuB;QACjB,qCAAgB;QACX,+CAAqB;QAClC,oBAAQ;GATrB,oBAAoB,CA2QhC;AA3QY,oDAAoB"}
@@ -0,0 +1,21 @@
1
+ import { CreateTagInput, DeletionResponse, UpdateTagInput } from '@vendure/common/lib/generated-types';
2
+ import { ID, PaginatedList, Type } from '@vendure/common/lib/shared-types';
3
+ import { RequestContext } from '../../api/common/request-context';
4
+ import { ListQueryOptions, Taggable } from '../../common/types/common-types';
5
+ import { TransactionalConnection } from '../../connection/transactional-connection';
6
+ import { VendureEntity } from '../../entity/base/base.entity';
7
+ import { Tag } from '../../entity/tag/tag.entity';
8
+ import { ListQueryBuilder } from '../helpers/list-query-builder/list-query-builder';
9
+ export declare class TagService {
10
+ private connection;
11
+ private listQueryBuilder;
12
+ constructor(connection: TransactionalConnection, listQueryBuilder: ListQueryBuilder);
13
+ findAll(ctx: RequestContext, options?: ListQueryOptions<Tag>): Promise<PaginatedList<Tag>>;
14
+ findOne(ctx: RequestContext, tagId: ID): Promise<Tag | undefined>;
15
+ create(ctx: RequestContext, input: CreateTagInput): Promise<Tag>;
16
+ update(ctx: RequestContext, input: UpdateTagInput): Promise<Tag>;
17
+ delete(ctx: RequestContext, id: ID): Promise<DeletionResponse>;
18
+ valuesToTags(ctx: RequestContext, values: string[]): Promise<Tag[]>;
19
+ getTagsForEntity(ctx: RequestContext, entity: Type<VendureEntity & Taggable>, id: ID): Promise<Tag[]>;
20
+ private tagValueToTag;
21
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TagService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const generated_types_1 = require("@vendure/common/lib/generated-types");
15
+ const unique_1 = require("@vendure/common/lib/unique");
16
+ const transactional_connection_1 = require("../../connection/transactional-connection");
17
+ const tag_entity_1 = require("../../entity/tag/tag.entity");
18
+ const list_query_builder_1 = require("../helpers/list-query-builder/list-query-builder");
19
+ let TagService = class TagService {
20
+ constructor(connection, listQueryBuilder) {
21
+ this.connection = connection;
22
+ this.listQueryBuilder = listQueryBuilder;
23
+ }
24
+ findAll(ctx, options) {
25
+ return this.listQueryBuilder
26
+ .build(tag_entity_1.Tag, options, { ctx })
27
+ .getManyAndCount()
28
+ .then(([items, totalItems]) => ({
29
+ items,
30
+ totalItems,
31
+ }));
32
+ }
33
+ findOne(ctx, tagId) {
34
+ return this.connection.getRepository(ctx, tag_entity_1.Tag).findOne(tagId);
35
+ }
36
+ create(ctx, input) {
37
+ return this.tagValueToTag(ctx, input.value);
38
+ }
39
+ async update(ctx, input) {
40
+ const tag = await this.connection.getEntityOrThrow(ctx, tag_entity_1.Tag, input.id);
41
+ if (input.value) {
42
+ tag.value = input.value;
43
+ await this.connection.getRepository(ctx, tag_entity_1.Tag).save(tag);
44
+ }
45
+ return tag;
46
+ }
47
+ async delete(ctx, id) {
48
+ const tag = await this.connection.getEntityOrThrow(ctx, tag_entity_1.Tag, id);
49
+ await this.connection.getRepository(ctx, tag_entity_1.Tag).remove(tag);
50
+ return {
51
+ result: generated_types_1.DeletionResult.DELETED,
52
+ };
53
+ }
54
+ async valuesToTags(ctx, values) {
55
+ const tags = [];
56
+ for (const value of unique_1.unique(values)) {
57
+ tags.push(await this.tagValueToTag(ctx, value));
58
+ }
59
+ return tags;
60
+ }
61
+ getTagsForEntity(ctx, entity, id) {
62
+ return this.connection
63
+ .getRepository(ctx, entity)
64
+ .createQueryBuilder()
65
+ .relation(entity, 'tags')
66
+ .of(id)
67
+ .loadMany();
68
+ }
69
+ async tagValueToTag(ctx, value) {
70
+ const existing = await this.connection.getRepository(ctx, tag_entity_1.Tag).findOne({ where: { value } });
71
+ if (existing) {
72
+ return existing;
73
+ }
74
+ return await this.connection.getRepository(ctx, tag_entity_1.Tag).save(new tag_entity_1.Tag({ value }));
75
+ }
76
+ };
77
+ TagService = __decorate([
78
+ common_1.Injectable(),
79
+ __metadata("design:paramtypes", [transactional_connection_1.TransactionalConnection, list_query_builder_1.ListQueryBuilder])
80
+ ], TagService);
81
+ exports.TagService = TagService;
82
+ //# sourceMappingURL=tag.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag.service.js","sourceRoot":"","sources":["../../../src/service/services/tag.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yEAK6C;AAE7C,uDAAoD;AAIpD,wFAAoF;AAEpF,4DAAkD;AAClD,yFAAoF;AASpF,IAAa,UAAU,GAAvB,MAAa,UAAU;IACnB,YAAoB,UAAmC,EAAU,gBAAkC;QAA/E,eAAU,GAAV,UAAU,CAAyB;QAAU,qBAAgB,GAAhB,gBAAgB,CAAkB;IAAG,CAAC;IAEvG,OAAO,CAAC,GAAmB,EAAE,OAA+B;QACxD,OAAO,IAAI,CAAC,gBAAgB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common/lib/shared-types';
3
+ import { RequestContext } from '../../api/common/request-context';
4
+ import { TransactionalConnection } from '../../connection/transactional-connection';
5
+ import { TaxCategory } from '../../entity/tax-category/tax-category.entity';
6
+ import { EventBus } from '../../event-bus';
7
+ export declare class TaxCategoryService {
8
+ private connection;
9
+ private eventBus;
10
+ constructor(connection: TransactionalConnection, eventBus: EventBus);
11
+ findAll(ctx: RequestContext): Promise<TaxCategory[]>;
12
+ findOne(ctx: RequestContext, taxCategoryId: ID): Promise<TaxCategory | undefined>;
13
+ create(ctx: RequestContext, input: CreateTaxCategoryInput): Promise<TaxCategory>;
14
+ update(ctx: RequestContext, input: UpdateTaxCategoryInput): Promise<TaxCategory>;
15
+ delete(ctx: RequestContext, id: ID): Promise<DeletionResponse>;
16
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TaxCategoryService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const generated_types_1 = require("@vendure/common/lib/generated-types");
15
+ const errors_1 = require("../../common/error/errors");
16
+ const utils_1 = require("../../common/utils");
17
+ const transactional_connection_1 = require("../../connection/transactional-connection");
18
+ const tax_category_entity_1 = require("../../entity/tax-category/tax-category.entity");
19
+ const tax_rate_entity_1 = require("../../entity/tax-rate/tax-rate.entity");
20
+ const event_bus_1 = require("../../event-bus");
21
+ const tax_category_event_1 = require("../../event-bus/events/tax-category-event");
22
+ const patch_entity_1 = require("../helpers/utils/patch-entity");
23
+ let TaxCategoryService = class TaxCategoryService {
24
+ constructor(connection, eventBus) {
25
+ this.connection = connection;
26
+ this.eventBus = eventBus;
27
+ }
28
+ findAll(ctx) {
29
+ return this.connection.getRepository(ctx, tax_category_entity_1.TaxCategory).find();
30
+ }
31
+ findOne(ctx, taxCategoryId) {
32
+ return this.connection.getRepository(ctx, tax_category_entity_1.TaxCategory).findOne(taxCategoryId);
33
+ }
34
+ async create(ctx, input) {
35
+ const taxCategory = new tax_category_entity_1.TaxCategory(input);
36
+ if (input.isDefault === true) {
37
+ await this.connection
38
+ .getRepository(ctx, tax_category_entity_1.TaxCategory)
39
+ .update({ isDefault: true }, { isDefault: false });
40
+ }
41
+ const newTaxCategory = await this.connection.getRepository(ctx, tax_category_entity_1.TaxCategory).save(taxCategory);
42
+ this.eventBus.publish(new tax_category_event_1.TaxCategoryEvent(ctx, newTaxCategory, 'created', input));
43
+ return utils_1.assertFound(this.findOne(ctx, newTaxCategory.id));
44
+ }
45
+ async update(ctx, input) {
46
+ const taxCategory = await this.findOne(ctx, input.id);
47
+ if (!taxCategory) {
48
+ throw new errors_1.EntityNotFoundError('TaxCategory', input.id);
49
+ }
50
+ const updatedTaxCategory = patch_entity_1.patchEntity(taxCategory, input);
51
+ if (input.isDefault === true) {
52
+ await this.connection
53
+ .getRepository(ctx, tax_category_entity_1.TaxCategory)
54
+ .update({ isDefault: true }, { isDefault: false });
55
+ }
56
+ await this.connection.getRepository(ctx, tax_category_entity_1.TaxCategory).save(updatedTaxCategory, { reload: false });
57
+ this.eventBus.publish(new tax_category_event_1.TaxCategoryEvent(ctx, taxCategory, 'updated', input));
58
+ return utils_1.assertFound(this.findOne(ctx, taxCategory.id));
59
+ }
60
+ async delete(ctx, id) {
61
+ const taxCategory = await this.connection.getEntityOrThrow(ctx, tax_category_entity_1.TaxCategory, id);
62
+ const dependentRates = await this.connection
63
+ .getRepository(ctx, tax_rate_entity_1.TaxRate)
64
+ .count({ where: { category: id } });
65
+ if (0 < dependentRates) {
66
+ const message = ctx.translate('message.cannot-remove-tax-category-due-to-tax-rates', {
67
+ name: taxCategory.name,
68
+ count: dependentRates,
69
+ });
70
+ return {
71
+ result: generated_types_1.DeletionResult.NOT_DELETED,
72
+ message,
73
+ };
74
+ }
75
+ try {
76
+ await this.connection.getRepository(ctx, tax_category_entity_1.TaxCategory).remove(taxCategory);
77
+ this.eventBus.publish(new tax_category_event_1.TaxCategoryEvent(ctx, taxCategory, 'deleted', id));
78
+ return {
79
+ result: generated_types_1.DeletionResult.DELETED,
80
+ };
81
+ }
82
+ catch (e) {
83
+ return {
84
+ result: generated_types_1.DeletionResult.NOT_DELETED,
85
+ message: e.toString(),
86
+ };
87
+ }
88
+ }
89
+ };
90
+ TaxCategoryService = __decorate([
91
+ common_1.Injectable(),
92
+ __metadata("design:paramtypes", [transactional_connection_1.TransactionalConnection, event_bus_1.EventBus])
93
+ ], TaxCategoryService);
94
+ exports.TaxCategoryService = TaxCategoryService;
95
+ //# sourceMappingURL=tax-category.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tax-category.service.js","sourceRoot":"","sources":["../../../src/service/services/tax-category.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yEAK6C;AAI7C,sDAAgE;AAChE,8CAAiD;AACjD,wFAAoF;AACpF,uFAA4E;AAC5E,2EAAgE;AAChE,+CAA2C;AAC3C,kFAA6E;AAC7E,gEAA4D;AAS5D,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAC3B,YAAoB,UAAmC,EAAU,QAAkB;QAA/D,eAAU,GAAV,UAAU,CAAyB;QAAU,aAAQ,GAAR,QAAQ,CAAU;IAAG,CAAC;IAEvF,OAAO,CAAC,GAAmB;QACvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,G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AAI;YACA,MAAM,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,EAAE,iCAAW,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YAC1E,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,qCAAgB,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;YAC7E,OAAO;gBACH,MAAM,EAAE,gCAAc,CAAC,OAAO;aACjC,CAAC;SACL;QAAC,OAAO,CAAC,EAAE;YACR,OAAO;gBACH,MAAM,EAAE,gCAAc,CAAC,WAAW;gBAClC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;aACxB,CAAC;SACL;IACL,CAAC;CACJ,CAAA;AArEY,kBAAkB;IAD9B,mBAAU,EAAE;qCAEuB,kDAAuB,EAAoB,oBAAQ;GAD1E,kBAAkB,CAqE9B;AArEY,gDAAkB"}
@@ -0,0 +1,28 @@
1
+ import { CreateTaxRateInput, DeletionResponse, UpdateTaxRateInput } from '@vendure/common/lib/generated-types';
2
+ import { ID, PaginatedList } from '@vendure/common/lib/shared-types';
3
+ import { RequestContext } from '../../api/common/request-context';
4
+ import { RequestContextCacheService } from '../../cache';
5
+ import { ListQueryOptions } from '../../common/types/common-types';
6
+ import { TransactionalConnection } from '../../connection/transactional-connection';
7
+ import { TaxCategory } from '../../entity/tax-category/tax-category.entity';
8
+ import { TaxRate } from '../../entity/tax-rate/tax-rate.entity';
9
+ import { Zone } from '../../entity/zone/zone.entity';
10
+ import { EventBus } from '../../event-bus/event-bus';
11
+ import { ListQueryBuilder } from '../helpers/list-query-builder/list-query-builder';
12
+ export declare class TaxRateService {
13
+ private connection;
14
+ private eventBus;
15
+ private listQueryBuilder;
16
+ private cacheService;
17
+ private readonly defaultTaxRate;
18
+ constructor(connection: TransactionalConnection, eventBus: EventBus, listQueryBuilder: ListQueryBuilder, cacheService: RequestContextCacheService);
19
+ findAll(ctx: RequestContext, options?: ListQueryOptions<TaxRate>): Promise<PaginatedList<TaxRate>>;
20
+ findOne(ctx: RequestContext, taxRateId: ID): Promise<TaxRate | undefined>;
21
+ create(ctx: RequestContext, input: CreateTaxRateInput): Promise<TaxRate>;
22
+ update(ctx: RequestContext, input: UpdateTaxRateInput): Promise<TaxRate>;
23
+ delete(ctx: RequestContext, id: ID): Promise<DeletionResponse>;
24
+ getApplicableTaxRate(ctx: RequestContext, zone: Zone, taxCategory: TaxCategory): Promise<TaxRate>;
25
+ private getActiveTaxRates;
26
+ private updateActiveTaxRates;
27
+ private findActiveTaxRates;
28
+ }
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TaxRateService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const generated_types_1 = require("@vendure/common/lib/generated-types");
15
+ const cache_1 = require("../../cache");
16
+ const errors_1 = require("../../common/error/errors");
17
+ const utils_1 = require("../../common/utils");
18
+ const transactional_connection_1 = require("../../connection/transactional-connection");
19
+ const customer_group_entity_1 = require("../../entity/customer-group/customer-group.entity");
20
+ const tax_category_entity_1 = require("../../entity/tax-category/tax-category.entity");
21
+ const tax_rate_entity_1 = require("../../entity/tax-rate/tax-rate.entity");
22
+ const zone_entity_1 = require("../../entity/zone/zone.entity");
23
+ const event_bus_1 = require("../../event-bus/event-bus");
24
+ const tax_rate_event_1 = require("../../event-bus/events/tax-rate-event");
25
+ const tax_rate_modification_event_1 = require("../../event-bus/events/tax-rate-modification-event");
26
+ const list_query_builder_1 = require("../helpers/list-query-builder/list-query-builder");
27
+ const patch_entity_1 = require("../helpers/utils/patch-entity");
28
+ const activeTaxRatesKey = 'active-tax-rates';
29
+ let TaxRateService = class TaxRateService {
30
+ constructor(connection, eventBus, listQueryBuilder, cacheService) {
31
+ this.connection = connection;
32
+ this.eventBus = eventBus;
33
+ this.listQueryBuilder = listQueryBuilder;
34
+ this.cacheService = cacheService;
35
+ this.defaultTaxRate = new tax_rate_entity_1.TaxRate({
36
+ value: 0,
37
+ enabled: true,
38
+ name: 'No configured tax rate',
39
+ id: '0',
40
+ });
41
+ }
42
+ findAll(ctx, options) {
43
+ return this.listQueryBuilder
44
+ .build(tax_rate_entity_1.TaxRate, options, { relations: ['category', 'zone', 'customerGroup'], ctx })
45
+ .getManyAndCount()
46
+ .then(([items, totalItems]) => ({
47
+ items,
48
+ totalItems,
49
+ }));
50
+ }
51
+ findOne(ctx, taxRateId) {
52
+ return this.connection.getRepository(ctx, tax_rate_entity_1.TaxRate).findOne(taxRateId, {
53
+ relations: ['category', 'zone', 'customerGroup'],
54
+ });
55
+ }
56
+ async create(ctx, input) {
57
+ const taxRate = new tax_rate_entity_1.TaxRate(input);
58
+ taxRate.category = await this.connection.getEntityOrThrow(ctx, tax_category_entity_1.TaxCategory, input.categoryId);
59
+ taxRate.zone = await this.connection.getEntityOrThrow(ctx, zone_entity_1.Zone, input.zoneId);
60
+ if (input.customerGroupId) {
61
+ taxRate.customerGroup = await this.connection.getEntityOrThrow(ctx, customer_group_entity_1.CustomerGroup, input.customerGroupId);
62
+ }
63
+ const newTaxRate = await this.connection.getRepository(ctx, tax_rate_entity_1.TaxRate).save(taxRate);
64
+ await this.updateActiveTaxRates(ctx);
65
+ this.eventBus.publish(new tax_rate_modification_event_1.TaxRateModificationEvent(ctx, newTaxRate));
66
+ this.eventBus.publish(new tax_rate_event_1.TaxRateEvent(ctx, newTaxRate, 'created', input));
67
+ return utils_1.assertFound(this.findOne(ctx, newTaxRate.id));
68
+ }
69
+ async update(ctx, input) {
70
+ const taxRate = await this.findOne(ctx, input.id);
71
+ if (!taxRate) {
72
+ throw new errors_1.EntityNotFoundError('TaxRate', input.id);
73
+ }
74
+ const updatedTaxRate = patch_entity_1.patchEntity(taxRate, input);
75
+ if (input.categoryId) {
76
+ updatedTaxRate.category = await this.connection.getEntityOrThrow(ctx, tax_category_entity_1.TaxCategory, input.categoryId);
77
+ }
78
+ if (input.zoneId) {
79
+ updatedTaxRate.zone = await this.connection.getEntityOrThrow(ctx, zone_entity_1.Zone, input.zoneId);
80
+ }
81
+ if (input.customerGroupId) {
82
+ updatedTaxRate.customerGroup = await this.connection.getEntityOrThrow(ctx, customer_group_entity_1.CustomerGroup, input.customerGroupId);
83
+ }
84
+ await this.connection.getRepository(ctx, tax_rate_entity_1.TaxRate).save(updatedTaxRate, { reload: false });
85
+ await this.updateActiveTaxRates(ctx);
86
+ await this.connection.commitOpenTransaction(ctx);
87
+ this.eventBus.publish(new tax_rate_modification_event_1.TaxRateModificationEvent(ctx, updatedTaxRate));
88
+ this.eventBus.publish(new tax_rate_event_1.TaxRateEvent(ctx, updatedTaxRate, 'updated', input));
89
+ return utils_1.assertFound(this.findOne(ctx, taxRate.id));
90
+ }
91
+ async delete(ctx, id) {
92
+ const taxRate = await this.connection.getEntityOrThrow(ctx, tax_rate_entity_1.TaxRate, id);
93
+ try {
94
+ await this.connection.getRepository(ctx, tax_rate_entity_1.TaxRate).remove(taxRate);
95
+ this.eventBus.publish(new tax_rate_event_1.TaxRateEvent(ctx, taxRate, 'deleted', id));
96
+ return {
97
+ result: generated_types_1.DeletionResult.DELETED,
98
+ };
99
+ }
100
+ catch (e) {
101
+ return {
102
+ result: generated_types_1.DeletionResult.NOT_DELETED,
103
+ message: e.toString(),
104
+ };
105
+ }
106
+ }
107
+ async getApplicableTaxRate(ctx, zone, taxCategory) {
108
+ const rate = (await this.getActiveTaxRates(ctx)).find(r => r.test(zone, taxCategory));
109
+ return rate || this.defaultTaxRate;
110
+ }
111
+ async getActiveTaxRates(ctx) {
112
+ return this.cacheService.get(ctx, activeTaxRatesKey, () => this.findActiveTaxRates(ctx));
113
+ }
114
+ async updateActiveTaxRates(ctx) {
115
+ this.cacheService.set(ctx, activeTaxRatesKey, await this.findActiveTaxRates(ctx));
116
+ }
117
+ async findActiveTaxRates(ctx) {
118
+ return await this.connection.getRepository(ctx, tax_rate_entity_1.TaxRate).find({
119
+ relations: ['category', 'zone', 'customerGroup'],
120
+ where: {
121
+ enabled: true,
122
+ },
123
+ });
124
+ }
125
+ };
126
+ TaxRateService = __decorate([
127
+ common_1.Injectable(),
128
+ __metadata("design:paramtypes", [transactional_connection_1.TransactionalConnection,
129
+ event_bus_1.EventBus,
130
+ list_query_builder_1.ListQueryBuilder,
131
+ cache_1.RequestContextCacheService])
132
+ ], TaxRateService);
133
+ exports.TaxRateService = TaxRateService;
134
+ //# sourceMappingURL=tax-rate.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tax-rate.service.js","sourceRoot":"","sources":["../../../src/service/services/tax-rate.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAmE;AACnE,yEAK6C;AAI7C,uCAAyD;AACzD,sDAAgE;AAEhE,8CAAiD;AACjD,wFAAoF;AACpF,6FAAkF;AAClF,uFAA4E;AAC5E,2EAAgE;AAChE,+DAAqD;AACrD,yDAAqD;AACrD,0EAAqE;AACrE,oGAA8F;AAC9F,yFAAoF;AACpF,gEAA4D;AAE5D,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAS7C,IAAa,cAAc,GAA3B,MAAa,cAAc;IAQvB,YACY,UAAmC,EACnC,QAAkB,EAClB,gBAAkC,EAClC,YAAwC;QAHxC,eAAU,GAAV,UAAU,CAAyB;QACnC,aAAQ,GAAR,QAAQ,CAAU;Q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