@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-collection.js","sourceRoot":"","sources":["../../src/services/product-collection.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA+C;AAC/C,uDAA+C;AAC/C,mCAAyC;AAEzC;;;GAGG;AACH;IAAuC,4CAAW;IAChD,kCAAY,EAKX;YAJC,OAAO,aAAA,EACP,2BAA2B,iCAAA,EAC3B,iBAAiB,uBAAA,EACjB,eAAe,qBAAA;QAJjB,YAME,iBAAO,SAaR;QAXC,sCAAsC;QACtC,KAAI,CAAC,QAAQ,GAAG,OAAO,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K,GAAG,UAAC,EAAE;gCACf,EAAE,CAAC,KAAK,CAAC,OAAK,CAAC,CAAA;gCAEf,EAAE,CAAC,QAAQ,CACT,IAAI,kBAAQ,CAAC,UAAC,EAAE;oCACd,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAA,eAAK,EAAC,WAAI,CAAC,MAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;wCAC3C,MAAM,EAAE,IAAA,eAAK,EAAC,WAAI,CAAC,MAAG,CAAC;qCACxB,CAAC,CAAA;gCACJ,CAAC,CAAC,CACH,CAAA;4BACH,CAAC,CAAA;yBACF;wBAEM,qBAAM,qBAAqB,CAAC,YAAY,CAAC,KAAK,CAAC,EAAA;4BAAtD,sBAAO,SAA+C,EAAA;;;;KACvD;IACH,+BAAC;AAAD,CAAC,AA/OD,CAAuC,+BAAW,GA+OjD;AAED,kBAAe,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseService } from "medusa-interfaces";
|
|
2
|
+
import { EntityManager } from "typeorm";
|
|
3
|
+
import { ProductTaxRate } from "../models/product-tax-rate";
|
|
4
|
+
import { FindConfig } from "../types/common";
|
|
5
|
+
import { FilterableProductTaxRateProps } from "../types/product-tax-rate";
|
|
6
|
+
/**
|
|
7
|
+
* Provides layer to manipulate product variants.
|
|
8
|
+
* @extends BaseService
|
|
9
|
+
*/
|
|
10
|
+
declare class ProductTaxRateService extends BaseService {
|
|
11
|
+
private manager_;
|
|
12
|
+
private productTaxRateRepository_;
|
|
13
|
+
constructor({ manager, productTaxRateRepository }: {
|
|
14
|
+
manager: any;
|
|
15
|
+
productTaxRateRepository: any;
|
|
16
|
+
});
|
|
17
|
+
withTransaction(transactionManager: EntityManager): ProductTaxRateService;
|
|
18
|
+
/**
|
|
19
|
+
* @param {FilterableProductVariantProps} selector - the query object for find
|
|
20
|
+
* @param {FindConfig<ProductVariant>} config - query config object for variant retrieval
|
|
21
|
+
* @return {Promise} the result of the find operation
|
|
22
|
+
*/
|
|
23
|
+
list(selector: FilterableProductTaxRateProps, config?: FindConfig<ProductTaxRate>): Promise<ProductTaxRate[]>;
|
|
24
|
+
}
|
|
25
|
+
export default ProductTaxRateService;
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
var medusa_interfaces_1 = require("medusa-interfaces");
|
|
55
|
+
/**
|
|
56
|
+
* Provides layer to manipulate product variants.
|
|
57
|
+
* @extends BaseService
|
|
58
|
+
*/
|
|
59
|
+
var ProductTaxRateService = /** @class */ (function (_super) {
|
|
60
|
+
__extends(ProductTaxRateService, _super);
|
|
61
|
+
function ProductTaxRateService(_a) {
|
|
62
|
+
var manager = _a.manager, productTaxRateRepository = _a.productTaxRateRepository;
|
|
63
|
+
var _this = _super.call(this) || this;
|
|
64
|
+
/** @private @const {EntityManager} */
|
|
65
|
+
_this.manager_ = manager;
|
|
66
|
+
/** @private @const {ProductVariantModel} */
|
|
67
|
+
_this.productTaxRateRepository_ = productTaxRateRepository;
|
|
68
|
+
return _this;
|
|
69
|
+
}
|
|
70
|
+
ProductTaxRateService.prototype.withTransaction = function (transactionManager) {
|
|
71
|
+
if (!transactionManager) {
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
var cloned = new ProductTaxRateService({
|
|
75
|
+
manager: transactionManager,
|
|
76
|
+
productTaxRateRepository: this.productTaxRateRepository_,
|
|
77
|
+
});
|
|
78
|
+
cloned.transactionManager_ = transactionManager;
|
|
79
|
+
return cloned;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* @param {FilterableProductVariantProps} selector - the query object for find
|
|
83
|
+
* @param {FindConfig<ProductVariant>} config - query config object for variant retrieval
|
|
84
|
+
* @return {Promise} the result of the find operation
|
|
85
|
+
*/
|
|
86
|
+
ProductTaxRateService.prototype.list = function (selector, config) {
|
|
87
|
+
if (config === void 0) { config = { relations: [], skip: 0, take: 20 }; }
|
|
88
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
+
var pTaxRateRepo, query;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0:
|
|
93
|
+
pTaxRateRepo = this.manager_.getCustomRepository(this.productTaxRateRepository_);
|
|
94
|
+
query = this.buildQuery_(selector, config);
|
|
95
|
+
return [4 /*yield*/, pTaxRateRepo.find(query)];
|
|
96
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
return ProductTaxRateService;
|
|
102
|
+
}(medusa_interfaces_1.BaseService));
|
|
103
|
+
exports.default = ProductTaxRateService;
|
|
104
|
+
//# sourceMappingURL=product-tax-rate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-tax-rate.js","sourceRoot":"","sources":["../../src/services/product-tax-rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA+C;AAO/C;;;GAGG;AACH;IAAoC,yCAAW;IAI7C,+BAAY,EAAqC;YAAnC,OAAO,aAAA,EAAE,wBAAwB,8BAAA;QAA/C,YACE,iBAAO,SAOR;QALC,sCAAsC;QACtC,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QAEvB,4CAA4C;QAC5C,KAAI,CAAC,yBAAyB,GAAG,wBAAwB,CAAA;;IAC3D,CAAC;IAED,+CAAe,GAAf,UAAgB,kBAAiC;QAC/C,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,IAAI,CAAA;SACZ;QAED,IAAM,MAAM,GAAG,IAAI,qBAAqB,CAAC;YACvC,OAAO,EAAE,kBAAkB;YAC3B,wBAAwB,EAAE,IAAI,CAAC,yBAAyB;SACzD,CAAC,CAAA;QAEF,MAAM,CAAC,mBAAmB,GAAG,kBAAkB,CAAA;QAE/C,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;;;OAIG;IACG,oCAAI,GAAV,UACE,QAAuC,EACvC,MAAyE;QAAzE,uBAAA,EAAA,WAAuC,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;;;;;;wBAEnE,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CACpD,IAAI,CAAC,yBAAyB,CAC/B,CAAA;wBAEK,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;wBAEzC,qBAAM,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAA;4BAArC,sBAAO,SAA8B,EAAA;;;;KACtC;IACH,4BAAC;AAAD,CAAC,AA9CD,CAAoC,+BAAW,GA8C9C;AAED,kBAAe,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseService } from "medusa-interfaces";
|
|
2
|
+
import { EntityManager } from "typeorm";
|
|
3
|
+
import { FindConfig } from "../types/common";
|
|
4
|
+
import { FilterableProductTypeProps } from "../types/product";
|
|
5
|
+
import { ProductType } from "../models/product-type";
|
|
6
|
+
/**
|
|
7
|
+
* Provides layer to manipulate products.
|
|
8
|
+
* @extends BaseService
|
|
9
|
+
*/
|
|
10
|
+
declare class ProductTypeService extends BaseService {
|
|
11
|
+
private manager_;
|
|
12
|
+
private typeRepository_;
|
|
13
|
+
constructor({ manager, productTypeRepository }: {
|
|
14
|
+
manager: any;
|
|
15
|
+
productTypeRepository: any;
|
|
16
|
+
});
|
|
17
|
+
withTransaction(transactionManager: EntityManager): ProductTypeService;
|
|
18
|
+
/**
|
|
19
|
+
* Gets a product by id.
|
|
20
|
+
* Throws in case of DB Error and if product was not found.
|
|
21
|
+
* @param id - id of the product to get.
|
|
22
|
+
* @param config - object that defines what should be included in the
|
|
23
|
+
* query response
|
|
24
|
+
* @return {Promise<Product>} the result of the find one operation.
|
|
25
|
+
*/
|
|
26
|
+
retrieve(id: string, config?: FindConfig<ProductType>): Promise<ProductType>;
|
|
27
|
+
/**
|
|
28
|
+
* Lists product types
|
|
29
|
+
* @param {Object} selector - the query object for find
|
|
30
|
+
* @param {Object} config - the config to be used for find
|
|
31
|
+
* @return {Promise} the result of the find operation
|
|
32
|
+
*/
|
|
33
|
+
list(selector?: FilterableProductTypeProps, config?: FindConfig<ProductType>): Promise<ProductType[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Lists product tags and adds count.
|
|
36
|
+
* @param {Object} selector - the query object for find
|
|
37
|
+
* @param {Object} config - the config to be used for find
|
|
38
|
+
* @return {Promise} the result of the find operation
|
|
39
|
+
*/
|
|
40
|
+
listAndCount(selector?: FilterableProductTypeProps, config?: FindConfig<ProductType>): Promise<[ProductType[], number]>;
|
|
41
|
+
}
|
|
42
|
+
export default ProductTypeService;
|
|
@@ -0,0 +1,156 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
var medusa_core_utils_1 = require("medusa-core-utils");
|
|
55
|
+
var medusa_interfaces_1 = require("medusa-interfaces");
|
|
56
|
+
/**
|
|
57
|
+
* Provides layer to manipulate products.
|
|
58
|
+
* @extends BaseService
|
|
59
|
+
*/
|
|
60
|
+
var ProductTypeService = /** @class */ (function (_super) {
|
|
61
|
+
__extends(ProductTypeService, _super);
|
|
62
|
+
function ProductTypeService(_a) {
|
|
63
|
+
var manager = _a.manager, productTypeRepository = _a.productTypeRepository;
|
|
64
|
+
var _this = _super.call(this) || this;
|
|
65
|
+
_this.manager_ = manager;
|
|
66
|
+
_this.typeRepository_ = productTypeRepository;
|
|
67
|
+
return _this;
|
|
68
|
+
}
|
|
69
|
+
ProductTypeService.prototype.withTransaction = function (transactionManager) {
|
|
70
|
+
if (!transactionManager) {
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
var cloned = new ProductTypeService({
|
|
74
|
+
manager: transactionManager,
|
|
75
|
+
productTypeRepository: this.typeRepository_,
|
|
76
|
+
});
|
|
77
|
+
cloned.transactionManager_ = transactionManager;
|
|
78
|
+
cloned.manager_ = transactionManager;
|
|
79
|
+
return cloned;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Gets a product by id.
|
|
83
|
+
* Throws in case of DB Error and if product was not found.
|
|
84
|
+
* @param id - id of the product to get.
|
|
85
|
+
* @param config - object that defines what should be included in the
|
|
86
|
+
* query response
|
|
87
|
+
* @return {Promise<Product>} the result of the find one operation.
|
|
88
|
+
*/
|
|
89
|
+
ProductTypeService.prototype.retrieve = function (id, config) {
|
|
90
|
+
if (config === void 0) { config = {}; }
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var typeRepo, query, type;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
typeRepo = this.manager_.getCustomRepository(this.typeRepository_);
|
|
97
|
+
query = this.buildQuery_({ id: id }, config);
|
|
98
|
+
return [4 /*yield*/, typeRepo.findOne(query)];
|
|
99
|
+
case 1:
|
|
100
|
+
type = _a.sent();
|
|
101
|
+
if (!type) {
|
|
102
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.NOT_FOUND, "Product with id: ".concat(id, " was not found"));
|
|
103
|
+
}
|
|
104
|
+
return [2 /*return*/, type];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Lists product types
|
|
111
|
+
* @param {Object} selector - the query object for find
|
|
112
|
+
* @param {Object} config - the config to be used for find
|
|
113
|
+
* @return {Promise} the result of the find operation
|
|
114
|
+
*/
|
|
115
|
+
ProductTypeService.prototype.list = function (selector, config) {
|
|
116
|
+
if (selector === void 0) { selector = {}; }
|
|
117
|
+
if (config === void 0) { config = { skip: 0, take: 20 }; }
|
|
118
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
+
var typeRepo, query;
|
|
120
|
+
return __generator(this, function (_a) {
|
|
121
|
+
switch (_a.label) {
|
|
122
|
+
case 0:
|
|
123
|
+
typeRepo = this.manager_.getCustomRepository(this.typeRepository_);
|
|
124
|
+
query = this.buildQuery_(selector, config);
|
|
125
|
+
return [4 /*yield*/, typeRepo.find(query)];
|
|
126
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Lists product tags and adds count.
|
|
133
|
+
* @param {Object} selector - the query object for find
|
|
134
|
+
* @param {Object} config - the config to be used for find
|
|
135
|
+
* @return {Promise} the result of the find operation
|
|
136
|
+
*/
|
|
137
|
+
ProductTypeService.prototype.listAndCount = function (selector, config) {
|
|
138
|
+
if (selector === void 0) { selector = {}; }
|
|
139
|
+
if (config === void 0) { config = { skip: 0, take: 20 }; }
|
|
140
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
+
var typeRepo, query;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0:
|
|
145
|
+
typeRepo = this.manager_.getCustomRepository(this.typeRepository_);
|
|
146
|
+
query = this.buildQuery_(selector, config);
|
|
147
|
+
return [4 /*yield*/, typeRepo.findAndCount(query)];
|
|
148
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
return ProductTypeService;
|
|
154
|
+
}(medusa_interfaces_1.BaseService));
|
|
155
|
+
exports.default = ProductTypeService;
|
|
156
|
+
//# sourceMappingURL=product-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-type.js","sourceRoot":"","sources":["../../src/services/product-type.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA+C;AAC/C,uDAA+C;AAO/C;;;GAGG;AACH;IAAiC,sCAAW;IAG1C,4BAAY,EAAkC;YAAhC,OAAO,aAAA,EAAE,qBAAqB,2BAAA;QAA5C,YACE,iBAAO,SAIR;QAFC,KAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,KAAI,CAAC,eAAe,GAAG,qBAAqB,CAAA;;IAC9C,CAAC;IAED,4CAAe,GAAf,UAAgB,kBAAiC;QAC/C,IAAI,CAAC,kBAAkB,EAAE;YACvB,OAAO,IAAI,CAAA;SACZ;QAED,IAAM,MAAM,GAAG,IAAI,kBAAkB,CAAC;YACpC,OAAO,EAAE,kBAAkB;YAC3B,qBAAqB,EAAE,IAAI,CAAC,eAAe;SAC5C,CAAC,CAAA;QAEF,MAAM,CAAC,mBAAmB,GAAG,kBAAkB,CAAA;QAC/C,MAAM,CAAC,QAAQ,GAAG,kBAAkB,CAAA;QAEpC,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;;;;;;OAOG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I,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;wBACzC,qBAAM,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,EAAA;4BAAzC,sBAAO,SAAkC,EAAA;;;;KAC1C;IACH,yBAAC;AAAD,CAAC,AApFD,CAAiC,+BAAW,GAoF3C;AAED,kBAAe,kBAAkB,CAAA"}
|
|
@@ -65,6 +65,7 @@ declare class ProductVariantService extends BaseService {
|
|
|
65
65
|
* @return {Promise} resolves to the update result.
|
|
66
66
|
*/
|
|
67
67
|
update(variantOrVariantId: string | Partial<ProductVariant>, update: UpdateProductVariantInput): Promise<ProductVariant>;
|
|
68
|
+
updateVariantPrices(variantId: string, prices: ProductVariantPrice[]): Promise<void>;
|
|
68
69
|
/**
|
|
69
70
|
* Sets the default price for the given currency.
|
|
70
71
|
* @param {string} variantId - the id of the variant to set prices for
|
|
@@ -143,7 +144,7 @@ declare class ProductVariantService extends BaseService {
|
|
|
143
144
|
* @param {Object} metadata - the metadata to set
|
|
144
145
|
* @return {Object} updated metadata object
|
|
145
146
|
*/
|
|
146
|
-
setMetadata_(variant: ProductVariant, metadata: object):
|
|
147
|
+
setMetadata_(variant: ProductVariant, metadata: object): Record<string, any>;
|
|
147
148
|
/**
|
|
148
149
|
* Creates a query object to be used for list queries.
|
|
149
150
|
* @param {object} selector - the selector to create the query from
|
|
@@ -319,90 +319,59 @@ var ProductVariantService = /** @class */ (function (_super) {
|
|
|
319
319
|
var _this = this;
|
|
320
320
|
return __generator(this, function (_a) {
|
|
321
321
|
return [2 /*return*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
322
|
-
var variantRepo, variant, prices, options, metadata, inventory_quantity, rest,
|
|
323
|
-
var e_2, _d, e_3, _e
|
|
324
|
-
return __generator(this, function (
|
|
325
|
-
switch (
|
|
322
|
+
var variantRepo, variant, prices, options, metadata, inventory_quantity, rest, options_1, options_1_1, option, e_2_1, _a, _b, _c, key, value, result;
|
|
323
|
+
var e_2, _d, e_3, _e;
|
|
324
|
+
return __generator(this, function (_f) {
|
|
325
|
+
switch (_f.label) {
|
|
326
326
|
case 0:
|
|
327
327
|
variantRepo = manager.getCustomRepository(this.productVariantRepository_);
|
|
328
328
|
variant = variantOrVariantId;
|
|
329
329
|
if (!(typeof variant === "string")) return [3 /*break*/, 2];
|
|
330
330
|
return [4 /*yield*/, this.retrieve(variantOrVariantId)];
|
|
331
331
|
case 1:
|
|
332
|
-
variant =
|
|
332
|
+
variant = _f.sent();
|
|
333
333
|
return [3 /*break*/, 3];
|
|
334
334
|
case 2:
|
|
335
335
|
if (!variant.id) {
|
|
336
336
|
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.INVALID_DATA, "Variant id missing");
|
|
337
337
|
}
|
|
338
|
-
|
|
338
|
+
_f.label = 3;
|
|
339
339
|
case 3:
|
|
340
340
|
prices = update.prices, options = update.options, metadata = update.metadata, inventory_quantity = update.inventory_quantity, rest = __rest(update, ["prices", "options", "metadata", "inventory_quantity"]);
|
|
341
|
-
if (!prices) return [3 /*break*/,
|
|
342
|
-
|
|
341
|
+
if (!prices) return [3 /*break*/, 5];
|
|
342
|
+
return [4 /*yield*/, this.updateVariantPrices(variant.id, prices)];
|
|
343
343
|
case 4:
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
_g.label = 5;
|
|
344
|
+
_f.sent();
|
|
345
|
+
_f.label = 5;
|
|
347
346
|
case 5:
|
|
348
|
-
if (
|
|
349
|
-
|
|
350
|
-
if (!price.region_id) return [3 /*break*/, 7];
|
|
351
|
-
return [4 /*yield*/, this.setRegionPrice(variant.id, {
|
|
352
|
-
region_id: price.region_id,
|
|
353
|
-
amount: price.amount,
|
|
354
|
-
sale_amount: price.sale_amount || undefined,
|
|
355
|
-
})];
|
|
347
|
+
if (!options) return [3 /*break*/, 13];
|
|
348
|
+
_f.label = 6;
|
|
356
349
|
case 6:
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
350
|
+
_f.trys.push([6, 11, 12, 13]);
|
|
351
|
+
options_1 = __values(options), options_1_1 = options_1.next();
|
|
352
|
+
_f.label = 7;
|
|
353
|
+
case 7:
|
|
354
|
+
if (!!options_1_1.done) return [3 /*break*/, 10];
|
|
355
|
+
option = options_1_1.value;
|
|
356
|
+
return [4 /*yield*/, this.updateOptionValue(variant.id, option.option_id, option.value)];
|
|
360
357
|
case 8:
|
|
361
|
-
|
|
362
|
-
|
|
358
|
+
_f.sent();
|
|
359
|
+
_f.label = 9;
|
|
363
360
|
case 9:
|
|
364
|
-
|
|
365
|
-
return [3 /*break*/,
|
|
361
|
+
options_1_1 = options_1.next();
|
|
362
|
+
return [3 /*break*/, 7];
|
|
366
363
|
case 10: return [3 /*break*/, 13];
|
|
367
364
|
case 11:
|
|
368
|
-
e_2_1 =
|
|
365
|
+
e_2_1 = _f.sent();
|
|
369
366
|
e_2 = { error: e_2_1 };
|
|
370
367
|
return [3 /*break*/, 13];
|
|
371
368
|
case 12:
|
|
372
369
|
try {
|
|
373
|
-
if (
|
|
370
|
+
if (options_1_1 && !options_1_1.done && (_d = options_1.return)) _d.call(options_1);
|
|
374
371
|
}
|
|
375
372
|
finally { if (e_2) throw e_2.error; }
|
|
376
373
|
return [7 /*endfinally*/];
|
|
377
374
|
case 13:
|
|
378
|
-
if (!options) return [3 /*break*/, 21];
|
|
379
|
-
_g.label = 14;
|
|
380
|
-
case 14:
|
|
381
|
-
_g.trys.push([14, 19, 20, 21]);
|
|
382
|
-
options_1 = __values(options), options_1_1 = options_1.next();
|
|
383
|
-
_g.label = 15;
|
|
384
|
-
case 15:
|
|
385
|
-
if (!!options_1_1.done) return [3 /*break*/, 18];
|
|
386
|
-
option = options_1_1.value;
|
|
387
|
-
return [4 /*yield*/, this.updateOptionValue(variant.id, option.option_id, option.value)];
|
|
388
|
-
case 16:
|
|
389
|
-
_g.sent();
|
|
390
|
-
_g.label = 17;
|
|
391
|
-
case 17:
|
|
392
|
-
options_1_1 = options_1.next();
|
|
393
|
-
return [3 /*break*/, 15];
|
|
394
|
-
case 18: return [3 /*break*/, 21];
|
|
395
|
-
case 19:
|
|
396
|
-
e_3_1 = _g.sent();
|
|
397
|
-
e_3 = { error: e_3_1 };
|
|
398
|
-
return [3 /*break*/, 21];
|
|
399
|
-
case 20:
|
|
400
|
-
try {
|
|
401
|
-
if (options_1_1 && !options_1_1.done && (_e = options_1.return)) _e.call(options_1);
|
|
402
|
-
}
|
|
403
|
-
finally { if (e_3) throw e_3.error; }
|
|
404
|
-
return [7 /*endfinally*/];
|
|
405
|
-
case 21:
|
|
406
375
|
if (metadata) {
|
|
407
376
|
variant.metadata = this.setMetadata_(variant, metadata);
|
|
408
377
|
}
|
|
@@ -415,16 +384,16 @@ var ProductVariantService = /** @class */ (function (_super) {
|
|
|
415
384
|
variant[key] = value;
|
|
416
385
|
}
|
|
417
386
|
}
|
|
418
|
-
catch (
|
|
387
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
419
388
|
finally {
|
|
420
389
|
try {
|
|
421
|
-
if (_b && !_b.done && (
|
|
390
|
+
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
422
391
|
}
|
|
423
|
-
finally { if (
|
|
392
|
+
finally { if (e_3) throw e_3.error; }
|
|
424
393
|
}
|
|
425
394
|
return [4 /*yield*/, variantRepo.save(variant)];
|
|
426
|
-
case
|
|
427
|
-
result =
|
|
395
|
+
case 14:
|
|
396
|
+
result = _f.sent();
|
|
428
397
|
return [4 /*yield*/, this.eventBus_
|
|
429
398
|
.withTransaction(manager)
|
|
430
399
|
.emit(ProductVariantService.Events.UPDATED, {
|
|
@@ -432,8 +401,8 @@ var ProductVariantService = /** @class */ (function (_super) {
|
|
|
432
401
|
product_id: result.product_id,
|
|
433
402
|
fields: Object.keys(update),
|
|
434
403
|
})];
|
|
435
|
-
case
|
|
436
|
-
|
|
404
|
+
case 15:
|
|
405
|
+
_f.sent();
|
|
437
406
|
return [2 /*return*/, result];
|
|
438
407
|
}
|
|
439
408
|
});
|
|
@@ -441,6 +410,65 @@ var ProductVariantService = /** @class */ (function (_super) {
|
|
|
441
410
|
});
|
|
442
411
|
});
|
|
443
412
|
};
|
|
413
|
+
ProductVariantService.prototype.updateVariantPrices = function (variantId, prices) {
|
|
414
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
415
|
+
var _this = this;
|
|
416
|
+
return __generator(this, function (_a) {
|
|
417
|
+
return [2 /*return*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
418
|
+
var moneyAmountRepo, obsoletePrices, prices_2, prices_2_1, price, e_4_1;
|
|
419
|
+
var e_4, _a;
|
|
420
|
+
return __generator(this, function (_b) {
|
|
421
|
+
switch (_b.label) {
|
|
422
|
+
case 0:
|
|
423
|
+
moneyAmountRepo = manager.getCustomRepository(this.moneyAmountRepository_);
|
|
424
|
+
return [4 /*yield*/, moneyAmountRepo.findVariantPricesNotIn(variantId, prices)];
|
|
425
|
+
case 1:
|
|
426
|
+
obsoletePrices = _b.sent();
|
|
427
|
+
_b.label = 2;
|
|
428
|
+
case 2:
|
|
429
|
+
_b.trys.push([2, 9, 10, 11]);
|
|
430
|
+
prices_2 = __values(prices), prices_2_1 = prices_2.next();
|
|
431
|
+
_b.label = 3;
|
|
432
|
+
case 3:
|
|
433
|
+
if (!!prices_2_1.done) return [3 /*break*/, 8];
|
|
434
|
+
price = prices_2_1.value;
|
|
435
|
+
if (!price.region_id) return [3 /*break*/, 5];
|
|
436
|
+
return [4 /*yield*/, this.setRegionPrice(variantId, {
|
|
437
|
+
region_id: price.region_id,
|
|
438
|
+
amount: price.amount,
|
|
439
|
+
sale_amount: price.sale_amount || undefined,
|
|
440
|
+
})];
|
|
441
|
+
case 4:
|
|
442
|
+
_b.sent();
|
|
443
|
+
return [3 /*break*/, 7];
|
|
444
|
+
case 5: return [4 /*yield*/, this.setCurrencyPrice(variantId, price)];
|
|
445
|
+
case 6:
|
|
446
|
+
_b.sent();
|
|
447
|
+
_b.label = 7;
|
|
448
|
+
case 7:
|
|
449
|
+
prices_2_1 = prices_2.next();
|
|
450
|
+
return [3 /*break*/, 3];
|
|
451
|
+
case 8: return [3 /*break*/, 11];
|
|
452
|
+
case 9:
|
|
453
|
+
e_4_1 = _b.sent();
|
|
454
|
+
e_4 = { error: e_4_1 };
|
|
455
|
+
return [3 /*break*/, 11];
|
|
456
|
+
case 10:
|
|
457
|
+
try {
|
|
458
|
+
if (prices_2_1 && !prices_2_1.done && (_a = prices_2.return)) _a.call(prices_2);
|
|
459
|
+
}
|
|
460
|
+
finally { if (e_4) throw e_4.error; }
|
|
461
|
+
return [7 /*endfinally*/];
|
|
462
|
+
case 11: return [4 /*yield*/, moneyAmountRepo.remove(obsoletePrices)];
|
|
463
|
+
case 12:
|
|
464
|
+
_b.sent();
|
|
465
|
+
return [2 /*return*/];
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
}); })];
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
};
|
|
444
472
|
/**
|
|
445
473
|
* Sets the default price for the given currency.
|
|
446
474
|
* @param {string} variantId - the id of the variant to set prices for
|
|
@@ -452,30 +480,13 @@ var ProductVariantService = /** @class */ (function (_super) {
|
|
|
452
480
|
var _this = this;
|
|
453
481
|
return __generator(this, function (_a) {
|
|
454
482
|
return [2 /*return*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
455
|
-
var moneyAmountRepo
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
switch (_c.label) {
|
|
483
|
+
var moneyAmountRepo;
|
|
484
|
+
return __generator(this, function (_a) {
|
|
485
|
+
switch (_a.label) {
|
|
459
486
|
case 0:
|
|
460
487
|
moneyAmountRepo = manager.getCustomRepository(this.moneyAmountRepository_);
|
|
461
|
-
return [4 /*yield*/, moneyAmountRepo.
|
|
462
|
-
|
|
463
|
-
currency_code: (_a = price.currency_code) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
|
|
464
|
-
variant_id: variantId,
|
|
465
|
-
region_id: (0, typeorm_1.IsNull)(),
|
|
466
|
-
},
|
|
467
|
-
})];
|
|
468
|
-
case 1:
|
|
469
|
-
moneyAmount = _c.sent();
|
|
470
|
-
if (!moneyAmount) {
|
|
471
|
-
moneyAmount = moneyAmountRepo.create(__assign(__assign({}, price), { currency_code: (_b = price.currency_code) === null || _b === void 0 ? void 0 : _b.toLowerCase(), variant_id: variantId }));
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
moneyAmount.amount = price.amount;
|
|
475
|
-
moneyAmount.sale_amount = price.sale_amount;
|
|
476
|
-
}
|
|
477
|
-
return [4 /*yield*/, moneyAmountRepo.save(moneyAmount)];
|
|
478
|
-
case 2: return [2 /*return*/, _c.sent()];
|
|
488
|
+
return [4 /*yield*/, moneyAmountRepo.upsertCurrencyPrice(variantId, price)];
|
|
489
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
479
490
|
}
|
|
480
491
|
});
|
|
481
492
|
}); })];
|