@medusajs/medusa 1.3.8 → 1.3.9-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +16 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/routes/admin/apps/authorize-app.d.ts +1 -1
- package/dist/api/routes/admin/apps/authorize-app.js +1 -1
- package/dist/api/routes/admin/apps/list.d.ts +1 -1
- package/dist/api/routes/admin/apps/list.js +1 -1
- package/dist/api/routes/admin/auth/create-session.d.ts +1 -1
- package/dist/api/routes/admin/auth/create-session.js +1 -1
- package/dist/api/routes/admin/auth/delete-session.d.ts +1 -1
- package/dist/api/routes/admin/auth/delete-session.js +1 -1
- package/dist/api/routes/admin/auth/get-session.d.ts +1 -1
- package/dist/api/routes/admin/auth/get-session.js +1 -1
- package/dist/api/routes/admin/batch/cancel-batch-job.d.ts +1 -1
- package/dist/api/routes/admin/batch/cancel-batch-job.js +1 -1
- package/dist/api/routes/admin/batch/confirm-batch-job.d.ts +1 -1
- package/dist/api/routes/admin/batch/confirm-batch-job.js +1 -1
- package/dist/api/routes/admin/batch/create-batch-job.js +10 -7
- package/dist/api/routes/admin/batch/create-batch-job.js.map +1 -1
- package/dist/api/routes/admin/batch/get-batch-job.d.ts +1 -1
- package/dist/api/routes/admin/batch/get-batch-job.js +1 -1
- package/dist/api/routes/admin/collections/add-products.d.ts +1 -1
- package/dist/api/routes/admin/collections/add-products.js +1 -1
- package/dist/api/routes/admin/collections/create-collection.d.ts +1 -1
- package/dist/api/routes/admin/collections/create-collection.js +1 -1
- package/dist/api/routes/admin/collections/delete-collection.d.ts +1 -1
- package/dist/api/routes/admin/collections/delete-collection.js +1 -1
- package/dist/api/routes/admin/collections/get-collection.d.ts +1 -1
- package/dist/api/routes/admin/collections/get-collection.js +1 -1
- package/dist/api/routes/admin/collections/list-collections.d.ts +1 -1
- package/dist/api/routes/admin/collections/list-collections.js +1 -1
- package/dist/api/routes/admin/collections/remove-products.d.ts +1 -1
- package/dist/api/routes/admin/collections/remove-products.js +1 -1
- package/dist/api/routes/admin/collections/update-collection.d.ts +1 -1
- package/dist/api/routes/admin/collections/update-collection.js +1 -1
- package/dist/api/routes/admin/currencies/index.d.ts +12 -0
- package/dist/api/routes/admin/currencies/index.js +49 -0
- package/dist/api/routes/admin/currencies/index.js.map +1 -0
- package/dist/api/routes/admin/currencies/list-currencies.d.ts +45 -0
- package/dist/api/routes/admin/currencies/list-currencies.js +164 -0
- package/dist/api/routes/admin/currencies/list-currencies.js.map +1 -0
- package/dist/api/routes/admin/currencies/update-currency.d.ts +35 -0
- package/dist/api/routes/admin/currencies/update-currency.js +112 -0
- package/dist/api/routes/admin/currencies/update-currency.js.map +1 -0
- package/dist/api/routes/admin/currency/index.d.ts +4 -0
- package/dist/api/routes/admin/currency/index.js +49 -0
- package/dist/api/routes/admin/currency/index.js.map +1 -0
- package/dist/api/routes/admin/currency/list-currencies.d.ts +45 -0
- package/dist/api/routes/admin/currency/list-currencies.js +164 -0
- package/dist/api/routes/admin/currency/list-currencies.js.map +1 -0
- package/dist/api/routes/admin/currency/update-currency.d.ts +35 -0
- package/dist/api/routes/admin/currency/update-currency.js +112 -0
- package/dist/api/routes/admin/currency/update-currency.js.map +1 -0
- package/dist/api/routes/admin/customer-groups/add-customers-batch.d.ts +1 -1
- package/dist/api/routes/admin/customer-groups/add-customers-batch.js +1 -1
- package/dist/api/routes/admin/customer-groups/create-customer-group.d.ts +1 -1
- package/dist/api/routes/admin/customer-groups/create-customer-group.js +1 -1
- package/dist/api/routes/admin/customer-groups/delete-customer-group.d.ts +1 -1
- package/dist/api/routes/admin/customer-groups/delete-customer-group.js +1 -1
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.d.ts +1 -1
- package/dist/api/routes/admin/customer-groups/delete-customers-batch.js +1 -1
- package/dist/api/routes/admin/customer-groups/get-customer-group.d.ts +1 -1
- package/dist/api/routes/admin/customer-groups/get-customer-group.js +1 -1
- package/dist/api/routes/admin/customer-groups/list-customer-groups.d.ts +1 -1
- package/dist/api/routes/admin/customer-groups/list-customer-groups.js +1 -1
- package/dist/api/routes/admin/customer-groups/update-customer-group.d.ts +1 -1
- package/dist/api/routes/admin/customer-groups/update-customer-group.js +1 -1
- package/dist/api/routes/admin/customers/get-customer.d.ts +1 -1
- package/dist/api/routes/admin/customers/get-customer.js +1 -1
- package/dist/api/routes/admin/discounts/add-region.d.ts +1 -1
- package/dist/api/routes/admin/discounts/add-region.js +1 -1
- package/dist/api/routes/admin/discounts/create-condition.d.ts +1 -1
- package/dist/api/routes/admin/discounts/create-condition.js +1 -1
- package/dist/api/routes/admin/discounts/create-dynamic-code.d.ts +2 -2
- package/dist/api/routes/admin/discounts/create-dynamic-code.js +2 -2
- package/dist/api/routes/admin/discounts/delete-condition.d.ts +1 -1
- package/dist/api/routes/admin/discounts/delete-condition.js +1 -1
- package/dist/api/routes/admin/discounts/delete-dynamic-code.d.ts +1 -1
- package/dist/api/routes/admin/discounts/delete-dynamic-code.js +1 -1
- package/dist/api/routes/admin/discounts/get-condition.d.ts +1 -1
- package/dist/api/routes/admin/discounts/get-condition.js +1 -1
- package/dist/api/routes/admin/discounts/get-discount-by-code.d.ts +1 -1
- package/dist/api/routes/admin/discounts/get-discount-by-code.js +1 -1
- package/dist/api/routes/admin/discounts/get-discount.d.ts +1 -1
- package/dist/api/routes/admin/discounts/get-discount.js +1 -1
- package/dist/api/routes/admin/discounts/remove-region.d.ts +1 -1
- package/dist/api/routes/admin/discounts/remove-region.js +1 -1
- package/dist/api/routes/admin/discounts/update-condition.d.ts +1 -1
- package/dist/api/routes/admin/discounts/update-condition.js +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 +1 -1
- package/dist/api/routes/admin/draft-orders/get-draft-order.d.ts +1 -1
- package/dist/api/routes/admin/draft-orders/get-draft-order.js +1 -1
- package/dist/api/routes/admin/draft-orders/register-payment.d.ts +1 -1
- package/dist/api/routes/admin/draft-orders/register-payment.js +1 -1
- package/dist/api/routes/admin/draft-orders/update-draft-order.d.ts +1 -1
- package/dist/api/routes/admin/draft-orders/update-draft-order.js +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 +1 -1
- package/dist/api/routes/admin/gift-cards/get-gift-card.d.ts +1 -1
- package/dist/api/routes/admin/gift-cards/get-gift-card.js +1 -1
- package/dist/api/routes/admin/index.js +6 -4
- package/dist/api/routes/admin/index.js.map +1 -1
- package/dist/api/routes/admin/invites/list-invites.d.ts +1 -1
- package/dist/api/routes/admin/invites/list-invites.js +1 -1
- package/dist/api/routes/admin/notes/delete-note.d.ts +1 -1
- package/dist/api/routes/admin/notes/delete-note.js +1 -1
- package/dist/api/routes/admin/notes/get-note.d.ts +1 -1
- package/dist/api/routes/admin/notes/get-note.js +1 -1
- package/dist/api/routes/admin/notes/update-note.d.ts +1 -1
- package/dist/api/routes/admin/notes/update-note.js +1 -1
- package/dist/api/routes/admin/orders/archive-order.d.ts +1 -1
- package/dist/api/routes/admin/orders/archive-order.js +1 -1
- package/dist/api/routes/admin/orders/cancel-claim.d.ts +1 -1
- package/dist/api/routes/admin/orders/cancel-claim.js +1 -1
- package/dist/api/routes/admin/orders/cancel-fulfillment-claim.d.ts +2 -2
- package/dist/api/routes/admin/orders/cancel-fulfillment-claim.js +2 -2
- package/dist/api/routes/admin/orders/cancel-fulfillment-swap.d.ts +2 -2
- package/dist/api/routes/admin/orders/cancel-fulfillment-swap.js +2 -2
- package/dist/api/routes/admin/orders/cancel-fulfillment.d.ts +1 -1
- package/dist/api/routes/admin/orders/cancel-fulfillment.js +1 -1
- package/dist/api/routes/admin/orders/capture-payment.d.ts +1 -1
- package/dist/api/routes/admin/orders/capture-payment.js +1 -1
- package/dist/api/routes/admin/orders/fulfill-claim.d.ts +1 -1
- package/dist/api/routes/admin/orders/fulfill-claim.js +1 -1
- package/dist/api/routes/admin/orders/fulfill-swap.d.ts +1 -1
- package/dist/api/routes/admin/orders/fulfill-swap.js +1 -1
- package/dist/api/routes/admin/orders/get-order.d.ts +1 -1
- package/dist/api/routes/admin/orders/get-order.js +1 -1
- package/dist/api/routes/admin/orders/process-swap-payment.d.ts +1 -1
- package/dist/api/routes/admin/orders/process-swap-payment.js +1 -1
- package/dist/api/routes/admin/orders/update-order.d.ts +1 -1
- package/dist/api/routes/admin/orders/update-order.js +1 -1
- package/dist/api/routes/admin/price-lists/add-prices-batch.d.ts +1 -1
- package/dist/api/routes/admin/price-lists/add-prices-batch.js +1 -1
- package/dist/api/routes/admin/price-lists/create-price-list.d.ts +5 -1
- package/dist/api/routes/admin/price-lists/create-price-list.js +17 -2
- package/dist/api/routes/admin/price-lists/create-price-list.js.map +1 -1
- package/dist/api/routes/admin/price-lists/delete-prices-batch.d.ts +1 -1
- package/dist/api/routes/admin/price-lists/delete-prices-batch.js +1 -1
- package/dist/api/routes/admin/price-lists/delete-product-prices.d.ts +1 -1
- package/dist/api/routes/admin/price-lists/delete-product-prices.js +1 -1
- package/dist/api/routes/admin/price-lists/delete-variant-prices.d.ts +1 -1
- package/dist/api/routes/admin/price-lists/delete-variant-prices.js +1 -1
- package/dist/api/routes/admin/price-lists/get-price-list.d.ts +1 -1
- package/dist/api/routes/admin/price-lists/get-price-list.js +1 -1
- package/dist/api/routes/admin/price-lists/index.d.ts +2 -1
- package/dist/api/routes/admin/price-lists/index.js +8 -1
- package/dist/api/routes/admin/price-lists/index.js.map +1 -1
- package/dist/api/routes/admin/price-lists/list-price-list-products.d.ts +1 -1
- package/dist/api/routes/admin/price-lists/list-price-list-products.js +1 -1
- package/dist/api/routes/admin/price-lists/update-price-list.d.ts +4 -0
- package/dist/api/routes/admin/price-lists/update-price-list.js +16 -1
- package/dist/api/routes/admin/price-lists/update-price-list.js.map +1 -1
- package/dist/api/routes/admin/products/get-product.d.ts +1 -1
- package/dist/api/routes/admin/products/get-product.js +1 -1
- package/dist/api/routes/admin/products/list-products.d.ts +1 -1
- package/dist/api/routes/admin/products/list-products.js +1 -1
- package/dist/api/routes/admin/products/list-tag-usage-count.d.ts +1 -1
- package/dist/api/routes/admin/products/list-tag-usage-count.js +1 -1
- package/dist/api/routes/admin/products/list-variants.d.ts +1 -1
- package/dist/api/routes/admin/products/list-variants.js +1 -1
- package/dist/api/routes/admin/products/set-metadata.d.ts +1 -1
- package/dist/api/routes/admin/products/set-metadata.js +1 -1
- package/dist/api/routes/admin/products/update-option.d.ts +1 -1
- package/dist/api/routes/admin/products/update-option.js +1 -1
- package/dist/api/routes/admin/products/update-variant.js +1 -0
- package/dist/api/routes/admin/products/update-variant.js.map +1 -1
- package/dist/api/routes/admin/regions/create-region.d.ts +4 -0
- package/dist/api/routes/admin/regions/create-region.js +16 -1
- package/dist/api/routes/admin/regions/create-region.js.map +1 -1
- package/dist/api/routes/admin/regions/get-fulfillment-options.d.ts +1 -1
- package/dist/api/routes/admin/regions/get-fulfillment-options.js +1 -1
- package/dist/api/routes/admin/regions/get-region.d.ts +1 -1
- package/dist/api/routes/admin/regions/get-region.js +1 -1
- package/dist/api/routes/admin/regions/index.d.ts +2 -1
- package/dist/api/routes/admin/regions/index.js +5 -1
- package/dist/api/routes/admin/regions/index.js.map +1 -1
- package/dist/api/routes/admin/regions/remove-country.d.ts +1 -1
- package/dist/api/routes/admin/regions/remove-country.js +1 -1
- package/dist/api/routes/admin/regions/remove-fulfillment-provider.d.ts +1 -1
- package/dist/api/routes/admin/regions/remove-fulfillment-provider.js +1 -1
- package/dist/api/routes/admin/regions/remove-payment-provider.d.ts +1 -1
- package/dist/api/routes/admin/regions/remove-payment-provider.js +1 -1
- package/dist/api/routes/admin/regions/update-region.d.ts +4 -0
- package/dist/api/routes/admin/regions/update-region.js +16 -1
- package/dist/api/routes/admin/regions/update-region.js.map +1 -1
- package/dist/api/routes/admin/return-reasons/delete-reason.d.ts +1 -1
- package/dist/api/routes/admin/return-reasons/delete-reason.js +1 -1
- package/dist/api/routes/admin/return-reasons/get-reason.d.ts +1 -1
- package/dist/api/routes/admin/return-reasons/get-reason.js +1 -1
- package/dist/api/routes/admin/sales-channels/add-product-batch.d.ts +1 -1
- package/dist/api/routes/admin/sales-channels/add-product-batch.js +1 -1
- package/dist/api/routes/admin/sales-channels/delete-products-batch.d.ts +1 -1
- package/dist/api/routes/admin/sales-channels/delete-products-batch.js +1 -1
- package/dist/api/routes/admin/sales-channels/delete-sales-channel.d.ts +1 -1
- package/dist/api/routes/admin/sales-channels/delete-sales-channel.js +1 -1
- package/dist/api/routes/admin/sales-channels/get-sales-channel.d.ts +1 -1
- package/dist/api/routes/admin/sales-channels/get-sales-channel.js +1 -1
- package/dist/api/routes/admin/sales-channels/list-sales-channels.d.ts +1 -1
- package/dist/api/routes/admin/sales-channels/list-sales-channels.js +1 -1
- package/dist/api/routes/admin/shipping-options/create-shipping-option.d.ts +4 -0
- package/dist/api/routes/admin/shipping-options/create-shipping-option.js +15 -0
- package/dist/api/routes/admin/shipping-options/create-shipping-option.js.map +1 -1
- package/dist/api/routes/admin/shipping-options/get-shipping-option.d.ts +1 -1
- package/dist/api/routes/admin/shipping-options/get-shipping-option.js +1 -1
- package/dist/api/routes/admin/shipping-options/index.d.ts +2 -1
- package/dist/api/routes/admin/shipping-options/index.js +5 -1
- package/dist/api/routes/admin/shipping-options/index.js.map +1 -1
- package/dist/api/routes/admin/shipping-options/update-shipping-option.d.ts +4 -0
- package/dist/api/routes/admin/shipping-options/update-shipping-option.js +15 -0
- package/dist/api/routes/admin/shipping-options/update-shipping-option.js.map +1 -1
- package/dist/api/routes/admin/shipping-profiles/get-shipping-profile.d.ts +1 -1
- package/dist/api/routes/admin/shipping-profiles/get-shipping-profile.js +1 -1
- package/dist/api/routes/admin/shipping-profiles/update-shipping-profile.d.ts +1 -1
- package/dist/api/routes/admin/shipping-profiles/update-shipping-profile.js +1 -1
- package/dist/api/routes/admin/store/get-store.d.ts +1 -1
- package/dist/api/routes/admin/store/get-store.js +1 -1
- package/dist/api/routes/admin/store/list-payment-providers.d.ts +1 -1
- package/dist/api/routes/admin/store/list-payment-providers.js +1 -1
- package/dist/api/routes/admin/store/list-tax-providers.d.ts +1 -1
- package/dist/api/routes/admin/store/list-tax-providers.js +1 -1
- package/dist/api/routes/admin/store/remove-currency.d.ts +1 -1
- package/dist/api/routes/admin/store/remove-currency.js +1 -1
- package/dist/api/routes/admin/store/update-store.d.ts +1 -1
- package/dist/api/routes/admin/store/update-store.js +1 -1
- package/dist/api/routes/admin/swaps/get-swap.d.ts +1 -1
- package/dist/api/routes/admin/swaps/get-swap.js +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-product-types.d.ts +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-product-types.js +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-products.d.ts +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-products.js +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.d.ts +1 -1
- package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js +1 -1
- package/dist/api/routes/admin/tax-rates/get-tax-rate.d.ts +1 -1
- package/dist/api/routes/admin/tax-rates/get-tax-rate.js +1 -1
- package/dist/api/routes/admin/tax-rates/remove-from-product-types.d.ts +1 -1
- package/dist/api/routes/admin/tax-rates/remove-from-product-types.js +1 -1
- package/dist/api/routes/admin/tax-rates/remove-from-products.d.ts +1 -1
- package/dist/api/routes/admin/tax-rates/remove-from-products.js +1 -1
- package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.d.ts +2 -2
- package/dist/api/routes/admin/tax-rates/remove-from-shipping-options.js +2 -2
- package/dist/api/routes/admin/uploads/create-upload.d.ts +1 -1
- package/dist/api/routes/admin/uploads/create-upload.js +1 -1
- package/dist/api/routes/admin/uploads/delete-upload.d.ts +1 -1
- package/dist/api/routes/admin/uploads/delete-upload.js +1 -1
- package/dist/api/routes/admin/uploads/get-download-url.d.ts +1 -1
- package/dist/api/routes/admin/uploads/get-download-url.js +1 -1
- package/dist/api/routes/admin/users/get-user.d.ts +1 -1
- package/dist/api/routes/admin/users/get-user.js +1 -1
- package/dist/api/routes/admin/users/list-users.d.ts +1 -1
- package/dist/api/routes/admin/users/list-users.js +1 -1
- package/dist/api/routes/admin/users/reset-password-token.d.ts +1 -1
- package/dist/api/routes/admin/users/reset-password-token.js +1 -1
- package/dist/api/routes/admin/users/reset-password.d.ts +1 -1
- package/dist/api/routes/admin/users/reset-password.js +1 -1
- package/dist/api/routes/admin/variants/list-variants.d.ts +1 -1
- package/dist/api/routes/admin/variants/list-variants.js +1 -1
- package/dist/api/routes/store/auth/create-session.d.ts +1 -1
- package/dist/api/routes/store/auth/create-session.js +1 -1
- package/dist/api/routes/store/auth/delete-session.d.ts +1 -1
- package/dist/api/routes/store/auth/delete-session.js +1 -1
- package/dist/api/routes/store/auth/exists.d.ts +1 -1
- package/dist/api/routes/store/auth/exists.js +1 -1
- package/dist/api/routes/store/auth/get-session.d.ts +1 -1
- package/dist/api/routes/store/auth/get-session.js +1 -1
- package/dist/api/routes/store/carts/create-payment-sessions.d.ts +1 -1
- package/dist/api/routes/store/carts/create-payment-sessions.js +1 -1
- package/dist/api/routes/store/carts/delete-discount.d.ts +1 -1
- package/dist/api/routes/store/carts/delete-discount.js +1 -1
- package/dist/api/routes/store/carts/get-cart.d.ts +1 -1
- package/dist/api/routes/store/carts/get-cart.js +1 -1
- package/dist/api/routes/store/collections/get-collection.d.ts +1 -1
- package/dist/api/routes/store/collections/get-collection.js +1 -1
- package/dist/api/routes/store/collections/list-collections.d.ts +1 -1
- package/dist/api/routes/store/collections/list-collections.js +1 -1
- package/dist/api/routes/store/customers/get-customer.d.ts +1 -1
- package/dist/api/routes/store/customers/get-customer.js +1 -1
- package/dist/api/routes/store/customers/get-payment-methods.d.ts +1 -1
- package/dist/api/routes/store/customers/get-payment-methods.js +1 -1
- package/dist/api/routes/store/customers/list-orders.d.ts +1 -1
- package/dist/api/routes/store/customers/list-orders.js +1 -1
- package/dist/api/routes/store/customers/reset-password-token.d.ts +1 -1
- package/dist/api/routes/store/customers/reset-password-token.js +1 -1
- package/dist/api/routes/store/customers/reset-password.d.ts +1 -1
- package/dist/api/routes/store/customers/reset-password.js +1 -1
- package/dist/api/routes/store/customers/update-customer.d.ts +1 -1
- package/dist/api/routes/store/customers/update-customer.js +1 -1
- package/dist/api/routes/store/gift-cards/get-gift-card.d.ts +1 -1
- package/dist/api/routes/store/gift-cards/get-gift-card.js +1 -1
- package/dist/api/routes/store/orders/get-order-by-cart.d.ts +1 -1
- package/dist/api/routes/store/orders/get-order-by-cart.js +1 -1
- package/dist/api/routes/store/orders/get-order.d.ts +1 -1
- package/dist/api/routes/store/orders/get-order.js +1 -1
- package/dist/api/routes/store/products/get-product.d.ts +1 -1
- package/dist/api/routes/store/products/get-product.js +1 -1
- package/dist/api/routes/store/regions/get-region.d.ts +1 -1
- package/dist/api/routes/store/regions/get-region.js +1 -1
- package/dist/api/routes/store/return-reasons/get-reason.d.ts +1 -1
- package/dist/api/routes/store/return-reasons/get-reason.js +1 -1
- package/dist/api/routes/store/shipping-options/list-options.d.ts +1 -1
- package/dist/api/routes/store/shipping-options/list-options.js +1 -1
- package/dist/api/routes/store/shipping-options/list-shipping-options.d.ts +1 -1
- package/dist/api/routes/store/shipping-options/list-shipping-options.js +1 -1
- package/dist/api/routes/store/swaps/get-swap-by-cart.d.ts +1 -1
- package/dist/api/routes/store/swaps/get-swap-by-cart.js +1 -1
- package/dist/api/routes/store/variants/get-variant.d.ts +1 -1
- package/dist/api/routes/store/variants/get-variant.js +1 -1
- package/dist/api/routes/store/variants/list-variants.d.ts +1 -1
- package/dist/api/routes/store/variants/list-variants.js +1 -1
- package/dist/helpers/test-request.js +27 -4
- package/dist/helpers/test-request.js.map +1 -1
- package/dist/interfaces/price-selection-strategy.d.ts +4 -0
- package/dist/interfaces/price-selection-strategy.js.map +1 -1
- package/dist/loaders/feature-flags/index.d.ts +1 -0
- package/dist/loaders/feature-flags/index.js +18 -3
- package/dist/loaders/feature-flags/index.js.map +1 -1
- package/dist/loaders/feature-flags/tax-inclusive-pricing.d.ts +3 -0
- package/dist/loaders/feature-flags/tax-inclusive-pricing.js +10 -0
- package/dist/loaders/feature-flags/tax-inclusive-pricing.js.map +1 -0
- package/dist/migrations/1659501357661-tax_inclusive_pricing.d.ts +7 -0
- package/dist/migrations/1659501357661-tax_inclusive_pricing.js +106 -0
- package/dist/migrations/1659501357661-tax_inclusive_pricing.js.map +1 -0
- package/dist/models/currency.d.ts +4 -0
- package/dist/models/currency.js +12 -0
- package/dist/models/currency.js.map +1 -1
- package/dist/models/custom-shipping-option.d.ts +3 -0
- package/dist/models/custom-shipping-option.js +3 -0
- package/dist/models/custom-shipping-option.js.map +1 -1
- package/dist/models/line-item.d.ts +4 -0
- package/dist/models/line-item.js +12 -0
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/money-amount.d.ts +2 -2
- package/dist/models/money-amount.js.map +1 -1
- package/dist/models/price-list.d.ts +5 -0
- package/dist/models/price-list.js +13 -0
- package/dist/models/price-list.js.map +1 -1
- package/dist/models/region.d.ts +4 -0
- package/dist/models/region.js +12 -0
- package/dist/models/region.js.map +1 -1
- package/dist/models/shipping-method.d.ts +4 -0
- package/dist/models/shipping-method.js +12 -0
- package/dist/models/shipping-method.js.map +1 -1
- package/dist/models/shipping-option.d.ts +4 -0
- package/dist/models/shipping-option.js +12 -0
- package/dist/models/shipping-option.js.map +1 -1
- package/dist/repositories/currency.d.ts +1 -1
- package/dist/repositories/currency.js +2 -2
- package/dist/repositories/currency.js.map +1 -1
- package/dist/repositories/money-amount.d.ts +1 -1
- package/dist/repositories/money-amount.js +8 -4
- package/dist/repositories/money-amount.js.map +1 -1
- package/dist/services/batch-job.js +4 -2
- package/dist/services/batch-job.js.map +1 -1
- package/dist/services/cart.js +83 -74
- package/dist/services/cart.js.map +1 -1
- package/dist/services/claim.js +45 -43
- package/dist/services/claim.js.map +1 -1
- package/dist/services/currency.d.ts +51 -0
- package/dist/services/currency.js +174 -0
- package/dist/services/currency.js.map +1 -0
- package/dist/services/discount.d.ts +4 -1
- package/dist/services/discount.js +39 -20
- package/dist/services/discount.js.map +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +3 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/line-item-adjustment.d.ts +1 -4
- package/dist/services/line-item-adjustment.js +2 -1
- package/dist/services/line-item-adjustment.js.map +1 -1
- package/dist/services/line-item.d.ts +12 -7
- package/dist/services/line-item.js +22 -10
- package/dist/services/line-item.js.map +1 -1
- package/dist/services/notification.js +3 -2
- package/dist/services/notification.js.map +1 -1
- package/dist/services/order.js +214 -115
- package/dist/services/order.js.map +1 -1
- package/dist/services/price-list.d.ts +7 -4
- package/dist/services/price-list.js +25 -11
- package/dist/services/price-list.js.map +1 -1
- package/dist/services/pricing.d.ts +7 -4
- package/dist/services/pricing.js +39 -12
- package/dist/services/pricing.js.map +1 -1
- package/dist/services/product-variant.js +1 -1
- package/dist/services/product-variant.js.map +1 -1
- package/dist/services/region.d.ts +10 -7
- package/dist/services/region.js +22 -6
- package/dist/services/region.js.map +1 -1
- package/dist/services/return.js +23 -19
- package/dist/services/return.js.map +1 -1
- package/dist/services/shipping-option.d.ts +12 -8
- package/dist/services/shipping-option.js +23 -2
- package/dist/services/shipping-option.js.map +1 -1
- package/dist/services/store.d.ts +1 -2
- package/dist/services/store.js.map +1 -1
- package/dist/services/totals.d.ts +18 -20
- package/dist/services/totals.js +614 -358
- package/dist/services/totals.js.map +1 -1
- package/dist/strategies/__fixtures__/product-export-data.js +6 -2
- package/dist/strategies/__fixtures__/product-export-data.js.map +1 -1
- package/dist/strategies/batch-jobs/product/export.d.ts +6 -0
- package/dist/strategies/batch-jobs/product/export.js +11 -2
- package/dist/strategies/batch-jobs/product/export.js.map +1 -1
- package/dist/strategies/batch-jobs/product/import.d.ts +6 -5
- package/dist/strategies/batch-jobs/product/import.js +271 -183
- package/dist/strategies/batch-jobs/product/import.js.map +1 -1
- package/dist/strategies/batch-jobs/product/index.js +2 -2
- package/dist/strategies/batch-jobs/product/types.d.ts +8 -0
- package/dist/strategies/batch-jobs/product/types.js.map +1 -1
- package/dist/strategies/batch-jobs/product/utils.d.ts +1 -1
- package/dist/strategies/batch-jobs/product/utils.js +10 -1
- package/dist/strategies/batch-jobs/product/utils.js.map +1 -1
- package/dist/strategies/price-selection.d.ts +6 -2
- package/dist/strategies/price-selection.js +124 -10
- package/dist/strategies/price-selection.js.map +1 -1
- package/dist/strategies/tax-calculation.d.ts +7 -5
- package/dist/strategies/tax-calculation.js +47 -17
- package/dist/strategies/tax-calculation.js.map +1 -1
- package/dist/subscribers/batch-job.d.ts +4 -1
- package/dist/subscribers/batch-job.js +71 -44
- package/dist/subscribers/batch-job.js.map +1 -1
- package/dist/types/currency.d.ts +3 -0
- package/dist/types/currency.js +3 -0
- package/dist/types/currency.js.map +1 -0
- package/dist/types/price-list.d.ts +2 -1
- package/dist/types/pricing.d.ts +5 -2
- package/dist/types/region.d.ts +2 -0
- package/dist/types/shipping-options.d.ts +2 -0
- package/dist/utils/calculate-price-tax-amount.d.ts +13 -0
- package/dist/utils/calculate-price-tax-amount.js +20 -0
- package/dist/utils/calculate-price-tax-amount.js.map +1 -0
- package/dist/utils/csv-cell-content-formatter.d.ts +2 -0
- package/dist/utils/csv-cell-content-formatter.js +22 -0
- package/dist/utils/csv-cell-content-formatter.js.map +1 -0
- package/dist/utils/feature-flag-decorators.js +4 -16
- package/dist/utils/feature-flag-decorators.js.map +1 -1
- package/dist/utils/flag-router.d.ts +1 -1
- package/dist/utils/flag-router.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -154,32 +154,37 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
154
154
|
* @param csvData - An array of parsed CSV rows.
|
|
155
155
|
*/
|
|
156
156
|
ProductImportStrategy.prototype.getImportInstructions = function (csvData) {
|
|
157
|
+
var _a;
|
|
157
158
|
return __awaiter(this, void 0, void 0, function () {
|
|
158
|
-
var shippingProfile, seenProducts, productsCreate, productsUpdate, variantsCreate, variantsUpdate, csvData_1, csvData_1_1, row, e_1_1;
|
|
159
|
-
var e_1,
|
|
160
|
-
return __generator(this, function (
|
|
161
|
-
switch (
|
|
162
|
-
case 0:
|
|
159
|
+
var transactionManager, shippingProfile, seenProducts, productsCreate, productsUpdate, variantsCreate, variantsUpdate, csvData_1, csvData_1_1, row, e_1_1;
|
|
160
|
+
var e_1, _b, _c;
|
|
161
|
+
return __generator(this, function (_d) {
|
|
162
|
+
switch (_d.label) {
|
|
163
|
+
case 0:
|
|
164
|
+
transactionManager = (_a = this.transactionManager_) !== null && _a !== void 0 ? _a : this.manager_;
|
|
165
|
+
return [4 /*yield*/, this.shippingProfileService_
|
|
166
|
+
.withTransaction(transactionManager)
|
|
167
|
+
.retrieveDefault()];
|
|
163
168
|
case 1:
|
|
164
|
-
shippingProfile =
|
|
169
|
+
shippingProfile = _d.sent();
|
|
165
170
|
seenProducts = {};
|
|
166
171
|
productsCreate = [];
|
|
167
172
|
productsUpdate = [];
|
|
168
173
|
variantsCreate = [];
|
|
169
174
|
variantsUpdate = [];
|
|
170
|
-
|
|
175
|
+
_d.label = 2;
|
|
171
176
|
case 2:
|
|
172
|
-
|
|
177
|
+
_d.trys.push([2, 8, 9, 10]);
|
|
173
178
|
csvData_1 = __values(csvData), csvData_1_1 = csvData_1.next();
|
|
174
|
-
|
|
179
|
+
_d.label = 3;
|
|
175
180
|
case 3:
|
|
176
181
|
if (!!csvData_1_1.done) return [3 /*break*/, 7];
|
|
177
182
|
row = csvData_1_1.value;
|
|
178
183
|
if (!row["variant.prices"].length) return [3 /*break*/, 5];
|
|
179
184
|
return [4 /*yield*/, this.prepareVariantPrices(row)];
|
|
180
185
|
case 4:
|
|
181
|
-
|
|
182
|
-
|
|
186
|
+
_d.sent();
|
|
187
|
+
_d.label = 5;
|
|
183
188
|
case 5:
|
|
184
189
|
if (row["variant.id"]) {
|
|
185
190
|
variantsUpdate.push(row);
|
|
@@ -198,27 +203,27 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
198
203
|
}
|
|
199
204
|
seenProducts[row["product.handle"]] = true;
|
|
200
205
|
}
|
|
201
|
-
|
|
206
|
+
_d.label = 6;
|
|
202
207
|
case 6:
|
|
203
208
|
csvData_1_1 = csvData_1.next();
|
|
204
209
|
return [3 /*break*/, 3];
|
|
205
210
|
case 7: return [3 /*break*/, 10];
|
|
206
211
|
case 8:
|
|
207
|
-
e_1_1 =
|
|
212
|
+
e_1_1 = _d.sent();
|
|
208
213
|
e_1 = { error: e_1_1 };
|
|
209
214
|
return [3 /*break*/, 10];
|
|
210
215
|
case 9:
|
|
211
216
|
try {
|
|
212
|
-
if (csvData_1_1 && !csvData_1_1.done && (
|
|
217
|
+
if (csvData_1_1 && !csvData_1_1.done && (_b = csvData_1.return)) _b.call(csvData_1);
|
|
213
218
|
}
|
|
214
219
|
finally { if (e_1) throw e_1.error; }
|
|
215
220
|
return [7 /*endfinally*/];
|
|
216
|
-
case 10: return [2 /*return*/, (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
case 10: return [2 /*return*/, (_c = {},
|
|
222
|
+
_c[types_1.OperationType.ProductCreate] = productsCreate,
|
|
223
|
+
_c[types_1.OperationType.VariantCreate] = variantsCreate,
|
|
224
|
+
_c[types_1.OperationType.ProductUpdate] = productsUpdate,
|
|
225
|
+
_c[types_1.OperationType.VariantUpdate] = variantsUpdate,
|
|
226
|
+
_c)];
|
|
222
227
|
}
|
|
223
228
|
});
|
|
224
229
|
});
|
|
@@ -300,36 +305,57 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
300
305
|
* @param batchJobId - An id of a job that is being preprocessed.
|
|
301
306
|
*/
|
|
302
307
|
ProductImportStrategy.prototype.preProcessBatchJob = function (batchJobId) {
|
|
308
|
+
var _a;
|
|
303
309
|
return __awaiter(this, void 0, void 0, function () {
|
|
304
|
-
var batchJob, csvFileKey, csvStream, parsedData,
|
|
305
|
-
return __generator(this, function (
|
|
306
|
-
switch (
|
|
307
|
-
case 0:
|
|
310
|
+
var transactionManager, batchJob, csvFileKey, csvStream, builtData, parsedData, e_4, ops, totalOperationCount, operationsCounts;
|
|
311
|
+
return __generator(this, function (_b) {
|
|
312
|
+
switch (_b.label) {
|
|
313
|
+
case 0:
|
|
314
|
+
transactionManager = (_a = this.transactionManager_) !== null && _a !== void 0 ? _a : this.manager_;
|
|
315
|
+
return [4 /*yield*/, this.batchJobService_
|
|
316
|
+
.withTransaction(transactionManager)
|
|
317
|
+
.retrieve(batchJobId)];
|
|
308
318
|
case 1:
|
|
309
|
-
batchJob =
|
|
319
|
+
batchJob = _b.sent();
|
|
310
320
|
csvFileKey = batchJob.context.fileKey;
|
|
311
321
|
return [4 /*yield*/, this.fileService_.getDownloadStream({
|
|
312
322
|
fileKey: csvFileKey,
|
|
313
323
|
})];
|
|
314
324
|
case 2:
|
|
315
|
-
csvStream =
|
|
316
|
-
|
|
325
|
+
csvStream = _b.sent();
|
|
326
|
+
_b.label = 3;
|
|
317
327
|
case 3:
|
|
318
|
-
|
|
319
|
-
return [4 /*yield*/, this.csvParser_.
|
|
328
|
+
_b.trys.push([3, 6, , 7]);
|
|
329
|
+
return [4 /*yield*/, this.csvParser_.parse(csvStream)];
|
|
320
330
|
case 4:
|
|
321
|
-
|
|
322
|
-
return [4 /*yield*/, this.
|
|
331
|
+
parsedData = _b.sent();
|
|
332
|
+
return [4 /*yield*/, this.csvParser_.buildData(parsedData)];
|
|
323
333
|
case 5:
|
|
324
|
-
|
|
325
|
-
return [
|
|
334
|
+
builtData = _b.sent();
|
|
335
|
+
return [3 /*break*/, 7];
|
|
326
336
|
case 6:
|
|
327
|
-
|
|
328
|
-
|
|
337
|
+
e_4 = _b.sent();
|
|
338
|
+
throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.INVALID_DATA, "The csv file parsing failed due to: " + e_4.message);
|
|
339
|
+
case 7: return [4 /*yield*/, this.getImportInstructions(builtData)];
|
|
340
|
+
case 8:
|
|
341
|
+
ops = _b.sent();
|
|
342
|
+
return [4 /*yield*/, this.uploadImportOpsFile(batchJobId, ops)];
|
|
343
|
+
case 9:
|
|
344
|
+
_b.sent();
|
|
345
|
+
totalOperationCount = 0;
|
|
346
|
+
operationsCounts = {};
|
|
347
|
+
Object.keys(ops).forEach(function (key) {
|
|
348
|
+
operationsCounts[key] = ops[key].length;
|
|
349
|
+
totalOperationCount += ops[key].length;
|
|
350
|
+
});
|
|
351
|
+
return [4 /*yield*/, this.batchJobService_
|
|
352
|
+
.withTransaction(transactionManager)
|
|
353
|
+
.update(batchJobId, {
|
|
329
354
|
result: {
|
|
330
355
|
advancement_count: 0,
|
|
331
356
|
// number of update/create operations to execute
|
|
332
|
-
count:
|
|
357
|
+
count: totalOperationCount,
|
|
358
|
+
operations: operationsCounts,
|
|
333
359
|
stat_descriptors: [
|
|
334
360
|
{
|
|
335
361
|
key: "product-import-count",
|
|
@@ -339,8 +365,8 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
339
365
|
],
|
|
340
366
|
},
|
|
341
367
|
})];
|
|
342
|
-
case
|
|
343
|
-
|
|
368
|
+
case 10:
|
|
369
|
+
_b.sent();
|
|
344
370
|
return [2 /*return*/];
|
|
345
371
|
}
|
|
346
372
|
});
|
|
@@ -357,22 +383,30 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
357
383
|
var _this = this;
|
|
358
384
|
return __generator(this, function (_a) {
|
|
359
385
|
switch (_a.label) {
|
|
360
|
-
case 0: return [4 /*yield*/, this.atomicPhase_(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
386
|
+
case 0: return [4 /*yield*/, this.atomicPhase_(function (manager) { return __awaiter(_this, void 0, void 0, function () {
|
|
387
|
+
var batchJob;
|
|
361
388
|
return __generator(this, function (_a) {
|
|
362
389
|
switch (_a.label) {
|
|
363
|
-
case 0: return [4 /*yield*/, this.
|
|
390
|
+
case 0: return [4 /*yield*/, this.batchJobService_
|
|
391
|
+
.withTransaction(manager)
|
|
392
|
+
.retrieve(batchJobId)];
|
|
364
393
|
case 1:
|
|
365
|
-
_a.sent();
|
|
366
|
-
return [4 /*yield*/, this.
|
|
394
|
+
batchJob = (_a.sent());
|
|
395
|
+
return [4 /*yield*/, this.createProducts(batchJob)];
|
|
367
396
|
case 2:
|
|
368
397
|
_a.sent();
|
|
369
|
-
return [4 /*yield*/, this.
|
|
398
|
+
return [4 /*yield*/, this.updateProducts(batchJob)];
|
|
370
399
|
case 3:
|
|
371
400
|
_a.sent();
|
|
372
|
-
return [4 /*yield*/, this.
|
|
401
|
+
return [4 /*yield*/, this.createVariants(batchJob)];
|
|
373
402
|
case 4:
|
|
374
403
|
_a.sent();
|
|
375
|
-
this.
|
|
404
|
+
return [4 /*yield*/, this.updateVariants(batchJob)];
|
|
405
|
+
case 5:
|
|
406
|
+
_a.sent();
|
|
407
|
+
return [4 /*yield*/, this.finalize(batchJob)];
|
|
408
|
+
case 6:
|
|
409
|
+
_a.sent();
|
|
376
410
|
return [2 /*return*/];
|
|
377
411
|
}
|
|
378
412
|
});
|
|
@@ -394,8 +428,8 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
394
428
|
ProductImportStrategy.prototype.processSalesChannels = function (data) {
|
|
395
429
|
var _a;
|
|
396
430
|
return __awaiter(this, void 0, void 0, function () {
|
|
397
|
-
var transactionManager, salesChannelServiceTx, salesChannels, data_1, data_1_1, input, channel,
|
|
398
|
-
var
|
|
431
|
+
var transactionManager, salesChannelServiceTx, salesChannels, data_1, data_1_1, input, channel, e_5, e_6_1;
|
|
432
|
+
var e_6, _b;
|
|
399
433
|
return __generator(this, function (_c) {
|
|
400
434
|
switch (_c.label) {
|
|
401
435
|
case 0:
|
|
@@ -422,7 +456,7 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
422
456
|
channel = _c.sent();
|
|
423
457
|
return [3 /*break*/, 6];
|
|
424
458
|
case 5:
|
|
425
|
-
|
|
459
|
+
e_5 = _c.sent();
|
|
426
460
|
return [3 /*break*/, 6];
|
|
427
461
|
case 6:
|
|
428
462
|
if (!!channel) return [3 /*break*/, 8];
|
|
@@ -440,14 +474,14 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
440
474
|
return [3 /*break*/, 2];
|
|
441
475
|
case 10: return [3 /*break*/, 13];
|
|
442
476
|
case 11:
|
|
443
|
-
|
|
444
|
-
|
|
477
|
+
e_6_1 = _c.sent();
|
|
478
|
+
e_6 = { error: e_6_1 };
|
|
445
479
|
return [3 /*break*/, 13];
|
|
446
480
|
case 12:
|
|
447
481
|
try {
|
|
448
482
|
if (data_1_1 && !data_1_1.done && (_b = data_1.return)) _b.call(data_1);
|
|
449
483
|
}
|
|
450
|
-
finally { if (
|
|
484
|
+
finally { if (e_6) throw e_6.error; }
|
|
451
485
|
return [7 /*endfinally*/];
|
|
452
486
|
case 13: return [2 /*return*/, salesChannels];
|
|
453
487
|
}
|
|
@@ -457,29 +491,32 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
457
491
|
/**
|
|
458
492
|
* Method creates products using `ProductService` and parsed data from a CSV row.
|
|
459
493
|
*
|
|
460
|
-
* @param
|
|
494
|
+
* @param batchJob - The current batch job being processed.
|
|
461
495
|
*/
|
|
462
|
-
ProductImportStrategy.prototype.createProducts = function (
|
|
496
|
+
ProductImportStrategy.prototype.createProducts = function (batchJob) {
|
|
463
497
|
var _a;
|
|
464
498
|
return __awaiter(this, void 0, void 0, function () {
|
|
465
|
-
var transactionManager, productOps, productServiceTx, isSalesChannelsFeatureOn, productOps_1, productOps_1_1, productOp, productData, _b, _c,
|
|
466
|
-
var
|
|
499
|
+
var transactionManager, productOps, productServiceTx, isSalesChannelsFeatureOn, productOps_1, productOps_1_1, productOp, productData, _b, _c, e_7, e_8_1;
|
|
500
|
+
var e_8, _d;
|
|
467
501
|
return __generator(this, function (_e) {
|
|
468
502
|
switch (_e.label) {
|
|
469
503
|
case 0:
|
|
504
|
+
if (!batchJob.result.operations[types_1.OperationType.ProductCreate]) {
|
|
505
|
+
return [2 /*return*/];
|
|
506
|
+
}
|
|
470
507
|
transactionManager = (_a = this.transactionManager_) !== null && _a !== void 0 ? _a : this.manager_;
|
|
471
|
-
return [4 /*yield*/, this.downloadImportOpsFile(
|
|
508
|
+
return [4 /*yield*/, this.downloadImportOpsFile(batchJob.id, types_1.OperationType.ProductCreate)];
|
|
472
509
|
case 1:
|
|
473
510
|
productOps = _e.sent();
|
|
474
511
|
productServiceTx = this.productService_.withTransaction(transactionManager);
|
|
475
512
|
isSalesChannelsFeatureOn = this.featureFlagRouter_.isFeatureEnabled(sales_channels_1.default.key);
|
|
476
513
|
_e.label = 2;
|
|
477
514
|
case 2:
|
|
478
|
-
_e.trys.push([2,
|
|
515
|
+
_e.trys.push([2, 13, 14, 15]);
|
|
479
516
|
productOps_1 = __values(productOps), productOps_1_1 = productOps_1.next();
|
|
480
517
|
_e.label = 3;
|
|
481
518
|
case 3:
|
|
482
|
-
if (!!productOps_1_1.done) return [3 /*break*/,
|
|
519
|
+
if (!!productOps_1_1.done) return [3 /*break*/, 12];
|
|
483
520
|
productOp = productOps_1_1.value;
|
|
484
521
|
productData = (0, utils_1.transformProductData)(productOp);
|
|
485
522
|
_e.label = 4;
|
|
@@ -497,27 +534,28 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
497
534
|
_e.sent();
|
|
498
535
|
return [3 /*break*/, 9];
|
|
499
536
|
case 8:
|
|
500
|
-
|
|
501
|
-
ProductImportStrategy.throwDescriptiveError(productOp,
|
|
537
|
+
e_7 = _e.sent();
|
|
538
|
+
ProductImportStrategy.throwDescriptiveError(productOp, e_7.message);
|
|
502
539
|
return [3 /*break*/, 9];
|
|
503
|
-
case 9:
|
|
504
|
-
this.updateProgress(batchJobId);
|
|
505
|
-
_e.label = 10;
|
|
540
|
+
case 9: return [4 /*yield*/, this.updateProgress(batchJob.id)];
|
|
506
541
|
case 10:
|
|
542
|
+
_e.sent();
|
|
543
|
+
_e.label = 11;
|
|
544
|
+
case 11:
|
|
507
545
|
productOps_1_1 = productOps_1.next();
|
|
508
546
|
return [3 /*break*/, 3];
|
|
509
|
-
case
|
|
510
|
-
case 12:
|
|
511
|
-
e_7_1 = _e.sent();
|
|
512
|
-
e_7 = { error: e_7_1 };
|
|
513
|
-
return [3 /*break*/, 14];
|
|
547
|
+
case 12: return [3 /*break*/, 15];
|
|
514
548
|
case 13:
|
|
549
|
+
e_8_1 = _e.sent();
|
|
550
|
+
e_8 = { error: e_8_1 };
|
|
551
|
+
return [3 /*break*/, 15];
|
|
552
|
+
case 14:
|
|
515
553
|
try {
|
|
516
554
|
if (productOps_1_1 && !productOps_1_1.done && (_d = productOps_1.return)) _d.call(productOps_1);
|
|
517
555
|
}
|
|
518
|
-
finally { if (
|
|
556
|
+
finally { if (e_8) throw e_8.error; }
|
|
519
557
|
return [7 /*endfinally*/];
|
|
520
|
-
case
|
|
558
|
+
case 15: return [2 /*return*/];
|
|
521
559
|
}
|
|
522
560
|
});
|
|
523
561
|
});
|
|
@@ -525,29 +563,32 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
525
563
|
/**
|
|
526
564
|
* Method updates existing products in the DB using a CSV row data.
|
|
527
565
|
*
|
|
528
|
-
* @param
|
|
566
|
+
* @param batchJob - The current batch job being processed.
|
|
529
567
|
*/
|
|
530
|
-
ProductImportStrategy.prototype.updateProducts = function (
|
|
568
|
+
ProductImportStrategy.prototype.updateProducts = function (batchJob) {
|
|
531
569
|
var _a;
|
|
532
570
|
return __awaiter(this, void 0, void 0, function () {
|
|
533
|
-
var transactionManager, productOps, productServiceTx, isSalesChannelsFeatureOn, productOps_2, productOps_2_1, productOp, productData, _b, _c,
|
|
534
|
-
var
|
|
571
|
+
var transactionManager, productOps, productServiceTx, isSalesChannelsFeatureOn, productOps_2, productOps_2_1, productOp, productData, _b, _c, e_9, e_10_1;
|
|
572
|
+
var e_10, _d;
|
|
535
573
|
return __generator(this, function (_e) {
|
|
536
574
|
switch (_e.label) {
|
|
537
575
|
case 0:
|
|
576
|
+
if (!batchJob.result.operations[types_1.OperationType.ProductUpdate]) {
|
|
577
|
+
return [2 /*return*/];
|
|
578
|
+
}
|
|
538
579
|
transactionManager = (_a = this.transactionManager_) !== null && _a !== void 0 ? _a : this.manager_;
|
|
539
|
-
return [4 /*yield*/, this.downloadImportOpsFile(
|
|
580
|
+
return [4 /*yield*/, this.downloadImportOpsFile(batchJob.id, types_1.OperationType.ProductUpdate)];
|
|
540
581
|
case 1:
|
|
541
582
|
productOps = _e.sent();
|
|
542
583
|
productServiceTx = this.productService_.withTransaction(transactionManager);
|
|
543
584
|
isSalesChannelsFeatureOn = this.featureFlagRouter_.isFeatureEnabled(sales_channels_1.default.key);
|
|
544
585
|
_e.label = 2;
|
|
545
586
|
case 2:
|
|
546
|
-
_e.trys.push([2,
|
|
587
|
+
_e.trys.push([2, 13, 14, 15]);
|
|
547
588
|
productOps_2 = __values(productOps), productOps_2_1 = productOps_2.next();
|
|
548
589
|
_e.label = 3;
|
|
549
590
|
case 3:
|
|
550
|
-
if (!!productOps_2_1.done) return [3 /*break*/,
|
|
591
|
+
if (!!productOps_2_1.done) return [3 /*break*/, 12];
|
|
551
592
|
productOp = productOps_2_1.value;
|
|
552
593
|
productData = (0, utils_1.transformProductData)(productOp);
|
|
553
594
|
_e.label = 4;
|
|
@@ -565,27 +606,28 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
565
606
|
_e.sent();
|
|
566
607
|
return [3 /*break*/, 9];
|
|
567
608
|
case 8:
|
|
568
|
-
|
|
569
|
-
ProductImportStrategy.throwDescriptiveError(productOp,
|
|
609
|
+
e_9 = _e.sent();
|
|
610
|
+
ProductImportStrategy.throwDescriptiveError(productOp, e_9.message);
|
|
570
611
|
return [3 /*break*/, 9];
|
|
571
|
-
case 9:
|
|
572
|
-
this.updateProgress(batchJobId);
|
|
573
|
-
_e.label = 10;
|
|
612
|
+
case 9: return [4 /*yield*/, this.updateProgress(batchJob.id)];
|
|
574
613
|
case 10:
|
|
614
|
+
_e.sent();
|
|
615
|
+
_e.label = 11;
|
|
616
|
+
case 11:
|
|
575
617
|
productOps_2_1 = productOps_2.next();
|
|
576
618
|
return [3 /*break*/, 3];
|
|
577
|
-
case
|
|
578
|
-
case 12:
|
|
579
|
-
e_9_1 = _e.sent();
|
|
580
|
-
e_9 = { error: e_9_1 };
|
|
581
|
-
return [3 /*break*/, 14];
|
|
619
|
+
case 12: return [3 /*break*/, 15];
|
|
582
620
|
case 13:
|
|
621
|
+
e_10_1 = _e.sent();
|
|
622
|
+
e_10 = { error: e_10_1 };
|
|
623
|
+
return [3 /*break*/, 15];
|
|
624
|
+
case 14:
|
|
583
625
|
try {
|
|
584
626
|
if (productOps_2_1 && !productOps_2_1.done && (_d = productOps_2.return)) _d.call(productOps_2);
|
|
585
627
|
}
|
|
586
|
-
finally { if (
|
|
628
|
+
finally { if (e_10) throw e_10.error; }
|
|
587
629
|
return [7 /*endfinally*/];
|
|
588
|
-
case
|
|
630
|
+
case 15: return [2 /*return*/];
|
|
589
631
|
}
|
|
590
632
|
});
|
|
591
633
|
});
|
|
@@ -594,26 +636,29 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
594
636
|
* Method creates product variants from a CSV data.
|
|
595
637
|
* Method also handles processing of variant options.
|
|
596
638
|
*
|
|
597
|
-
* @param
|
|
639
|
+
* @param batchJob - The current batch job being processed.
|
|
598
640
|
*/
|
|
599
|
-
ProductImportStrategy.prototype.createVariants = function (
|
|
641
|
+
ProductImportStrategy.prototype.createVariants = function (batchJob) {
|
|
600
642
|
var _a, _b, _c;
|
|
601
643
|
return __awaiter(this, void 0, void 0, function () {
|
|
602
|
-
var transactionManager, variantOps, _loop_1, this_1, variantOps_1, variantOps_1_1, variantOp,
|
|
603
|
-
var
|
|
644
|
+
var transactionManager, variantOps, _loop_1, this_1, variantOps_1, variantOps_1_1, variantOp, e_11_1;
|
|
645
|
+
var e_11, _d;
|
|
604
646
|
return __generator(this, function (_e) {
|
|
605
647
|
switch (_e.label) {
|
|
606
648
|
case 0:
|
|
649
|
+
if (!batchJob.result.operations[types_1.OperationType.VariantCreate]) {
|
|
650
|
+
return [2 /*return*/];
|
|
651
|
+
}
|
|
607
652
|
transactionManager = (_a = this.transactionManager_) !== null && _a !== void 0 ? _a : this.manager_;
|
|
608
|
-
return [4 /*yield*/, this.downloadImportOpsFile(
|
|
653
|
+
return [4 /*yield*/, this.downloadImportOpsFile(batchJob.id, types_1.OperationType.VariantCreate)];
|
|
609
654
|
case 1:
|
|
610
655
|
variantOps = _e.sent();
|
|
611
656
|
_loop_1 = function (variantOp) {
|
|
612
|
-
var variant, product_1, optionIds_1,
|
|
657
|
+
var variant, product_1, optionIds_1, e_12;
|
|
613
658
|
return __generator(this, function (_f) {
|
|
614
659
|
switch (_f.label) {
|
|
615
660
|
case 0:
|
|
616
|
-
_f.trys.push([0,
|
|
661
|
+
_f.trys.push([0, 4, , 5]);
|
|
617
662
|
variant = (0, utils_1.transformVariantData)(variantOp);
|
|
618
663
|
return [4 /*yield*/, this_1.productService_
|
|
619
664
|
.withTransaction(transactionManager)
|
|
@@ -634,13 +679,15 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
634
679
|
.create(product_1, variant)];
|
|
635
680
|
case 2:
|
|
636
681
|
_f.sent();
|
|
637
|
-
this_1.updateProgress(
|
|
638
|
-
return [3 /*break*/, 4];
|
|
682
|
+
return [4 /*yield*/, this_1.updateProgress(batchJob.id)];
|
|
639
683
|
case 3:
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
684
|
+
_f.sent();
|
|
685
|
+
return [3 /*break*/, 5];
|
|
686
|
+
case 4:
|
|
687
|
+
e_12 = _f.sent();
|
|
688
|
+
ProductImportStrategy.throwDescriptiveError(variantOp, e_12.message);
|
|
689
|
+
return [3 /*break*/, 5];
|
|
690
|
+
case 5: return [2 /*return*/];
|
|
644
691
|
}
|
|
645
692
|
});
|
|
646
693
|
};
|
|
@@ -662,14 +709,14 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
662
709
|
return [3 /*break*/, 3];
|
|
663
710
|
case 6: return [3 /*break*/, 9];
|
|
664
711
|
case 7:
|
|
665
|
-
|
|
666
|
-
|
|
712
|
+
e_11_1 = _e.sent();
|
|
713
|
+
e_11 = { error: e_11_1 };
|
|
667
714
|
return [3 /*break*/, 9];
|
|
668
715
|
case 8:
|
|
669
716
|
try {
|
|
670
717
|
if (variantOps_1_1 && !variantOps_1_1.done && (_d = variantOps_1.return)) _d.call(variantOps_1);
|
|
671
718
|
}
|
|
672
|
-
finally { if (
|
|
719
|
+
finally { if (e_11) throw e_11.error; }
|
|
673
720
|
return [7 /*endfinally*/];
|
|
674
721
|
case 9: return [2 /*return*/];
|
|
675
722
|
}
|
|
@@ -679,28 +726,31 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
679
726
|
/**
|
|
680
727
|
* Method updates product variants from a CSV data.
|
|
681
728
|
*
|
|
682
|
-
* @param
|
|
729
|
+
* @param batchJob - The current batch job being processed.
|
|
683
730
|
*/
|
|
684
|
-
ProductImportStrategy.prototype.updateVariants = function (
|
|
731
|
+
ProductImportStrategy.prototype.updateVariants = function (batchJob) {
|
|
685
732
|
var _a;
|
|
686
733
|
return __awaiter(this, void 0, void 0, function () {
|
|
687
|
-
var transactionManager, variantOps, productServiceTx, variantOps_2, variantOps_2_1, variantOp, product,
|
|
688
|
-
var
|
|
734
|
+
var transactionManager, variantOps, productServiceTx, variantOps_2, variantOps_2_1, variantOp, product, e_13, e_14_1;
|
|
735
|
+
var e_14, _b;
|
|
689
736
|
return __generator(this, function (_c) {
|
|
690
737
|
switch (_c.label) {
|
|
691
738
|
case 0:
|
|
739
|
+
if (!batchJob.result.operations[types_1.OperationType.VariantUpdate]) {
|
|
740
|
+
return [2 /*return*/];
|
|
741
|
+
}
|
|
692
742
|
transactionManager = (_a = this.transactionManager_) !== null && _a !== void 0 ? _a : this.manager_;
|
|
693
|
-
return [4 /*yield*/, this.downloadImportOpsFile(
|
|
743
|
+
return [4 /*yield*/, this.downloadImportOpsFile(batchJob.id, types_1.OperationType.VariantUpdate)];
|
|
694
744
|
case 1:
|
|
695
745
|
variantOps = _c.sent();
|
|
696
746
|
productServiceTx = this.productService_.withTransaction(transactionManager);
|
|
697
747
|
_c.label = 2;
|
|
698
748
|
case 2:
|
|
699
|
-
_c.trys.push([2,
|
|
749
|
+
_c.trys.push([2, 13, 14, 15]);
|
|
700
750
|
variantOps_2 = __values(variantOps), variantOps_2_1 = variantOps_2.next();
|
|
701
751
|
_c.label = 3;
|
|
702
752
|
case 3:
|
|
703
|
-
if (!!variantOps_2_1.done) return [3 /*break*/,
|
|
753
|
+
if (!!variantOps_2_1.done) return [3 /*break*/, 12];
|
|
704
754
|
variantOp = variantOps_2_1.value;
|
|
705
755
|
_c.label = 4;
|
|
706
756
|
case 4:
|
|
@@ -718,27 +768,28 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
718
768
|
_c.sent();
|
|
719
769
|
return [3 /*break*/, 9];
|
|
720
770
|
case 8:
|
|
721
|
-
|
|
722
|
-
ProductImportStrategy.throwDescriptiveError(variantOp,
|
|
771
|
+
e_13 = _c.sent();
|
|
772
|
+
ProductImportStrategy.throwDescriptiveError(variantOp, e_13.message);
|
|
723
773
|
return [3 /*break*/, 9];
|
|
724
|
-
case 9:
|
|
725
|
-
this.updateProgress(batchJobId);
|
|
726
|
-
_c.label = 10;
|
|
774
|
+
case 9: return [4 /*yield*/, this.updateProgress(batchJob.id)];
|
|
727
775
|
case 10:
|
|
776
|
+
_c.sent();
|
|
777
|
+
_c.label = 11;
|
|
778
|
+
case 11:
|
|
728
779
|
variantOps_2_1 = variantOps_2.next();
|
|
729
780
|
return [3 /*break*/, 3];
|
|
730
|
-
case
|
|
731
|
-
case 12:
|
|
732
|
-
e_13_1 = _c.sent();
|
|
733
|
-
e_13 = { error: e_13_1 };
|
|
734
|
-
return [3 /*break*/, 14];
|
|
781
|
+
case 12: return [3 /*break*/, 15];
|
|
735
782
|
case 13:
|
|
783
|
+
e_14_1 = _c.sent();
|
|
784
|
+
e_14 = { error: e_14_1 };
|
|
785
|
+
return [3 /*break*/, 15];
|
|
786
|
+
case 14:
|
|
736
787
|
try {
|
|
737
788
|
if (variantOps_2_1 && !variantOps_2_1.done && (_b = variantOps_2.return)) _b.call(variantOps_2);
|
|
738
789
|
}
|
|
739
|
-
finally { if (
|
|
790
|
+
finally { if (e_14) throw e_14.error; }
|
|
740
791
|
return [7 /*endfinally*/];
|
|
741
|
-
case
|
|
792
|
+
case 15: return [2 /*return*/];
|
|
742
793
|
}
|
|
743
794
|
});
|
|
744
795
|
});
|
|
@@ -750,39 +801,42 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
750
801
|
* @param productId - id of variant's product
|
|
751
802
|
*/
|
|
752
803
|
ProductImportStrategy.prototype.prepareVariantOptions = function (variantOp, productId) {
|
|
804
|
+
var _a;
|
|
753
805
|
return __awaiter(this, void 0, void 0, function () {
|
|
754
|
-
var productOptions, productOptions_1, productOptions_1_1, o, option,
|
|
755
|
-
var
|
|
756
|
-
return __generator(this, function (
|
|
757
|
-
switch (
|
|
806
|
+
var transactionManager, productOptions, productServiceTx, productOptions_1, productOptions_1_1, o, option, e_15_1;
|
|
807
|
+
var e_15, _b;
|
|
808
|
+
return __generator(this, function (_c) {
|
|
809
|
+
switch (_c.label) {
|
|
758
810
|
case 0:
|
|
811
|
+
transactionManager = (_a = this.transactionManager_) !== null && _a !== void 0 ? _a : this.manager_;
|
|
759
812
|
productOptions = variantOp["variant.options"] || [];
|
|
760
|
-
|
|
813
|
+
productServiceTx = this.productService_.withTransaction(transactionManager);
|
|
814
|
+
_c.label = 1;
|
|
761
815
|
case 1:
|
|
762
|
-
|
|
816
|
+
_c.trys.push([1, 6, 7, 8]);
|
|
763
817
|
productOptions_1 = __values(productOptions), productOptions_1_1 = productOptions_1.next();
|
|
764
|
-
|
|
818
|
+
_c.label = 2;
|
|
765
819
|
case 2:
|
|
766
820
|
if (!!productOptions_1_1.done) return [3 /*break*/, 5];
|
|
767
821
|
o = productOptions_1_1.value;
|
|
768
|
-
return [4 /*yield*/,
|
|
822
|
+
return [4 /*yield*/, productServiceTx.retrieveOptionByTitle(o._title, productId)];
|
|
769
823
|
case 3:
|
|
770
|
-
option =
|
|
824
|
+
option = _c.sent();
|
|
771
825
|
o.option_id = option === null || option === void 0 ? void 0 : option.id;
|
|
772
|
-
|
|
826
|
+
_c.label = 4;
|
|
773
827
|
case 4:
|
|
774
828
|
productOptions_1_1 = productOptions_1.next();
|
|
775
829
|
return [3 /*break*/, 2];
|
|
776
830
|
case 5: return [3 /*break*/, 8];
|
|
777
831
|
case 6:
|
|
778
|
-
|
|
779
|
-
|
|
832
|
+
e_15_1 = _c.sent();
|
|
833
|
+
e_15 = { error: e_15_1 };
|
|
780
834
|
return [3 /*break*/, 8];
|
|
781
835
|
case 7:
|
|
782
836
|
try {
|
|
783
|
-
if (productOptions_1_1 && !productOptions_1_1.done && (
|
|
837
|
+
if (productOptions_1_1 && !productOptions_1_1.done && (_b = productOptions_1.return)) _b.call(productOptions_1);
|
|
784
838
|
}
|
|
785
|
-
finally { if (
|
|
839
|
+
finally { if (e_15) throw e_15.error; }
|
|
786
840
|
return [7 /*endfinally*/];
|
|
787
841
|
case 8: return [2 /*return*/];
|
|
788
842
|
}
|
|
@@ -816,7 +870,7 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
816
870
|
return [4 /*yield*/, this.fileService_
|
|
817
871
|
.withTransaction(transactionManager)
|
|
818
872
|
.getUploadStreamDescriptor({
|
|
819
|
-
name:
|
|
873
|
+
name: ProductImportStrategy.buildFilename(batchJobId, op),
|
|
820
874
|
ext: "json",
|
|
821
875
|
})];
|
|
822
876
|
case 2:
|
|
@@ -854,7 +908,9 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
854
908
|
return [4 /*yield*/, this.fileService_
|
|
855
909
|
.withTransaction(transactionManager)
|
|
856
910
|
.getDownloadStream({
|
|
857
|
-
fileKey:
|
|
911
|
+
fileKey: ProductImportStrategy.buildFilename(batchJobId, op, {
|
|
912
|
+
appendExt: ".json",
|
|
913
|
+
}),
|
|
858
914
|
})];
|
|
859
915
|
case 1:
|
|
860
916
|
readableStream = _b.sent();
|
|
@@ -883,31 +939,51 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
883
939
|
ProductImportStrategy.prototype.deleteOpsFiles = function (batchJobId) {
|
|
884
940
|
var _a;
|
|
885
941
|
return __awaiter(this, void 0, void 0, function () {
|
|
886
|
-
var transactionManager, _b, _c, op;
|
|
887
|
-
var
|
|
942
|
+
var transactionManager, fileServiceTx, _b, _c, op, e_16, e_17_1;
|
|
943
|
+
var e_17, _d;
|
|
888
944
|
return __generator(this, function (_e) {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
945
|
+
switch (_e.label) {
|
|
946
|
+
case 0:
|
|
947
|
+
transactionManager = (_a = this.transactionManager_) !== null && _a !== void 0 ? _a : this.manager_;
|
|
948
|
+
fileServiceTx = this.fileService_.withTransaction(transactionManager);
|
|
949
|
+
_e.label = 1;
|
|
950
|
+
case 1:
|
|
951
|
+
_e.trys.push([1, 8, 9, 10]);
|
|
952
|
+
_b = __values(Object.values(types_1.OperationType)), _c = _b.next();
|
|
953
|
+
_e.label = 2;
|
|
954
|
+
case 2:
|
|
955
|
+
if (!!_c.done) return [3 /*break*/, 7];
|
|
892
956
|
op = _c.value;
|
|
957
|
+
_e.label = 3;
|
|
958
|
+
case 3:
|
|
959
|
+
_e.trys.push([3, 5, , 6]);
|
|
960
|
+
return [4 /*yield*/, fileServiceTx.delete({
|
|
961
|
+
fileKey: ProductImportStrategy.buildFilename(batchJobId, op, {
|
|
962
|
+
appendExt: ".json",
|
|
963
|
+
}),
|
|
964
|
+
})];
|
|
965
|
+
case 4:
|
|
966
|
+
_e.sent();
|
|
967
|
+
return [3 /*break*/, 6];
|
|
968
|
+
case 5:
|
|
969
|
+
e_16 = _e.sent();
|
|
970
|
+
return [3 /*break*/, 6];
|
|
971
|
+
case 6:
|
|
972
|
+
_c = _b.next();
|
|
973
|
+
return [3 /*break*/, 2];
|
|
974
|
+
case 7: return [3 /*break*/, 10];
|
|
975
|
+
case 8:
|
|
976
|
+
e_17_1 = _e.sent();
|
|
977
|
+
e_17 = { error: e_17_1 };
|
|
978
|
+
return [3 /*break*/, 10];
|
|
979
|
+
case 9:
|
|
893
980
|
try {
|
|
894
|
-
|
|
895
|
-
fileKey: "imports/products/ops/-".concat(batchJobId, "-").concat(op),
|
|
896
|
-
});
|
|
981
|
+
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
897
982
|
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
904
|
-
finally {
|
|
905
|
-
try {
|
|
906
|
-
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
907
|
-
}
|
|
908
|
-
finally { if (e_15) throw e_15.error; }
|
|
983
|
+
finally { if (e_17) throw e_17.error; }
|
|
984
|
+
return [7 /*endfinally*/];
|
|
985
|
+
case 10: return [2 /*return*/];
|
|
909
986
|
}
|
|
910
|
-
return [2 /*return*/];
|
|
911
987
|
});
|
|
912
988
|
});
|
|
913
989
|
};
|
|
@@ -915,29 +991,33 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
915
991
|
* Update count of processed data in the batch job `result` column
|
|
916
992
|
* and cleanup temp JSON files.
|
|
917
993
|
*
|
|
918
|
-
* @param
|
|
994
|
+
* @param batchJob - The current batch job being processed.
|
|
919
995
|
*/
|
|
920
|
-
ProductImportStrategy.prototype.finalize = function (
|
|
996
|
+
ProductImportStrategy.prototype.finalize = function (batchJob) {
|
|
997
|
+
var _a;
|
|
921
998
|
return __awaiter(this, void 0, void 0, function () {
|
|
922
|
-
var
|
|
923
|
-
return __generator(this, function (
|
|
924
|
-
switch (
|
|
925
|
-
case 0:
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
999
|
+
var transactionManager, fileKey;
|
|
1000
|
+
return __generator(this, function (_b) {
|
|
1001
|
+
switch (_b.label) {
|
|
1002
|
+
case 0:
|
|
1003
|
+
transactionManager = (_a = this.transactionManager_) !== null && _a !== void 0 ? _a : this.manager_;
|
|
1004
|
+
delete this.processedCounter[batchJob.id];
|
|
1005
|
+
return [4 /*yield*/, this.batchJobService_
|
|
1006
|
+
.withTransaction(transactionManager)
|
|
1007
|
+
.update(batchJob.id, {
|
|
930
1008
|
result: { advancement_count: batchJob.result.count },
|
|
931
1009
|
})];
|
|
932
|
-
case
|
|
933
|
-
|
|
1010
|
+
case 1:
|
|
1011
|
+
_b.sent();
|
|
934
1012
|
fileKey = batchJob.context.fileKey;
|
|
935
|
-
return [4 /*yield*/, this.fileService_
|
|
1013
|
+
return [4 /*yield*/, this.fileService_
|
|
1014
|
+
.withTransaction(transactionManager)
|
|
1015
|
+
.delete({ fileKey: fileKey })];
|
|
1016
|
+
case 2:
|
|
1017
|
+
_b.sent();
|
|
1018
|
+
return [4 /*yield*/, this.deleteOpsFiles(batchJob.id)];
|
|
936
1019
|
case 3:
|
|
937
|
-
|
|
938
|
-
return [4 /*yield*/, this.deleteOpsFiles(batchJobId)];
|
|
939
|
-
case 4:
|
|
940
|
-
_a.sent();
|
|
1020
|
+
_b.sent();
|
|
941
1021
|
return [2 /*return*/];
|
|
942
1022
|
}
|
|
943
1023
|
});
|
|
@@ -951,28 +1031,36 @@ var ProductImportStrategy = /** @class */ (function (_super) {
|
|
|
951
1031
|
* @param batchJobId - An id of the current batch job being processed.
|
|
952
1032
|
*/
|
|
953
1033
|
ProductImportStrategy.prototype.updateProgress = function (batchJobId) {
|
|
1034
|
+
var _a;
|
|
954
1035
|
return __awaiter(this, void 0, void 0, function () {
|
|
955
1036
|
var newCount;
|
|
956
|
-
return __generator(this, function (
|
|
957
|
-
switch (
|
|
1037
|
+
return __generator(this, function (_b) {
|
|
1038
|
+
switch (_b.label) {
|
|
958
1039
|
case 0:
|
|
959
1040
|
newCount = (this.processedCounter[batchJobId] || 0) + 1;
|
|
960
1041
|
this.processedCounter[batchJobId] = newCount;
|
|
961
1042
|
if (newCount % BATCH_SIZE !== 0) {
|
|
962
1043
|
return [2 /*return*/];
|
|
963
1044
|
}
|
|
964
|
-
return [4 /*yield*/, this.batchJobService_
|
|
1045
|
+
return [4 /*yield*/, this.batchJobService_
|
|
1046
|
+
.withTransaction((_a = this.transactionManager_) !== null && _a !== void 0 ? _a : this.manager_)
|
|
1047
|
+
.update(batchJobId, {
|
|
965
1048
|
result: {
|
|
966
1049
|
advancement_count: newCount,
|
|
967
1050
|
},
|
|
968
1051
|
})];
|
|
969
1052
|
case 1:
|
|
970
|
-
|
|
1053
|
+
_b.sent();
|
|
971
1054
|
return [2 /*return*/];
|
|
972
1055
|
}
|
|
973
1056
|
});
|
|
974
1057
|
});
|
|
975
1058
|
};
|
|
1059
|
+
ProductImportStrategy.buildFilename = function (batchJobId, operation, _a) {
|
|
1060
|
+
var _b = _a === void 0 ? { appendExt: undefined } : _a, appendExt = _b.appendExt;
|
|
1061
|
+
var filename = "imports/products/ops/".concat(batchJobId, "-").concat(operation);
|
|
1062
|
+
return appendExt ? filename + appendExt : filename;
|
|
1063
|
+
};
|
|
976
1064
|
ProductImportStrategy.identifier = "product-import-strategy";
|
|
977
1065
|
ProductImportStrategy.batchType = "product-import";
|
|
978
1066
|
return ProductImportStrategy;
|
|
@@ -1004,7 +1092,7 @@ var CSVSchema = {
|
|
|
1004
1092
|
{ name: "Product Height", mapTo: "product.height" },
|
|
1005
1093
|
{ name: "Product HS Code", mapTo: "product.hs_code" },
|
|
1006
1094
|
{ name: "Product Origin Country", mapTo: "product.origin_country" },
|
|
1007
|
-
{ name: "Product
|
|
1095
|
+
{ name: "Product MID Code", mapTo: "product.mid_code" },
|
|
1008
1096
|
{ name: "Product Material", mapTo: "product.material" },
|
|
1009
1097
|
// PRODUCT-COLLECTION
|
|
1010
1098
|
{ name: "Product Collection Title", mapTo: "product.collection.title" },
|
|
@@ -1042,7 +1130,7 @@ var CSVSchema = {
|
|
|
1042
1130
|
{ name: "Variant Height", mapTo: "variant.height" },
|
|
1043
1131
|
{ name: "Variant HS Code", mapTo: "variant.hs_code" },
|
|
1044
1132
|
{ name: "Variant Origin Country", mapTo: "variant.origin_country" },
|
|
1045
|
-
{ name: "Variant
|
|
1133
|
+
{ name: "Variant MID Code", mapTo: "variant.mid_code" },
|
|
1046
1134
|
{ name: "Variant Material", mapTo: "variant.material" },
|
|
1047
1135
|
// ==== DYNAMIC FIELDS ====
|
|
1048
1136
|
// PRODUCT_OPTIONS
|