@medusajs/medusa 1.1.64 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/routes/admin/collections/add-products.d.ts +32 -0
- package/dist/api/routes/admin/collections/add-products.js +107 -0
- package/dist/api/routes/admin/collections/add-products.js.map +1 -0
- package/dist/api/routes/admin/collections/index.d.ts +2 -0
- package/dist/api/routes/admin/collections/index.js +11 -1
- package/dist/api/routes/admin/collections/index.js.map +1 -1
- package/dist/api/routes/admin/collections/remove-products.d.ts +32 -0
- package/dist/api/routes/admin/collections/remove-products.js +111 -0
- package/dist/api/routes/admin/collections/remove-products.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/create-customer-group.d.ts +27 -0
- package/dist/api/routes/admin/customer-groups/create-customer-group.js +103 -0
- package/dist/api/routes/admin/customer-groups/create-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/delete-customer-group.d.ts +28 -0
- package/dist/api/routes/admin/customer-groups/delete-customer-group.js +84 -0
- package/dist/api/routes/admin/customer-groups/delete-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.d.ts +27 -0
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.js +106 -0
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group.d.ts +25 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group.js +113 -0
- package/dist/api/routes/admin/customer-groups/get-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/index.d.ts +13 -0
- package/dist/api/routes/admin/customer-groups/index.js +31 -0
- package/dist/api/routes/admin/customer-groups/index.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/update-customer-group.d.ts +28 -0
- package/dist/api/routes/admin/customer-groups/update-customer-group.js +124 -0
- package/dist/api/routes/admin/customer-groups/update-customer-group.js.map +1 -0
- package/dist/api/routes/admin/customers/get-customer.js +18 -5
- package/dist/api/routes/admin/customers/get-customer.js.map +1 -1
- package/dist/api/routes/admin/customers/index.d.ts +1 -0
- package/dist/api/routes/admin/customers/index.js +2 -0
- package/dist/api/routes/admin/customers/index.js.map +1 -1
- package/dist/api/routes/admin/customers/update-customer.d.ts +14 -0
- package/dist/api/routes/admin/customers/update-customer.js +49 -10
- package/dist/api/routes/admin/customers/update-customer.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/create-draft-order.d.ts +3 -3
- package/dist/api/routes/admin/draft-orders/create-draft-order.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/create-line-item.d.ts +1 -1
- package/dist/api/routes/admin/draft-orders/create-line-item.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/update-line-item.d.ts +1 -1
- package/dist/api/routes/admin/draft-orders/update-line-item.js.map +1 -1
- package/dist/api/routes/admin/index.js +6 -0
- package/dist/api/routes/admin/index.js.map +1 -1
- package/dist/api/routes/admin/orders/add-shipping-method.d.ts +1 -1
- package/dist/api/routes/admin/orders/add-shipping-method.js.map +1 -1
- package/dist/api/routes/admin/orders/create-claim.js +9 -1
- package/dist/api/routes/admin/orders/create-claim.js.map +1 -1
- package/dist/api/routes/admin/orders/create-swap-shipment.js +1 -0
- package/dist/api/routes/admin/orders/create-swap-shipment.js.map +1 -1
- package/dist/api/routes/admin/orders/create-swap.js +7 -1
- package/dist/api/routes/admin/orders/create-swap.js.map +1 -1
- package/dist/api/routes/admin/orders/index.d.ts +0 -1
- package/dist/api/routes/admin/orders/index.js +2 -5
- package/dist/api/routes/admin/orders/index.js.map +1 -1
- package/dist/api/routes/admin/product-types/index.d.ts +15 -0
- package/dist/api/routes/admin/product-types/index.js +40 -0
- package/dist/api/routes/admin/product-types/index.js.map +1 -0
- package/dist/api/routes/admin/product-types/list-product-types.d.ts +39 -0
- package/dist/api/routes/admin/product-types/list-product-types.js +211 -0
- package/dist/api/routes/admin/product-types/list-product-types.js.map +1 -0
- package/dist/api/routes/admin/regions/index.js +3 -0
- package/dist/api/routes/admin/regions/index.js.map +1 -1
- package/dist/api/routes/admin/regions/list-regions.d.ts +27 -3
- package/dist/api/routes/admin/regions/list-regions.js +91 -11
- package/dist/api/routes/admin/regions/list-regions.js.map +1 -1
- package/dist/api/routes/admin/regions/update-region.d.ts +12 -0
- package/dist/api/routes/admin/regions/update-region.js +24 -0
- package/dist/api/routes/admin/regions/update-region.js.map +1 -1
- package/dist/api/routes/admin/shipping-options/index.d.ts +2 -2
- package/dist/api/routes/admin/shipping-options/list-shipping-options.js +23 -7
- package/dist/api/routes/admin/shipping-options/list-shipping-options.js.map +1 -1
- package/dist/api/routes/admin/store/index.d.ts +4 -1
- package/dist/api/routes/admin/store/index.js +1 -0
- package/dist/api/routes/admin/store/index.js.map +1 -1
- package/dist/api/routes/admin/store/list-tax-providers.d.ts +22 -0
- package/dist/api/routes/admin/store/list-tax-providers.js +73 -0
- package/dist/api/routes/admin/store/list-tax-providers.js.map +1 -0
- package/dist/api/routes/admin/swaps/index.js +0 -6
- package/dist/api/routes/admin/swaps/index.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-product-types.d.ts +29 -0
- package/dist/api/routes/admin/tax-rates/add-to-product-types.js +122 -0
- package/dist/api/routes/admin/tax-rates/add-to-product-types.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/add-to-products.d.ts +29 -0
- package/dist/api/routes/admin/tax-rates/add-to-products.js +122 -0
- package/dist/api/routes/admin/tax-rates/add-to-products.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.d.ts +29 -0
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js +122 -0
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/create-tax-rate.d.ts +35 -0
- package/dist/api/routes/admin/tax-rates/create-tax-rate.js +187 -0
- package/dist/api/routes/admin/tax-rates/create-tax-rate.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/delete-tax-rate.d.ts +28 -0
- package/dist/api/routes/admin/tax-rates/delete-tax-rate.js +84 -0
- package/dist/api/routes/admin/tax-rates/delete-tax-rate.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/get-tax-rate.d.ts +26 -0
- package/dist/api/routes/admin/tax-rates/get-tax-rate.js +106 -0
- package/dist/api/routes/admin/tax-rates/get-tax-rate.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/index.d.ts +24 -0
- package/dist/api/routes/admin/tax-rates/index.js +89 -0
- package/dist/api/routes/admin/tax-rates/index.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/list-tax-rates.d.ts +44 -0
- package/dist/api/routes/admin/tax-rates/list-tax-rates.js +178 -0
- package/dist/api/routes/admin/tax-rates/list-tax-rates.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/remove-from-product-types.d.ts +29 -0
- package/dist/api/routes/admin/tax-rates/remove-from-product-types.js +122 -0
- package/dist/api/routes/admin/tax-rates/remove-from-product-types.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/remove-from-products.d.ts +29 -0
- package/dist/api/routes/admin/tax-rates/remove-from-products.js +122 -0
- package/dist/api/routes/admin/tax-rates/remove-from-products.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.d.ts +29 -0
- package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.js +122 -0
- package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/update-tax-rate.d.ts +35 -0
- package/dist/api/routes/admin/tax-rates/update-tax-rate.js +185 -0
- package/dist/api/routes/admin/tax-rates/update-tax-rate.js.map +1 -0
- package/dist/api/routes/admin/tax-rates/utils/get-query-config.d.ts +7 -0
- package/dist/api/routes/admin/tax-rates/utils/get-query-config.js +91 -0
- package/dist/api/routes/admin/tax-rates/utils/get-query-config.js.map +1 -0
- package/dist/api/routes/store/carts/add-shipping-method.d.ts +1 -1
- package/dist/api/routes/store/carts/add-shipping-method.js.map +1 -1
- package/dist/api/routes/store/carts/calculate-taxes.d.ts +24 -0
- package/dist/api/routes/store/carts/calculate-taxes.js +153 -0
- package/dist/api/routes/store/carts/calculate-taxes.js.map +1 -0
- package/dist/api/routes/store/carts/complete-cart.js +11 -247
- package/dist/api/routes/store/carts/complete-cart.js.map +1 -1
- package/dist/api/routes/store/carts/index.js +2 -0
- package/dist/api/routes/store/carts/index.js.map +1 -1
- package/dist/api/routes/store/swaps/create-swap.js +7 -1
- package/dist/api/routes/store/swaps/create-swap.js.map +1 -1
- package/dist/db-subscribers/region.d.ts +6 -0
- package/dist/db-subscribers/region.js +84 -0
- package/dist/db-subscribers/region.js.map +1 -0
- package/dist/entity-subscribers/region.d.ts +6 -0
- package/dist/entity-subscribers/region.js +27 -0
- package/dist/entity-subscribers/region.js.map +1 -0
- package/dist/helpers/test-request.js +2 -0
- package/dist/helpers/test-request.js.map +1 -1
- package/dist/index.d.ts +59 -50
- package/dist/index.js +60 -101
- package/dist/index.js.map +1 -1
- package/dist/interfaces/cart-completion-strategy.d.ts +20 -0
- package/dist/interfaces/cart-completion-strategy.js +10 -0
- package/dist/interfaces/cart-completion-strategy.js.map +1 -0
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/index.js +16 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/tax-calculation-strategy.d.ts +16 -0
- package/dist/interfaces/tax-calculation-strategy.js +10 -0
- package/dist/interfaces/tax-calculation-strategy.js.map +1 -0
- package/dist/interfaces/tax-service.d.ts +51 -0
- package/dist/interfaces/tax-service.js +3 -0
- package/dist/interfaces/tax-service.js.map +1 -0
- package/dist/loaders/db-subscribers.d.ts +6 -0
- package/dist/loaders/db-subscribers.js +53 -0
- package/dist/loaders/db-subscribers.js.map +1 -0
- package/dist/loaders/index.d.ts +2 -1
- package/dist/loaders/index.js +17 -4
- package/dist/loaders/index.js.map +1 -1
- package/dist/loaders/models.js.map +1 -1
- package/dist/loaders/passport.js.map +1 -1
- package/dist/loaders/plugins.js +26 -0
- package/dist/loaders/plugins.js.map +1 -1
- package/dist/loaders/services.d.ts +2 -1
- package/dist/loaders/services.js +9 -7
- package/dist/loaders/services.js.map +1 -1
- package/dist/loaders/strategies.d.ts +12 -0
- package/dist/loaders/strategies.js +32 -0
- package/dist/loaders/strategies.js.map +1 -0
- package/dist/migrations/1641636508055-new_tax_system.d.ts +6 -0
- package/dist/migrations/1641636508055-new_tax_system.js +248 -0
- package/dist/migrations/1641636508055-new_tax_system.js.map +1 -0
- package/dist/migrations/1644943746861-customer_groups.d.ts +6 -0
- package/dist/migrations/1644943746861-customer_groups.js +107 -0
- package/dist/migrations/1644943746861-customer_groups.js.map +1 -0
- package/dist/models/cart.d.ts +2 -1
- package/dist/models/cart.js +1 -0
- package/dist/models/cart.js.map +1 -1
- package/dist/models/customer-group.d.ts +11 -0
- package/dist/models/customer-group.js +81 -0
- package/dist/models/customer-group.js.map +1 -0
- package/dist/models/customer.d.ts +2 -0
- package/dist/models/customer.js +18 -1
- package/dist/models/customer.js.map +1 -1
- package/dist/models/line-item-tax-line.d.ts +7 -0
- package/dist/models/line-item-tax-line.js +65 -0
- package/dist/models/line-item-tax-line.js.map +1 -0
- package/dist/models/line-item.d.ts +3 -0
- package/dist/models/line-item.js +9 -0
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/order.d.ts +2 -1
- package/dist/models/order.js +3 -2
- package/dist/models/order.js.map +1 -1
- package/dist/models/product-tax-rate.d.ts +39 -0
- package/dist/models/product-tax-rate.js +86 -0
- package/dist/models/product-tax-rate.js.map +1 -0
- package/dist/models/product-type-tax-rate.d.ts +39 -0
- package/dist/models/product-type-tax-rate.js +84 -0
- package/dist/models/product-type-tax-rate.js.map +1 -0
- package/dist/models/product.d.ts +1 -1
- package/dist/models/product.js +2 -2
- package/dist/models/product.js.map +1 -1
- package/dist/models/region.d.ts +7 -0
- package/dist/models/region.js +31 -2
- package/dist/models/region.js.map +1 -1
- package/dist/models/shipping-method-tax-line.d.ts +7 -0
- package/dist/models/shipping-method-tax-line.js +65 -0
- package/dist/models/shipping-method-tax-line.js.map +1 -0
- package/dist/models/shipping-method.d.ts +2 -0
- package/dist/models/shipping-method.js +7 -0
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/shipping-tax-rate.d.ts +39 -0
- package/dist/models/shipping-tax-rate.js +84 -0
- package/dist/models/shipping-tax-rate.js.map +1 -0
- package/dist/models/swap.d.ts +1 -1
- package/dist/models/swap.js +1 -1
- package/dist/models/swap.js.map +1 -1
- package/dist/models/tax-line.d.ts +39 -0
- package/dist/models/tax-line.js +79 -0
- package/dist/models/tax-line.js.map +1 -0
- package/dist/models/tax-provider.d.ts +17 -0
- package/dist/models/tax-provider.js +44 -0
- package/dist/models/tax-provider.js.map +1 -0
- package/dist/models/tax-rate.d.ts +58 -0
- package/dist/models/tax-rate.js +159 -0
- package/dist/models/tax-rate.js.map +1 -0
- package/dist/repositories/customer-group.d.ts +5 -0
- package/dist/repositories/customer-group.js +91 -0
- package/dist/repositories/customer-group.js.map +1 -0
- package/dist/repositories/line-item-tax-line.d.ts +4 -0
- package/dist/repositories/line-item-tax-line.js +38 -0
- package/dist/repositories/line-item-tax-line.js.map +1 -0
- package/dist/repositories/line-item.d.ts +12 -0
- package/dist/repositories/line-item.js +61 -0
- package/dist/repositories/line-item.js.map +1 -1
- package/dist/repositories/money-amount.d.ts +6 -0
- package/dist/repositories/money-amount.js +97 -0
- package/dist/repositories/money-amount.js.map +1 -1
- package/dist/repositories/product-tax-rate.d.ts +4 -0
- package/dist/repositories/product-tax-rate.js +38 -0
- package/dist/repositories/product-tax-rate.js.map +1 -0
- package/dist/repositories/product.d.ts +2 -0
- package/dist/repositories/product.js +32 -0
- package/dist/repositories/product.js.map +1 -1
- package/dist/repositories/shipping-method-tax-line.d.ts +4 -0
- package/dist/repositories/shipping-method-tax-line.js +38 -0
- package/dist/repositories/shipping-method-tax-line.js.map +1 -0
- package/dist/repositories/shipping-tax-rate.d.ts +4 -0
- package/dist/repositories/shipping-tax-rate.js +38 -0
- package/dist/repositories/shipping-tax-rate.js.map +1 -0
- package/dist/repositories/tax-provider.d.ts +4 -0
- package/dist/repositories/tax-provider.js +38 -0
- package/dist/repositories/tax-provider.js.map +1 -0
- package/dist/repositories/tax-rate.d.ts +21 -0
- package/dist/repositories/tax-rate.js +434 -0
- package/dist/repositories/tax-rate.js.map +1 -0
- package/dist/services/cart.d.ts +92 -114
- package/dist/services/cart.js +142 -144
- package/dist/services/cart.js.map +1 -1
- package/dist/services/claim.d.ts +22 -33
- package/dist/services/claim.js +106 -95
- package/dist/services/claim.js.map +1 -1
- package/dist/services/customer-group.d.ts +54 -0
- package/dist/services/customer-group.js +265 -0
- package/dist/services/customer-group.js.map +1 -0
- package/dist/services/customer.d.ts +3 -1
- package/dist/services/customer.js +28 -17
- package/dist/services/customer.js.map +1 -1
- package/dist/services/fulfillment.js +1 -1
- package/dist/services/fulfillment.js.map +1 -1
- package/dist/services/gift-card.js +1 -1
- package/dist/services/gift-card.js.map +1 -1
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +9 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/invite.d.ts +3 -3
- package/dist/services/invite.js +4 -2
- package/dist/services/invite.js.map +1 -1
- package/dist/services/line-item.d.ts +12 -1
- package/dist/services/line-item.js +49 -1
- package/dist/services/line-item.js.map +1 -1
- package/dist/services/order.d.ts +6 -2
- package/dist/services/order.js +186 -80
- package/dist/services/order.js.map +1 -1
- package/dist/services/product-collection.d.ts +2 -0
- package/dist/services/product-collection.js +49 -0
- package/dist/services/product-collection.js.map +1 -1
- package/dist/services/product-tax-rate.d.ts +25 -0
- package/dist/services/product-tax-rate.js +104 -0
- package/dist/services/product-tax-rate.js.map +1 -0
- package/dist/services/product-type.d.ts +42 -0
- package/dist/services/product-type.js +156 -0
- package/dist/services/product-type.js.map +1 -0
- package/dist/services/product-variant.d.ts +2 -1
- package/dist/services/product-variant.js +96 -85
- package/dist/services/product-variant.js.map +1 -1
- package/dist/services/product.js +3 -1
- package/dist/services/product.js.map +1 -1
- package/dist/services/region.d.ts +4 -1
- package/dist/services/region.js +26 -10
- package/dist/services/region.js.map +1 -1
- package/dist/services/return.d.ts +3 -1
- package/dist/services/return.js +37 -26
- package/dist/services/return.js.map +1 -1
- package/dist/services/shipping-option.d.ts +7 -4
- package/dist/services/shipping-option.js +22 -5
- package/dist/services/shipping-option.js.map +1 -1
- package/dist/services/shipping-tax-rate.d.ts +26 -0
- package/dist/services/shipping-tax-rate.js +105 -0
- package/dist/services/shipping-tax-rate.js.map +1 -0
- package/dist/services/swap.d.ts +5 -22
- package/dist/services/swap.js +308 -454
- package/dist/services/swap.js.map +1 -1
- package/dist/services/system-tax.d.ts +9 -0
- package/dist/services/system-tax.js +89 -0
- package/dist/services/system-tax.js.map +1 -0
- package/dist/services/tax-provider.d.ts +108 -0
- package/dist/services/tax-provider.js +465 -0
- package/dist/services/tax-provider.js.map +1 -0
- package/dist/services/tax-rate.d.ts +38 -0
- package/dist/services/tax-rate.js +599 -0
- package/dist/services/tax-rate.js.map +1 -0
- package/dist/services/totals.d.ts +194 -59
- package/dist/services/totals.js +581 -106
- package/dist/services/totals.js.map +1 -1
- package/dist/strategies/cart-completion.d.ts +17 -0
- package/dist/strategies/cart-completion.js +336 -0
- package/dist/strategies/cart-completion.js.map +1 -0
- package/dist/strategies/tax-calculation.d.ts +11 -0
- package/dist/strategies/tax-calculation.js +147 -0
- package/dist/strategies/tax-calculation.js.map +1 -0
- package/dist/subscribers/region.d.ts +14 -0
- package/dist/subscribers/region.js +65 -0
- package/dist/subscribers/region.js.map +1 -0
- package/dist/types/cart.d.ts +2 -1
- package/dist/types/cart.js +6 -1
- package/dist/types/cart.js.map +1 -1
- package/dist/types/common.d.ts +5 -1
- package/dist/types/common.js +22 -7
- package/dist/types/common.js.map +1 -1
- package/dist/types/customer-groups.d.ts +11 -0
- package/dist/types/customer-groups.js +43 -0
- package/dist/types/customer-groups.js.map +1 -0
- package/dist/types/orders.d.ts +2 -0
- package/dist/types/orders.js +6 -1
- package/dist/types/orders.js.map +1 -1
- package/dist/types/product-tax-rate.d.ts +10 -0
- package/dist/types/product-tax-rate.js +13 -0
- package/dist/types/product-tax-rate.js.map +1 -0
- package/dist/types/product.d.ts +6 -0
- package/dist/types/product.js +25 -1
- package/dist/types/product.js.map +1 -1
- package/dist/types/request.d.ts +3 -0
- package/dist/types/request.js +3 -0
- package/dist/types/request.js.map +1 -0
- package/dist/types/shipping-tax-rate.d.ts +10 -0
- package/dist/types/shipping-tax-rate.js +13 -0
- package/dist/types/shipping-tax-rate.js.map +1 -0
- package/dist/types/tax-rate.d.ts +25 -0
- package/dist/types/tax-rate.js +3 -0
- package/dist/types/tax-rate.js.map +1 -0
- package/dist/types/tax-service.d.ts +34 -0
- package/dist/types/tax-service.js +3 -0
- package/dist/types/tax-service.js.map +1 -0
- package/dist/types/totals.d.ts +42 -0
- package/dist/types/totals.js +3 -0
- package/dist/types/totals.js.map +1 -0
- package/dist/utils/format-registration-name.js +3 -0
- package/dist/utils/format-registration-name.js.map +1 -1
- package/package.json +5 -4
- package/yarn-error.log +5 -79
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var __values = (this && this.__values) || function(o) {
|
|
54
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
55
|
+
if (m) return m.call(o);
|
|
56
|
+
if (o && typeof o.length === "number") return {
|
|
57
|
+
next: function () {
|
|
58
|
+
if (o && i >= o.length) o = void 0;
|
|
59
|
+
return { value: o && o[i++], done: !o };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
63
|
+
};
|
|
64
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
65
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
66
|
+
if (!m) return o;
|
|
67
|
+
var i = m.call(o), r, ar = [], e;
|
|
68
|
+
try {
|
|
69
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
70
|
+
}
|
|
71
|
+
catch (error) { e = { error: error }; }
|
|
72
|
+
finally {
|
|
73
|
+
try {
|
|
74
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
75
|
+
}
|
|
76
|
+
finally { if (e) throw e.error; }
|
|
77
|
+
}
|
|
78
|
+
return ar;
|
|
79
|
+
};
|
|
80
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
81
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
82
|
+
if (ar || !(i in from)) {
|
|
83
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
84
|
+
ar[i] = from[i];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
88
|
+
};
|
|
89
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
90
|
+
var medusa_interfaces_1 = require("medusa-interfaces");
|
|
91
|
+
var medusa_core_utils_1 = require("medusa-core-utils");
|
|
92
|
+
var TaxRateService = /** @class */ (function (_super) {
|
|
93
|
+
__extends(TaxRateService, _super);
|
|
94
|
+
function TaxRateService(_a) {
|
|
95
|
+
var manager = _a.manager, productService = _a.productService, productTypeService = _a.productTypeService, shippingOptionService = _a.shippingOptionService, taxRateRepository = _a.taxRateRepository;
|
|
96
|
+
var _this = _super.call(this) || this;
|
|
97
|
+
_this.manager_ = manager;
|
|
98
|
+
_this.taxRateRepository_ = taxRateRepository;
|
|
99
|
+
_this.productService_ = productService;
|
|
100
|
+
_this.productTypeService_ = productTypeService;
|
|
101
|
+
_this.shippingOptionService_ = shippingOptionService;
|
|
102
|
+
return _this;
|
|
103
|
+
}
|
|
104
|
+
TaxRateService.prototype.withTransaction = function (transactionManager) {
|
|
105
|
+
if (!transactionManager) {
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
var cloned = new TaxRateService({
|
|
109
|
+
manager: transactionManager,
|
|
110
|
+
taxRateRepository: this.taxRateRepository_,
|
|
111
|
+
productService: this.productService_,
|
|
112
|
+
productTypeService: this.productTypeService_,
|
|
113
|
+
shippingOptionService: this.shippingOptionService_,
|
|
114
|
+
});
|
|
115
|
+
cloned.transactionManager_ = transactionManager;
|
|
116
|
+
cloned.manager_ = transactionManager;
|
|
117
|
+
return cloned;
|
|
118
|
+
};
|
|
119
|
+
TaxRateService.prototype.list = function (selector, config) {
|
|
120
|
+
if (config === void 0) { config = {}; }
|
|
121
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
+
var taxRateRepo, query;
|
|
123
|
+
return __generator(this, function (_a) {
|
|
124
|
+
switch (_a.label) {
|
|
125
|
+
case 0:
|
|
126
|
+
taxRateRepo = this.manager_.getCustomRepository(this.taxRateRepository_);
|
|
127
|
+
query = this.buildQuery_(selector, config);
|
|
128
|
+
return [4 /*yield*/, taxRateRepo.findWithResolution(query)];
|
|
129
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
TaxRateService.prototype.listAndCount = function (selector, config) {
|
|
135
|
+
if (config === void 0) { config = {}; }
|
|
136
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
+
var taxRateRepo, query;
|
|
138
|
+
return __generator(this, function (_a) {
|
|
139
|
+
switch (_a.label) {
|
|
140
|
+
case 0:
|
|
141
|
+
taxRateRepo = this.manager_.getCustomRepository(this.taxRateRepository_);
|
|
142
|
+
query = this.buildQuery_(selector, config);
|
|
143
|
+
return [4 /*yield*/, taxRateRepo.findAndCountWithResolution(query)];
|
|
144
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
TaxRateService.prototype.retrieve = function (id, config) {
|
|
150
|
+
if (config === void 0) { config = {}; }
|
|
151
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
152
|
+
var _this = this;
|
|
153
|
+
return __generator(this, function (_a) {
|
|
154
|
+
switch (_a.label) {
|
|
155
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
156
|
+
var taxRateRepo, query, taxRate;
|
|
157
|
+
return __generator(this, function (_a) {
|
|
158
|
+
switch (_a.label) {
|
|
159
|
+
case 0:
|
|
160
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
161
|
+
query = this.buildQuery_({ id: id }, config);
|
|
162
|
+
return [4 /*yield*/, taxRateRepo.findOneWithResolution(query)];
|
|
163
|
+
case 1:
|
|
164
|
+
taxRate = _a.sent();
|
|
165
|
+
if (!taxRate) {
|
|
166
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "TaxRate with ".concat(id, " was not found"));
|
|
167
|
+
}
|
|
168
|
+
return [2 /*return*/, taxRate];
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}); })];
|
|
172
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
TaxRateService.prototype.create = function (data) {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
179
|
+
var _this = this;
|
|
180
|
+
return __generator(this, function (_a) {
|
|
181
|
+
switch (_a.label) {
|
|
182
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
183
|
+
var taxRateRepo, taxRate;
|
|
184
|
+
return __generator(this, function (_a) {
|
|
185
|
+
switch (_a.label) {
|
|
186
|
+
case 0:
|
|
187
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
188
|
+
if (typeof data.region_id === "undefined") {
|
|
189
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.INVALID_DATA, "TaxRates must belong to a Region");
|
|
190
|
+
}
|
|
191
|
+
taxRate = taxRateRepo.create(data);
|
|
192
|
+
return [4 /*yield*/, taxRateRepo.save(taxRate)];
|
|
193
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}); })];
|
|
197
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
TaxRateService.prototype.update = function (id, data) {
|
|
203
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
204
|
+
var _this = this;
|
|
205
|
+
return __generator(this, function (_a) {
|
|
206
|
+
switch (_a.label) {
|
|
207
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
208
|
+
var taxRateRepo, taxRate, _a, _b, _c, k, v;
|
|
209
|
+
var e_1, _d;
|
|
210
|
+
return __generator(this, function (_e) {
|
|
211
|
+
switch (_e.label) {
|
|
212
|
+
case 0:
|
|
213
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
214
|
+
return [4 /*yield*/, this.retrieve(id)];
|
|
215
|
+
case 1:
|
|
216
|
+
taxRate = _e.sent();
|
|
217
|
+
try {
|
|
218
|
+
for (_a = __values(Object.entries(data)), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
219
|
+
_c = __read(_b.value, 2), k = _c[0], v = _c[1];
|
|
220
|
+
if (typeof v !== "undefined") {
|
|
221
|
+
taxRate[k] = v;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
226
|
+
finally {
|
|
227
|
+
try {
|
|
228
|
+
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
229
|
+
}
|
|
230
|
+
finally { if (e_1) throw e_1.error; }
|
|
231
|
+
}
|
|
232
|
+
return [4 /*yield*/, taxRateRepo.save(taxRate)];
|
|
233
|
+
case 2: return [2 /*return*/, _e.sent()];
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}); })];
|
|
237
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
TaxRateService.prototype.delete = function (id) {
|
|
243
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
244
|
+
var _this = this;
|
|
245
|
+
return __generator(this, function (_a) {
|
|
246
|
+
switch (_a.label) {
|
|
247
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
248
|
+
var taxRateRepo, query;
|
|
249
|
+
return __generator(this, function (_a) {
|
|
250
|
+
switch (_a.label) {
|
|
251
|
+
case 0:
|
|
252
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
253
|
+
query = this.buildQuery_({ id: id });
|
|
254
|
+
return [4 /*yield*/, taxRateRepo.delete(query.where)];
|
|
255
|
+
case 1:
|
|
256
|
+
_a.sent();
|
|
257
|
+
return [2 /*return*/];
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}); })];
|
|
261
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
TaxRateService.prototype.removeFromProduct = function (id, productIds) {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
268
|
+
var _this = this;
|
|
269
|
+
return __generator(this, function (_a) {
|
|
270
|
+
switch (_a.label) {
|
|
271
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
272
|
+
var taxRateRepo, ids;
|
|
273
|
+
return __generator(this, function (_a) {
|
|
274
|
+
switch (_a.label) {
|
|
275
|
+
case 0:
|
|
276
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
277
|
+
if (typeof productIds === "string") {
|
|
278
|
+
ids = [productIds];
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
ids = productIds;
|
|
282
|
+
}
|
|
283
|
+
return [4 /*yield*/, taxRateRepo.removeFromProduct(id, ids)];
|
|
284
|
+
case 1:
|
|
285
|
+
_a.sent();
|
|
286
|
+
return [2 /*return*/];
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}); })];
|
|
290
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
TaxRateService.prototype.removeFromProductType = function (id, typeIds) {
|
|
296
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
297
|
+
var _this = this;
|
|
298
|
+
return __generator(this, function (_a) {
|
|
299
|
+
switch (_a.label) {
|
|
300
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
301
|
+
var taxRateRepo, ids;
|
|
302
|
+
return __generator(this, function (_a) {
|
|
303
|
+
switch (_a.label) {
|
|
304
|
+
case 0:
|
|
305
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
306
|
+
if (typeof typeIds === "string") {
|
|
307
|
+
ids = [typeIds];
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
ids = typeIds;
|
|
311
|
+
}
|
|
312
|
+
return [4 /*yield*/, taxRateRepo.removeFromProductType(id, ids)];
|
|
313
|
+
case 1:
|
|
314
|
+
_a.sent();
|
|
315
|
+
return [2 /*return*/];
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}); })];
|
|
319
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
TaxRateService.prototype.removeFromShippingOption = function (id, optionIds) {
|
|
325
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
326
|
+
var _this = this;
|
|
327
|
+
return __generator(this, function (_a) {
|
|
328
|
+
switch (_a.label) {
|
|
329
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
330
|
+
var taxRateRepo, ids;
|
|
331
|
+
return __generator(this, function (_a) {
|
|
332
|
+
switch (_a.label) {
|
|
333
|
+
case 0:
|
|
334
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
335
|
+
if (typeof optionIds === "string") {
|
|
336
|
+
ids = [optionIds];
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
ids = optionIds;
|
|
340
|
+
}
|
|
341
|
+
return [4 /*yield*/, taxRateRepo.removeFromShippingOption(id, ids)];
|
|
342
|
+
case 1:
|
|
343
|
+
_a.sent();
|
|
344
|
+
return [2 /*return*/];
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}); })];
|
|
348
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
TaxRateService.prototype.addToProduct = function (id, productIds, replace) {
|
|
354
|
+
if (replace === void 0) { replace = false; }
|
|
355
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
356
|
+
var ids, result;
|
|
357
|
+
var _this = this;
|
|
358
|
+
return __generator(this, function (_a) {
|
|
359
|
+
switch (_a.label) {
|
|
360
|
+
case 0:
|
|
361
|
+
if (typeof productIds === "string") {
|
|
362
|
+
ids = [productIds];
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
ids = productIds;
|
|
366
|
+
}
|
|
367
|
+
return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
368
|
+
var taxRateRepo;
|
|
369
|
+
return __generator(this, function (_a) {
|
|
370
|
+
switch (_a.label) {
|
|
371
|
+
case 0:
|
|
372
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
373
|
+
return [4 /*yield*/, taxRateRepo.addToProduct(id, ids, replace)];
|
|
374
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}); },
|
|
378
|
+
// eslint-disable-next-line
|
|
379
|
+
function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
380
|
+
var _this = this;
|
|
381
|
+
return __generator(this, function (_a) {
|
|
382
|
+
switch (_a.label) {
|
|
383
|
+
case 0:
|
|
384
|
+
if (!(err.code === "23503")) return [3 /*break*/, 2];
|
|
385
|
+
// A foreign key constraint failed meaning some thing doesn't exist
|
|
386
|
+
// either it is a product or the tax rate itself. Using Promise.all
|
|
387
|
+
// will try to retrieve all of the resources and will fail when
|
|
388
|
+
// something is not found.
|
|
389
|
+
return [4 /*yield*/, Promise.all(__spreadArray([
|
|
390
|
+
this.retrieve(id, { select: ["id"] })
|
|
391
|
+
], __read(ids.map(function (pId) {
|
|
392
|
+
return _this.productService_.retrieve(pId, { select: ["id"] });
|
|
393
|
+
})), false))];
|
|
394
|
+
case 1:
|
|
395
|
+
// A foreign key constraint failed meaning some thing doesn't exist
|
|
396
|
+
// either it is a product or the tax rate itself. Using Promise.all
|
|
397
|
+
// will try to retrieve all of the resources and will fail when
|
|
398
|
+
// something is not found.
|
|
399
|
+
_a.sent();
|
|
400
|
+
_a.label = 2;
|
|
401
|
+
case 2: return [2 /*return*/];
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
}); })];
|
|
405
|
+
case 1:
|
|
406
|
+
result = _a.sent();
|
|
407
|
+
return [2 /*return*/, result];
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
TaxRateService.prototype.addToProductType = function (id, productTypeIds, replace) {
|
|
413
|
+
if (replace === void 0) { replace = false; }
|
|
414
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
415
|
+
var ids;
|
|
416
|
+
var _this = this;
|
|
417
|
+
return __generator(this, function (_a) {
|
|
418
|
+
switch (_a.label) {
|
|
419
|
+
case 0:
|
|
420
|
+
if (typeof productTypeIds === "string") {
|
|
421
|
+
ids = [productTypeIds];
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
ids = productTypeIds;
|
|
425
|
+
}
|
|
426
|
+
return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
427
|
+
var taxRateRepo;
|
|
428
|
+
return __generator(this, function (_a) {
|
|
429
|
+
switch (_a.label) {
|
|
430
|
+
case 0:
|
|
431
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
432
|
+
return [4 /*yield*/, taxRateRepo.addToProductType(id, ids, replace)];
|
|
433
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
}); },
|
|
437
|
+
// eslint-disable-next-line
|
|
438
|
+
function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
439
|
+
var _this = this;
|
|
440
|
+
return __generator(this, function (_a) {
|
|
441
|
+
switch (_a.label) {
|
|
442
|
+
case 0:
|
|
443
|
+
if (!(err.code === "23503")) return [3 /*break*/, 2];
|
|
444
|
+
// A foreign key constraint failed meaning some thing doesn't exist
|
|
445
|
+
// either it is a product or the tax rate itself. Using Promise.all
|
|
446
|
+
// will try to retrieve all of the resources and will fail when
|
|
447
|
+
// something is not found.
|
|
448
|
+
return [4 /*yield*/, Promise.all(__spreadArray([
|
|
449
|
+
this.retrieve(id, {
|
|
450
|
+
select: ["id"],
|
|
451
|
+
})
|
|
452
|
+
], __read(ids.map(function (pId) {
|
|
453
|
+
return _this.productTypeService_.retrieve(pId, {
|
|
454
|
+
select: ["id"],
|
|
455
|
+
});
|
|
456
|
+
})), false))];
|
|
457
|
+
case 1:
|
|
458
|
+
// A foreign key constraint failed meaning some thing doesn't exist
|
|
459
|
+
// either it is a product or the tax rate itself. Using Promise.all
|
|
460
|
+
// will try to retrieve all of the resources and will fail when
|
|
461
|
+
// something is not found.
|
|
462
|
+
_a.sent();
|
|
463
|
+
_a.label = 2;
|
|
464
|
+
case 2: return [2 /*return*/];
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
}); })];
|
|
468
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
};
|
|
473
|
+
TaxRateService.prototype.addToShippingOption = function (id, optionIds, replace) {
|
|
474
|
+
if (replace === void 0) { replace = false; }
|
|
475
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
476
|
+
var ids;
|
|
477
|
+
var _this = this;
|
|
478
|
+
return __generator(this, function (_a) {
|
|
479
|
+
switch (_a.label) {
|
|
480
|
+
case 0:
|
|
481
|
+
if (typeof optionIds === "string") {
|
|
482
|
+
ids = [optionIds];
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
ids = optionIds;
|
|
486
|
+
}
|
|
487
|
+
return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
488
|
+
var taxRateRepo, taxRate, options, options_1, options_1_1, o;
|
|
489
|
+
var e_2, _a;
|
|
490
|
+
return __generator(this, function (_b) {
|
|
491
|
+
switch (_b.label) {
|
|
492
|
+
case 0:
|
|
493
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
494
|
+
return [4 /*yield*/, this.retrieve(id, { select: ["id", "region_id"] })];
|
|
495
|
+
case 1:
|
|
496
|
+
taxRate = _b.sent();
|
|
497
|
+
return [4 /*yield*/, this.shippingOptionService_.list({ id: ids }, { select: ["id", "region_id"] })];
|
|
498
|
+
case 2:
|
|
499
|
+
options = _b.sent();
|
|
500
|
+
try {
|
|
501
|
+
for (options_1 = __values(options), options_1_1 = options_1.next(); !options_1_1.done; options_1_1 = options_1.next()) {
|
|
502
|
+
o = options_1_1.value;
|
|
503
|
+
if (o.region_id !== taxRate.region_id) {
|
|
504
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_ALLOWED, "Shipping Option and Tax Rate must belong to the same Region to be associated. Shipping Option with id: ".concat(o.id, " belongs to Region with id: ").concat(o.region_id, " and Tax Rate with id: ").concat(taxRate.id, " belongs to Region with id: ").concat(taxRate.region_id));
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
509
|
+
finally {
|
|
510
|
+
try {
|
|
511
|
+
if (options_1_1 && !options_1_1.done && (_a = options_1.return)) _a.call(options_1);
|
|
512
|
+
}
|
|
513
|
+
finally { if (e_2) throw e_2.error; }
|
|
514
|
+
}
|
|
515
|
+
return [4 /*yield*/, taxRateRepo.addToShippingOption(id, ids, replace)];
|
|
516
|
+
case 3: return [2 /*return*/, _b.sent()];
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
}); },
|
|
520
|
+
// eslint-disable-next-line
|
|
521
|
+
function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
522
|
+
var _this = this;
|
|
523
|
+
return __generator(this, function (_a) {
|
|
524
|
+
switch (_a.label) {
|
|
525
|
+
case 0:
|
|
526
|
+
if (!(err.code === "23503")) return [3 /*break*/, 2];
|
|
527
|
+
// A foreign key constraint failed meaning some thing doesn't exist
|
|
528
|
+
// either it is a product or the tax rate itself. Using Promise.all
|
|
529
|
+
// will try to retrieve all of the resources and will fail when
|
|
530
|
+
// something is not found.
|
|
531
|
+
return [4 /*yield*/, Promise.all(__spreadArray([
|
|
532
|
+
this.retrieve(id, { select: ["id"] })
|
|
533
|
+
], __read(ids.map(function (sId) {
|
|
534
|
+
return _this.shippingOptionService_.retrieve(sId, { select: ["id"] });
|
|
535
|
+
})), false))];
|
|
536
|
+
case 1:
|
|
537
|
+
// A foreign key constraint failed meaning some thing doesn't exist
|
|
538
|
+
// either it is a product or the tax rate itself. Using Promise.all
|
|
539
|
+
// will try to retrieve all of the resources and will fail when
|
|
540
|
+
// something is not found.
|
|
541
|
+
_a.sent();
|
|
542
|
+
_a.label = 2;
|
|
543
|
+
case 2: return [2 /*return*/];
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
}); })];
|
|
547
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
TaxRateService.prototype.listByProduct = function (productId, config) {
|
|
553
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
554
|
+
var _this = this;
|
|
555
|
+
return __generator(this, function (_a) {
|
|
556
|
+
switch (_a.label) {
|
|
557
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
558
|
+
var taxRateRepo;
|
|
559
|
+
return __generator(this, function (_a) {
|
|
560
|
+
switch (_a.label) {
|
|
561
|
+
case 0:
|
|
562
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
563
|
+
return [4 /*yield*/, taxRateRepo.listByProduct(productId, config)];
|
|
564
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
}); })];
|
|
568
|
+
case 1:
|
|
569
|
+
// Check both ProductTaxRate + ProductTypeTaxRate
|
|
570
|
+
return [2 /*return*/, _a.sent()];
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
});
|
|
574
|
+
};
|
|
575
|
+
TaxRateService.prototype.listByShippingOption = function (shippingOptionId, config) {
|
|
576
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
577
|
+
var _this = this;
|
|
578
|
+
return __generator(this, function (_a) {
|
|
579
|
+
switch (_a.label) {
|
|
580
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
581
|
+
var taxRateRepo;
|
|
582
|
+
return __generator(this, function (_a) {
|
|
583
|
+
switch (_a.label) {
|
|
584
|
+
case 0:
|
|
585
|
+
taxRateRepo = manager.getCustomRepository(this.taxRateRepository_);
|
|
586
|
+
return [4 /*yield*/, taxRateRepo.listByShippingOption(shippingOptionId, config)];
|
|
587
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
}); })];
|
|
591
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
});
|
|
595
|
+
};
|
|
596
|
+
return TaxRateService;
|
|
597
|
+
}(medusa_interfaces_1.BaseService));
|
|
598
|
+
exports.default = TaxRateService;
|
|
599
|
+
//# sourceMappingURL=tax-rate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tax-rate.js","sourceRoot":"","sources":["../../src/services/tax-rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA+C;AAE/C,uDAA+C;AAiB/C;IAA6B,kCAAW;IAOtC,wBAAY,EAMX;YALC,OAAO,aAAA,EACP,cAAc,oBAAA,EACd,kBAAkB,wBAAA,EAClB,qBAAqB,2BAAA,EACrB,iBAAiB,uBAAA;QALnB,YAOE,iBAAO,SAOR;QALC,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,KAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAA;QAC3C,KAAI,CAAC,eAAe,GAAG,cAAc,CAAA;QACrC,KAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAA;QAC7C,KAAI,CAAC,sBAAsB,GAAG,qBAAqB,CAAA;;IACrD,CAAC;IAED,wCAAe,GAAf,UAAgB,kBAAiC;QAC/C,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,IAAI,CAAA;SACZ;QAED,IAAM,MAAM,GAAG,IAAI,cAAc,CAAC;YAChC,OAAO,EAAE,kBAAkB;YAC3B,iBAAiB,EAAE,IAAI,CAAC,kBAAkB;YAC1C,cAAc,EAAE,IAAI,CAAC,eAAe;YACpC,kBAAkB,EAAE,IAAI,CAAC,mBAAmB;YAC5C,qBAAqB,EAAE,IAAI,CAAC,sBAAsB;SACnD,CAAC,CAAA;QAEF,MAAM,CAAC,mBAAmB,GAAG,kB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