@medusajs/core-flows 0.0.8 → 0.0.9-next-20240429170320
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/dist/api-key/steps/index.d.ts +3 -1
- package/dist/api-key/steps/index.js +3 -1
- package/dist/api-key/steps/link-sales-channels-to-publishable-key.d.ts +3 -0
- package/dist/api-key/steps/link-sales-channels-to-publishable-key.js +53 -0
- package/dist/api-key/steps/validate-sales-channel-exists.d.ts +6 -0
- package/dist/api-key/steps/validate-sales-channel-exists.js +17 -0
- package/dist/api-key/workflows/delete-api-keys.js +7 -1
- package/dist/api-key/workflows/index.d.ts +1 -0
- package/dist/api-key/workflows/index.js +1 -0
- package/dist/api-key/workflows/link-sales-channels-to-publishable-key.d.ts +3 -0
- package/dist/api-key/workflows/link-sales-channels-to-publishable-key.js +12 -0
- package/dist/common/index.d.ts +2 -0
- package/dist/common/index.js +18 -0
- package/dist/common/steps/remove-remote-links.d.ts +1 -1
- package/dist/common/steps/remove-remote-links.js +1 -1
- package/dist/common/steps/use-remote-query.d.ts +1 -0
- package/dist/common/steps/use-remote-query.js +6 -4
- package/dist/customer/steps/delete-addresses.js +1 -1
- package/dist/customer/steps/maybe-unset-default-billing-addresses.d.ts +2 -2
- package/dist/customer/steps/maybe-unset-default-shipping-addresses.d.ts +2 -2
- package/dist/customer/steps/update-addresses.d.ts +3 -3
- package/dist/customer/steps/utils/unset-address-for-update.d.ts +2 -2
- package/dist/customer/workflows/update-addresses.d.ts +2 -2
- package/dist/customer-group/steps/index.d.ts +1 -2
- package/dist/customer-group/steps/index.js +1 -2
- package/dist/customer-group/steps/link-customers-customer-group.d.ts +3 -0
- package/dist/customer-group/steps/link-customers-customer-group.js +42 -0
- package/dist/customer-group/workflows/index.d.ts +1 -2
- package/dist/customer-group/workflows/index.js +1 -2
- package/dist/customer-group/workflows/link-customers-customer-group.d.ts +3 -0
- package/dist/customer-group/workflows/link-customers-customer-group.js +9 -0
- package/dist/definition/cart/steps/add-shipping-method-to-cart.js +3 -3
- package/dist/definition/cart/steps/add-to-cart.js +3 -3
- package/dist/definition/cart/steps/confirm-inventory.js +4 -4
- package/dist/definition/cart/steps/create-payment-collection.d.ts +2 -1
- package/dist/definition/cart/steps/get-item-tax-lines.js +3 -3
- package/dist/definition/cart/steps/index.d.ts +2 -0
- package/dist/definition/cart/steps/index.js +2 -0
- package/dist/definition/cart/steps/refresh-cart-shipping-methods.d.ts +7 -0
- package/dist/definition/cart/steps/refresh-cart-shipping-methods.js +39 -0
- package/dist/definition/cart/steps/update-tax-lines.js +1 -1
- package/dist/definition/cart/steps/validate-cart-shipping-options.d.ts +8 -0
- package/dist/definition/cart/steps/validate-cart-shipping-options.js +30 -0
- package/dist/definition/cart/utils/fields.d.ts +1 -0
- package/dist/definition/cart/utils/fields.js +15 -0
- package/dist/definition/cart/utils/prepare-confirm-inventory-input.d.ts +2 -1
- package/dist/definition/cart/utils/prepare-confirm-inventory-input.js +10 -9
- package/dist/definition/cart/utils/prepare-line-item-data.d.ts +3 -3
- package/dist/definition/cart/utils/prepare-line-item-data.js +4 -1
- package/dist/definition/cart/workflows/add-shipping-method-to-cart.d.ts +0 -1
- package/dist/definition/cart/workflows/add-shipping-method-to-cart.js +17 -9
- package/dist/definition/cart/workflows/add-to-cart.js +12 -7
- package/dist/definition/cart/workflows/update-cart.js +9 -0
- package/dist/definition/cart/workflows/update-line-item-in-cart.js +13 -7
- package/dist/definition/payment-collection/steps/create-payment-session.d.ts +2 -2
- package/dist/definitions.d.ts +12 -12
- package/dist/definitions.js +12 -12
- package/dist/file/index.d.ts +2 -0
- package/dist/file/index.js +18 -0
- package/dist/file/steps/delete-files.d.ts +2 -0
- package/dist/file/steps/delete-files.js +11 -0
- package/dist/file/steps/index.d.ts +2 -0
- package/dist/file/steps/index.js +18 -0
- package/dist/file/steps/upload-files.d.ts +10 -0
- package/dist/file/steps/upload-files.js +17 -0
- package/dist/file/workflows/delete-files.d.ts +6 -0
- package/dist/file/workflows/delete-files.js +9 -0
- package/dist/file/workflows/index.d.ts +2 -0
- package/dist/file/workflows/index.js +18 -0
- package/dist/file/workflows/upload-files.d.ts +11 -0
- package/dist/file/workflows/upload-files.js +9 -0
- package/dist/fulfillment/steps/add-shipping-options-prices.d.ts +18 -0
- package/dist/fulfillment/steps/add-shipping-options-prices.js +66 -0
- package/dist/fulfillment/steps/cancel-fulfillment.d.ts +2 -0
- package/dist/fulfillment/steps/cancel-fulfillment.js +11 -0
- package/dist/fulfillment/steps/create-fulfillment-set.d.ts +3 -0
- package/dist/fulfillment/steps/create-fulfillment-set.js +17 -0
- package/dist/fulfillment/steps/create-fulfillment.d.ts +3 -0
- package/dist/fulfillment/steps/create-fulfillment.js +17 -0
- package/dist/fulfillment/steps/create-service-zones.d.ts +5 -0
- package/dist/fulfillment/steps/create-service-zones.js +17 -0
- package/dist/fulfillment/steps/create-shipping-option-rules.d.ts +3 -0
- package/dist/fulfillment/steps/{add-rules-to-fulfillment-shipping-option.js → create-shipping-option-rules.js} +3 -3
- package/dist/fulfillment/steps/create-shipping-profiles.d.ts +5 -0
- package/dist/fulfillment/steps/create-shipping-profiles.js +17 -0
- package/dist/fulfillment/steps/delete-fulfillment-sets.d.ts +2 -0
- package/dist/fulfillment/steps/delete-fulfillment-sets.js +17 -0
- package/dist/fulfillment/steps/delete-service-zones.d.ts +2 -0
- package/dist/fulfillment/steps/delete-service-zones.js +17 -0
- package/dist/fulfillment/steps/delete-shipping-option-rules.d.ts +3 -0
- package/dist/fulfillment/steps/{remove-rules-from-fulfillment-shipping-option.js → delete-shipping-option-rules.js} +3 -3
- package/dist/fulfillment/steps/delete-shipping-options.d.ts +3 -0
- package/dist/fulfillment/steps/delete-shipping-options.js +23 -0
- package/dist/fulfillment/steps/index.d.ts +15 -2
- package/dist/fulfillment/steps/index.js +15 -2
- package/dist/fulfillment/steps/set-shipping-options-price-sets.d.ts +7 -0
- package/dist/fulfillment/steps/set-shipping-options-price-sets.js +102 -0
- package/dist/fulfillment/steps/set-shipping-options-prices.d.ts +8 -0
- package/dist/fulfillment/steps/set-shipping-options-prices.js +111 -0
- package/dist/fulfillment/steps/update-fulfillment-workflow.d.ts +3 -0
- package/dist/fulfillment/steps/update-fulfillment-workflow.js +21 -0
- package/dist/fulfillment/steps/update-fulfillment.d.ts +3 -0
- package/dist/fulfillment/steps/update-fulfillment.js +27 -0
- package/dist/fulfillment/steps/update-service-zones.d.ts +3 -0
- package/dist/fulfillment/steps/update-service-zones.js +25 -0
- package/dist/fulfillment/steps/upsert-shipping-options.d.ts +5 -0
- package/dist/fulfillment/steps/upsert-shipping-options.js +49 -0
- package/dist/fulfillment/steps/validate-shipment.d.ts +2 -0
- package/dist/fulfillment/steps/validate-shipment.js +23 -0
- package/dist/fulfillment/workflows/batch-shipping-option-rules.d.ts +3 -0
- package/dist/fulfillment/workflows/batch-shipping-option-rules.js +21 -0
- package/dist/fulfillment/workflows/cancel-fulfillment.d.ts +4 -0
- package/dist/fulfillment/workflows/cancel-fulfillment.js +9 -0
- package/dist/fulfillment/workflows/create-fulfillment.d.ts +3 -0
- package/dist/fulfillment/workflows/create-fulfillment.js +9 -0
- package/dist/fulfillment/workflows/create-service-zones.d.ts +3 -0
- package/dist/fulfillment/workflows/create-service-zones.js +10 -0
- package/dist/fulfillment/workflows/create-shipment.d.ts +3 -0
- package/dist/fulfillment/workflows/create-shipment.js +15 -0
- package/dist/fulfillment/workflows/create-shipping-options.d.ts +3 -0
- package/dist/fulfillment/workflows/create-shipping-options.js +62 -0
- package/dist/fulfillment/workflows/create-shipping-profiles.d.ts +3 -0
- package/dist/fulfillment/workflows/create-shipping-profiles.js +10 -0
- package/dist/fulfillment/workflows/delete-fulfillment-sets.d.ts +4 -0
- package/dist/fulfillment/workflows/delete-fulfillment-sets.js +14 -0
- package/dist/fulfillment/workflows/delete-service-zones.d.ts +4 -0
- package/dist/fulfillment/workflows/delete-service-zones.js +9 -0
- package/dist/fulfillment/workflows/delete-shipping-options.d.ts +3 -0
- package/dist/fulfillment/workflows/delete-shipping-options.js +11 -0
- package/dist/fulfillment/workflows/index.d.ts +13 -2
- package/dist/fulfillment/workflows/index.js +13 -2
- package/dist/fulfillment/workflows/update-fulfillment.d.ts +3 -0
- package/dist/fulfillment/workflows/update-fulfillment.js +9 -0
- package/dist/fulfillment/workflows/update-service-zones.d.ts +3 -0
- package/dist/fulfillment/workflows/update-service-zones.js +10 -0
- package/dist/fulfillment/workflows/update-shipping-options.d.ts +3 -0
- package/dist/fulfillment/workflows/update-shipping-options.js +51 -0
- package/dist/handlers/product/create-product-variants-prepare-data.d.ts +4 -4
- package/dist/handlers/product/create-product-variants.d.ts +4 -4
- package/dist/handlers/product/create-products-prepare-data.d.ts +4 -4
- package/dist/handlers/product/update-product-variants-prepare-data.d.ts +4 -4
- package/dist/handlers/product/update-products-prepare-data.d.ts +4 -4
- package/dist/handlers/product/upsert-variant-prices.d.ts +4 -4
- package/dist/index.d.ts +7 -1
- package/dist/index.js +7 -1
- package/dist/inventory/steps/create-inventory-items.js +3 -3
- package/dist/inventory/steps/create-inventory-levels.d.ts +2 -2
- package/dist/inventory/steps/delete-levels-by-item-and-location.d.ts +6 -0
- package/dist/inventory/steps/delete-levels-by-item-and-location.js +31 -0
- package/dist/inventory/steps/index.d.ts +1 -0
- package/dist/inventory/steps/index.js +1 -0
- package/dist/inventory/steps/validate-inventory-locations.d.ts +2 -2
- package/dist/inventory/workflows/bulk-create-delete-levels.d.ts +11 -0
- package/dist/inventory/workflows/bulk-create-delete-levels.js +12 -0
- package/dist/inventory/workflows/create-inventory-levels.d.ts +2 -2
- package/dist/inventory/workflows/index.d.ts +1 -0
- package/dist/inventory/workflows/index.js +1 -0
- package/dist/invite/workflows/accept-invite.d.ts +1 -2
- package/dist/invite/workflows/accept-invite.js +3 -4
- package/dist/order/index.d.ts +2 -0
- package/dist/order/index.js +18 -0
- package/dist/order/steps/create-orders.d.ts +5 -0
- package/dist/order/steps/create-orders.js +17 -0
- package/dist/order/steps/get-item-tax-lines.d.ts +13 -0
- package/dist/order/steps/get-item-tax-lines.js +73 -0
- package/dist/order/steps/index.d.ts +4 -0
- package/dist/order/steps/index.js +20 -0
- package/dist/order/steps/set-tax-lines-for-items.d.ts +9 -0
- package/dist/order/steps/set-tax-lines-for-items.js +80 -0
- package/dist/order/steps/update-tax-lines.d.ts +10 -0
- package/dist/order/steps/update-tax-lines.js +19 -0
- package/dist/order/utils/prepare-custom-line-item-data.d.ts +22 -0
- package/dist/order/utils/prepare-custom-line-item-data.js +17 -0
- package/dist/order/workflows/create-orders.d.ts +3 -0
- package/dist/order/workflows/create-orders.js +143 -0
- package/dist/order/workflows/index.d.ts +2 -0
- package/dist/order/workflows/index.js +18 -0
- package/dist/order/workflows/update-tax-lines.d.ts +10 -0
- package/dist/order/workflows/update-tax-lines.js +70 -0
- package/dist/payment/steps/capture-payment.d.ts +2 -1
- package/dist/payment/steps/refund-payment.d.ts +2 -1
- package/dist/payment/workflows/capture-payment.d.ts +2 -2
- package/dist/payment/workflows/refund-payment.d.ts +2 -1
- package/dist/price-list/steps/create-price-list-prices-workflow.d.ts +3 -0
- package/dist/price-list/steps/create-price-list-prices-workflow.js +15 -0
- package/dist/price-list/steps/create-price-list-prices.d.ts +1 -1
- package/dist/price-list/steps/create-price-list-prices.js +1 -1
- package/dist/price-list/steps/get-existing-price-lists-price-ids.js +1 -1
- package/dist/price-list/steps/index.d.ts +3 -1
- package/dist/price-list/steps/index.js +3 -1
- package/dist/price-list/steps/remove-price-list-prices-workflow.d.ts +2 -0
- package/dist/price-list/steps/remove-price-list-prices-workflow.js +15 -0
- package/dist/price-list/steps/remove-price-list-prices.d.ts +1 -1
- package/dist/price-list/steps/remove-price-list-prices.js +4 -3
- package/dist/price-list/steps/update-price-list-prices-workflow.d.ts +3 -0
- package/dist/price-list/steps/update-price-list-prices-workflow.js +15 -0
- package/dist/price-list/steps/update-price-list-prices.d.ts +2 -2
- package/dist/price-list/steps/update-price-list-prices.js +2 -2
- package/dist/price-list/steps/validate-variant-price-links.d.ts +5 -2
- package/dist/price-list/workflows/batch-price-list-prices.d.ts +5 -0
- package/dist/price-list/workflows/batch-price-list-prices.js +18 -0
- package/dist/price-list/workflows/create-price-list-prices.d.ts +2 -1
- package/dist/price-list/workflows/create-price-list-prices.js +5 -3
- package/dist/price-list/workflows/index.d.ts +2 -1
- package/dist/price-list/workflows/index.js +2 -1
- package/dist/price-list/workflows/remove-price-list-prices.d.ts +1 -1
- package/dist/price-list/workflows/remove-price-list-prices.js +2 -2
- package/dist/price-list/workflows/update-price-list-prices.d.ts +6 -0
- package/dist/price-list/workflows/update-price-list-prices.js +15 -0
- package/dist/price-list/workflows/update-price-lists.js +2 -19
- package/dist/pricing/steps/create-pricing-rule-types.js +9 -1
- package/dist/pricing/steps/update-price-sets.d.ts +9 -2
- package/dist/pricing/steps/update-price-sets.js +22 -9
- package/dist/pricing/steps/update-pricing-rule-types.js +1 -1
- package/dist/product/steps/batch-link-products-collection.d.ts +3 -0
- package/dist/product/steps/batch-link-products-collection.js +38 -0
- package/dist/product/steps/batch-link-products-in-category.d.ts +3 -0
- package/dist/product/steps/batch-link-products-in-category.js +63 -0
- package/dist/product/steps/batch-product-variants.d.ts +11 -0
- package/dist/product/steps/batch-product-variants.js +59 -0
- package/dist/product/steps/batch-products.d.ts +11 -0
- package/dist/product/steps/batch-products.js +59 -0
- package/dist/product/steps/create-product-types.d.ts +3 -0
- package/dist/product/steps/create-product-types.js +17 -0
- package/dist/product/steps/delete-product-types.d.ts +2 -0
- package/dist/product/steps/delete-product-types.js +17 -0
- package/dist/product/steps/get-variant-pricing-link.d.ts +6 -0
- package/dist/product/steps/get-variant-pricing-link.js +20 -0
- package/dist/product/steps/index.d.ts +6 -1
- package/dist/product/steps/index.js +6 -1
- package/dist/product/steps/update-product-options.js +6 -1
- package/dist/product/steps/update-product-types.d.ts +8 -0
- package/dist/product/steps/update-product-types.js +25 -0
- package/dist/product/steps/update-product-variants.d.ts +2 -0
- package/dist/product/steps/update-product-variants.js +10 -0
- package/dist/product/steps/update-products.d.ts +2 -0
- package/dist/product/steps/update-products.js +10 -0
- package/dist/product/workflows/batch-link-products-collection.d.ts +3 -0
- package/dist/product/workflows/batch-link-products-collection.js +9 -0
- package/dist/product/workflows/batch-product-variants.d.ts +3 -0
- package/dist/product/workflows/batch-product-variants.js +9 -0
- package/dist/product/workflows/batch-products-in-category.d.ts +3 -0
- package/dist/product/workflows/batch-products-in-category.js +11 -0
- package/dist/product/workflows/batch-products.d.ts +4 -0
- package/dist/product/workflows/batch-products.js +9 -0
- package/dist/product/workflows/create-product-types.d.ts +7 -0
- package/dist/product/workflows/create-product-types.js +9 -0
- package/dist/product/workflows/create-product-variants.js +8 -13
- package/dist/product/workflows/create-products.d.ts +3 -6
- package/dist/product/workflows/create-products.js +28 -23
- package/dist/product/workflows/delete-product-types.d.ts +6 -0
- package/dist/product/workflows/delete-product-types.js +9 -0
- package/dist/product/workflows/delete-product-variants.js +5 -1
- package/dist/product/workflows/delete-products.js +12 -4
- package/dist/product/workflows/index.d.ts +15 -8
- package/dist/product/workflows/index.js +15 -8
- package/dist/product/workflows/update-product-types.d.ts +8 -0
- package/dist/product/workflows/update-product-types.js +9 -0
- package/dist/product/workflows/update-product-variants.d.ts +8 -2
- package/dist/product/workflows/update-product-variants.js +71 -1
- package/dist/product/workflows/update-products.d.ts +2 -0
- package/dist/product/workflows/update-products.js +4 -2
- package/dist/product-category/index.d.ts +2 -0
- package/dist/product-category/index.js +18 -0
- package/dist/product-category/steps/create-product-category.d.ts +7 -0
- package/dist/product-category/steps/create-product-category.js +17 -0
- package/dist/product-category/steps/index.d.ts +1 -0
- package/dist/product-category/steps/index.js +17 -0
- package/dist/product-category/steps/update-product-category.d.ts +8 -0
- package/dist/product-category/steps/update-product-category.js +36 -0
- package/dist/product-category/workflows/create-product-category.d.ts +3 -0
- package/dist/product-category/workflows/create-product-category.js +10 -0
- package/dist/product-category/workflows/index.d.ts +2 -0
- package/dist/product-category/workflows/index.js +18 -0
- package/dist/product-category/workflows/update-product-category.d.ts +3 -0
- package/dist/product-category/workflows/update-product-category.js +10 -0
- package/dist/promotion/steps/create-promotion-rules-workflow.d.ts +3 -0
- package/dist/promotion/steps/create-promotion-rules-workflow.js +21 -0
- package/dist/promotion/steps/delete-promotion-rules-workflow.d.ts +7 -0
- package/dist/promotion/steps/delete-promotion-rules-workflow.js +25 -0
- package/dist/promotion/steps/update-promotion-rules-workflow.d.ts +3 -0
- package/dist/promotion/steps/update-promotion-rules-workflow.js +21 -0
- package/dist/promotion/workflows/batch-promotion-rules.d.ts +7 -0
- package/dist/promotion/workflows/batch-promotion-rules.js +23 -0
- package/dist/promotion/workflows/create-promotion-rules.d.ts +3 -0
- package/dist/promotion/workflows/create-promotion-rules.js +9 -0
- package/dist/promotion/workflows/delete-promotion-rules.d.ts +3 -0
- package/dist/promotion/workflows/delete-promotion-rules.js +9 -0
- package/dist/promotion/workflows/index.d.ts +3 -2
- package/dist/promotion/workflows/index.js +3 -2
- package/dist/promotion/workflows/update-promotion-rules.d.ts +2 -2
- package/dist/promotion/workflows/update-promotion-rules.js +1 -1
- package/dist/region/steps/set-regions-payment-providers.d.ts +8 -0
- package/dist/region/steps/set-regions-payment-providers.js +117 -0
- package/dist/region/steps/update-regions.js +4 -1
- package/dist/region/workflows/create-regions.d.ts +2 -6
- package/dist/region/workflows/create-regions.js +29 -1
- package/dist/region/workflows/update-regions.d.ts +2 -7
- package/dist/region/workflows/update-regions.js +23 -1
- package/dist/reservation/index.d.ts +2 -0
- package/dist/reservation/index.js +18 -0
- package/dist/reservation/steps/create-reservations.d.ts +3 -0
- package/dist/reservation/steps/create-reservations.js +17 -0
- package/dist/reservation/steps/delete-reservations.d.ts +2 -0
- package/dist/reservation/steps/delete-reservations.js +17 -0
- package/dist/reservation/steps/index.d.ts +3 -0
- package/dist/reservation/steps/index.js +19 -0
- package/dist/reservation/steps/update-reservations.d.ts +3 -0
- package/dist/reservation/steps/update-reservations.js +25 -0
- package/dist/reservation/workflows/create-reservations.d.ts +3 -0
- package/dist/reservation/workflows/create-reservations.js +9 -0
- package/dist/reservation/workflows/delete-reservations.d.ts +6 -0
- package/dist/reservation/workflows/delete-reservations.js +9 -0
- package/dist/reservation/workflows/index.d.ts +3 -0
- package/dist/reservation/workflows/index.js +19 -0
- package/dist/reservation/workflows/update-reservations.d.ts +3 -0
- package/dist/reservation/workflows/update-reservations.js +9 -0
- package/dist/sales-channel/steps/associate-locations-with-channels.d.ts +9 -0
- package/dist/sales-channel/steps/associate-locations-with-channels.js +31 -0
- package/dist/sales-channel/steps/associate-products-with-channels.d.ts +1 -1
- package/dist/sales-channel/steps/associate-products-with-channels.js +13 -14
- package/dist/sales-channel/steps/detach-locations-from-channels.d.ts +9 -0
- package/dist/sales-channel/steps/detach-locations-from-channels.js +31 -0
- package/dist/sales-channel/steps/detach-products-from-sales-channels.d.ts +9 -0
- package/dist/sales-channel/steps/detach-products-from-sales-channels.js +31 -0
- package/dist/sales-channel/steps/index.d.ts +3 -0
- package/dist/sales-channel/steps/index.js +3 -0
- package/dist/sales-channel/workflows/delete-sales-channels.js +6 -1
- package/dist/sales-channel/workflows/index.d.ts +1 -1
- package/dist/sales-channel/workflows/index.js +1 -1
- package/dist/sales-channel/workflows/link-products-to-sales-channel.d.ts +3 -0
- package/dist/sales-channel/workflows/link-products-to-sales-channel.js +24 -0
- package/dist/shipping-profile/index.d.ts +2 -0
- package/dist/shipping-profile/index.js +18 -0
- package/dist/shipping-profile/steps/delete-shipping-profile.d.ts +2 -0
- package/dist/shipping-profile/steps/delete-shipping-profile.js +17 -0
- package/dist/shipping-profile/steps/index.d.ts +1 -0
- package/dist/shipping-profile/steps/index.js +17 -0
- package/dist/shipping-profile/workflows/delete-shipping-profile.d.ts +4 -0
- package/dist/shipping-profile/workflows/delete-shipping-profile.js +14 -0
- package/dist/shipping-profile/workflows/index.d.ts +1 -0
- package/dist/shipping-profile/workflows/index.js +17 -0
- package/dist/stock-location/steps/associate-locations-with-fulfillment-sets.d.ts +9 -0
- package/dist/stock-location/steps/associate-locations-with-fulfillment-sets.js +35 -0
- package/dist/stock-location/steps/delete-stock-locations.js +3 -3
- package/dist/stock-location/steps/index.d.ts +1 -0
- package/dist/stock-location/steps/index.js +1 -0
- package/dist/stock-location/steps/update-stock-locations.d.ts +9 -0
- package/dist/stock-location/steps/update-stock-locations.js +30 -0
- package/dist/stock-location/workflows/create-location-fulfillment-set.d.ts +3 -0
- package/dist/stock-location/workflows/create-location-fulfillment-set.js +24 -0
- package/dist/stock-location/workflows/index.d.ts +3 -0
- package/dist/stock-location/workflows/index.js +3 -0
- package/dist/stock-location/workflows/link-sales-channels-to-stock-location.d.ts +3 -0
- package/dist/stock-location/workflows/link-sales-channels-to-stock-location.js +23 -0
- package/dist/stock-location/workflows/update-stock-locations.d.ts +10 -0
- package/dist/stock-location/workflows/update-stock-locations.js +9 -0
- package/package.json +6 -6
- package/dist/customer-group/steps/create-customer-group-customers.d.ts +0 -5
- package/dist/customer-group/steps/create-customer-group-customers.js +0 -17
- package/dist/customer-group/workflows/create-customer-group-customers.d.ts +0 -9
- package/dist/customer-group/workflows/create-customer-group-customers.js +0 -9
- package/dist/customer-group/workflows/delete-customer-group-customers.d.ts +0 -7
- package/dist/customer-group/workflows/delete-customer-group-customers.js +0 -9
- package/dist/fulfillment/steps/add-rules-to-fulfillment-shipping-option.d.ts +0 -3
- package/dist/fulfillment/steps/remove-rules-from-fulfillment-shipping-option.d.ts +0 -3
- package/dist/fulfillment/workflows/add-rules-to-fulfillment-shipping-option.d.ts +0 -3
- package/dist/fulfillment/workflows/add-rules-to-fulfillment-shipping-option.js +0 -9
- package/dist/fulfillment/workflows/remove-rules-from-fulfillment-shipping-option.d.ts +0 -3
- package/dist/fulfillment/workflows/remove-rules-from-fulfillment-shipping-option.js +0 -9
- package/dist/price-list/steps/upsert-price-list-prices.d.ts +0 -3
- package/dist/price-list/steps/upsert-price-list-prices.js +0 -84
- package/dist/price-list/workflows/upsert-price-list-prices.d.ts +0 -5
- package/dist/price-list/workflows/upsert-price-list-prices.js +0 -13
- package/dist/product/steps/remove-variant-pricing-link.d.ts +0 -6
- package/dist/product/steps/remove-variant-pricing-link.js +0 -25
- package/dist/promotion/workflows/add-rules-to-promotions.d.ts +0 -3
- package/dist/promotion/workflows/add-rules-to-promotions.js +0 -9
- package/dist/promotion/workflows/remove-rules-from-promotions.d.ts +0 -3
- package/dist/promotion/workflows/remove-rules-from-promotions.js +0 -9
- package/dist/sales-channel/workflows/add-products-to-sales-channels.d.ts +0 -10
- package/dist/sales-channel/workflows/add-products-to-sales-channels.js +0 -9
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from "./link-sales-channels-to-publishable-key";
|
|
1
2
|
export * from "./create-api-keys";
|
|
2
3
|
export * from "./delete-api-keys";
|
|
3
|
-
export * from "./update-api-keys";
|
|
4
4
|
export * from "./revoke-api-keys";
|
|
5
|
+
export * from "./update-api-keys";
|
|
6
|
+
export * from "./validate-sales-channel-exists";
|
|
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./link-sales-channels-to-publishable-key"), exports);
|
|
17
18
|
__exportStar(require("./create-api-keys"), exports);
|
|
18
19
|
__exportStar(require("./delete-api-keys"), exports);
|
|
19
|
-
__exportStar(require("./update-api-keys"), exports);
|
|
20
20
|
__exportStar(require("./revoke-api-keys"), exports);
|
|
21
|
+
__exportStar(require("./update-api-keys"), exports);
|
|
22
|
+
__exportStar(require("./validate-sales-channel-exists"), exports);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { LinkWorkflowInput } from "@medusajs/types/src";
|
|
2
|
+
export declare const linkSalesChannelsToApiKeyStepId = "link-sales-channels-to-api-key";
|
|
3
|
+
export declare const linkSalesChannelsToApiKeyStep: import("@medusajs/workflows-sdk").StepFunction<LinkWorkflowInput, undefined>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linkSalesChannelsToApiKeyStep = exports.linkSalesChannelsToApiKeyStepId = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
|
+
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
7
|
+
exports.linkSalesChannelsToApiKeyStepId = "link-sales-channels-to-api-key";
|
|
8
|
+
exports.linkSalesChannelsToApiKeyStep = (0, workflows_sdk_1.createStep)(exports.linkSalesChannelsToApiKeyStepId, async (input, { container }) => {
|
|
9
|
+
const remoteLink = container.resolve(utils_1.ContainerRegistrationKeys.REMOTE_LINK);
|
|
10
|
+
if (!input || (!input.add?.length && !input.remove?.length)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const linksToCreate = (input.add ?? []).map((salesChannelId) => {
|
|
14
|
+
return {
|
|
15
|
+
[modules_sdk_1.Modules.API_KEY]: {
|
|
16
|
+
publishable_key_id: input.id,
|
|
17
|
+
},
|
|
18
|
+
[modules_sdk_1.Modules.SALES_CHANNEL]: {
|
|
19
|
+
sales_channel_id: salesChannelId,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
const linksToDismiss = (input.remove ?? []).map((salesChannelId) => {
|
|
24
|
+
return {
|
|
25
|
+
[modules_sdk_1.Modules.API_KEY]: {
|
|
26
|
+
publishable_key_id: input.id,
|
|
27
|
+
},
|
|
28
|
+
[modules_sdk_1.Modules.SALES_CHANNEL]: {
|
|
29
|
+
sales_channel_id: salesChannelId,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
const promises = [];
|
|
34
|
+
if (linksToCreate.length) {
|
|
35
|
+
promises.push(remoteLink.create(linksToCreate));
|
|
36
|
+
}
|
|
37
|
+
if (linksToDismiss.length) {
|
|
38
|
+
promises.push(remoteLink.dismiss(linksToDismiss));
|
|
39
|
+
}
|
|
40
|
+
await (0, utils_1.promiseAll)(promises);
|
|
41
|
+
return new workflows_sdk_1.StepResponse(void 0, { linksToCreate, linksToDismiss });
|
|
42
|
+
}, async (prevData, { container }) => {
|
|
43
|
+
if (!prevData) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const remoteLink = container.resolve(utils_1.ContainerRegistrationKeys.REMOTE_LINK);
|
|
47
|
+
if (prevData.linksToCreate.length) {
|
|
48
|
+
await remoteLink.dismiss(prevData.linksToCreate);
|
|
49
|
+
}
|
|
50
|
+
if (prevData.linksToDismiss.length) {
|
|
51
|
+
await remoteLink.create(prevData.linksToDismiss);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
interface StepInput {
|
|
2
|
+
sales_channel_ids: string[];
|
|
3
|
+
}
|
|
4
|
+
export declare const validateSalesChannelsExistStepId = "validate-sales-channels-exist";
|
|
5
|
+
export declare const validateSalesChannelsExistStep: import("@medusajs/workflows-sdk").StepFunction<StepInput, string[]>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateSalesChannelsExistStep = exports.validateSalesChannelsExistStepId = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
|
+
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
7
|
+
exports.validateSalesChannelsExistStepId = "validate-sales-channels-exist";
|
|
8
|
+
exports.validateSalesChannelsExistStep = (0, workflows_sdk_1.createStep)(exports.validateSalesChannelsExistStepId, async (data, { container }) => {
|
|
9
|
+
const salesChannelModuleService = container.resolve(modules_sdk_1.ModuleRegistrationName.SALES_CHANNEL);
|
|
10
|
+
const salesChannels = await salesChannelModuleService.list({ id: data.sales_channel_ids }, { select: ["id"] });
|
|
11
|
+
const salesChannelIds = salesChannels.map((v) => v.id);
|
|
12
|
+
const notFound = (0, utils_1.arrayDifference)(data.sales_channel_ids, salesChannelIds);
|
|
13
|
+
if (notFound.length) {
|
|
14
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Sales channels with IDs ${notFound.join(", ")} do not exist`);
|
|
15
|
+
}
|
|
16
|
+
return new workflows_sdk_1.StepResponse(salesChannelIds);
|
|
17
|
+
});
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteApiKeysWorkflow = exports.deleteApiKeysWorkflowId = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
4
5
|
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
6
|
+
const remove_remote_links_1 = require("../../common/steps/remove-remote-links");
|
|
5
7
|
const steps_1 = require("../steps");
|
|
6
8
|
exports.deleteApiKeysWorkflowId = "delete-api-keys";
|
|
7
9
|
exports.deleteApiKeysWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.deleteApiKeysWorkflowId, (input) => {
|
|
8
|
-
|
|
10
|
+
(0, steps_1.deleteApiKeysStep)(input.ids);
|
|
11
|
+
// Please note, the ids here should be publishable key IDs
|
|
12
|
+
(0, remove_remote_links_1.removeRemoteLinkStep)({
|
|
13
|
+
[modules_sdk_1.Modules.API_KEY]: { publishable_key_id: input.ids },
|
|
14
|
+
});
|
|
9
15
|
});
|
|
@@ -18,3 +18,4 @@ __exportStar(require("./create-api-keys"), exports);
|
|
|
18
18
|
__exportStar(require("./delete-api-keys"), exports);
|
|
19
19
|
__exportStar(require("./update-api-keys"), exports);
|
|
20
20
|
__exportStar(require("./revoke-api-keys"), exports);
|
|
21
|
+
__exportStar(require("./link-sales-channels-to-publishable-key"), exports);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { LinkWorkflowInput } from "@medusajs/types/src";
|
|
2
|
+
export declare const linkSalesChannelsToApiKeyWorkflowId = "link-sales-channels-to-api-key";
|
|
3
|
+
export declare const linkSalesChannelsToApiKeyWorkflow: import("@medusajs/workflows-sdk").ReturnWorkflow<LinkWorkflowInput, void, Record<string, Function>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linkSalesChannelsToApiKeyWorkflow = exports.linkSalesChannelsToApiKeyWorkflowId = void 0;
|
|
4
|
+
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
5
|
+
const steps_1 = require("../steps");
|
|
6
|
+
exports.linkSalesChannelsToApiKeyWorkflowId = "link-sales-channels-to-api-key";
|
|
7
|
+
exports.linkSalesChannelsToApiKeyWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.linkSalesChannelsToApiKeyWorkflowId, (input) => {
|
|
8
|
+
(0, steps_1.validateSalesChannelsExistStep)({
|
|
9
|
+
sales_channel_ids: input.add ?? [],
|
|
10
|
+
});
|
|
11
|
+
(0, steps_1.linkSalesChannelsToApiKeyStep)(input);
|
|
12
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./steps/remove-remote-links"), exports);
|
|
18
|
+
__exportStar(require("./steps/use-remote-query"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeleteEntityInput } from "@medusajs/modules-sdk";
|
|
2
2
|
type RemoveRemoteLinksStepInput = DeleteEntityInput | DeleteEntityInput[];
|
|
3
3
|
export declare const removeRemoteLinkStepId = "remove-remote-links";
|
|
4
|
-
export declare const removeRemoteLinkStep: import("@medusajs/workflows-sdk").StepFunction<RemoveRemoteLinksStepInput,
|
|
4
|
+
export declare const removeRemoteLinkStep: import("@medusajs/workflows-sdk").StepFunction<RemoveRemoteLinksStepInput, DeleteEntityInput>;
|
|
5
5
|
export {};
|
|
@@ -22,7 +22,7 @@ exports.removeRemoteLinkStep = (0, workflows_sdk_1.createStep)(exports.removeRem
|
|
|
22
22
|
}
|
|
23
23
|
const link = container.resolve(utils_1.ContainerRegistrationKeys.REMOTE_LINK);
|
|
24
24
|
await link.delete(grouped);
|
|
25
|
-
return new workflows_sdk_1.StepResponse(
|
|
25
|
+
return new workflows_sdk_1.StepResponse(grouped, grouped);
|
|
26
26
|
}, async (removedLinks, { container }) => {
|
|
27
27
|
if (!removedLinks) {
|
|
28
28
|
return;
|
|
@@ -2,6 +2,7 @@ interface StepInput {
|
|
|
2
2
|
entry_point: string;
|
|
3
3
|
fields: string[];
|
|
4
4
|
variables?: Record<string, any>;
|
|
5
|
+
list?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare const useRemoteQueryStepId = "use-remote-query";
|
|
7
8
|
export declare const useRemoteQueryStep: import("@medusajs/workflows-sdk").StepFunction<StepInput, any>;
|
|
@@ -5,12 +5,14 @@ const utils_1 = require("@medusajs/utils");
|
|
|
5
5
|
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
6
6
|
exports.useRemoteQueryStepId = "use-remote-query";
|
|
7
7
|
exports.useRemoteQueryStep = (0, workflows_sdk_1.createStep)(exports.useRemoteQueryStepId, async (data, { container }) => {
|
|
8
|
+
const { list = true, fields, variables, entry_point: entryPoint } = data;
|
|
8
9
|
const query = container.resolve("remoteQuery");
|
|
9
10
|
const queryObject = (0, utils_1.remoteQueryObjectFromString)({
|
|
10
|
-
entryPoint
|
|
11
|
-
fields
|
|
12
|
-
variables
|
|
11
|
+
entryPoint,
|
|
12
|
+
fields,
|
|
13
|
+
variables,
|
|
13
14
|
});
|
|
14
|
-
const
|
|
15
|
+
const entities = await query(queryObject);
|
|
16
|
+
const result = list ? entities : entities[0];
|
|
15
17
|
return new workflows_sdk_1.StepResponse(result);
|
|
16
18
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteCustomerAddressesStep = exports.deleteCustomerAddressesStepId = void 0;
|
|
4
|
-
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
5
4
|
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
6
6
|
exports.deleteCustomerAddressesStepId = "delete-customer-addresses";
|
|
7
7
|
exports.deleteCustomerAddressesStep = (0, workflows_sdk_1.createStep)(exports.deleteCustomerAddressesStepId, async (ids, { container }) => {
|
|
8
8
|
const service = container.resolve(modules_sdk_1.ModuleRegistrationName.CUSTOMER);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CreateCustomerAddressDTO,
|
|
1
|
+
import { CreateCustomerAddressDTO, UpdateCustomerAddressDTO, FilterableCustomerAddressProps } from "@medusajs/types";
|
|
2
2
|
type StepInput = {
|
|
3
3
|
create?: CreateCustomerAddressDTO[];
|
|
4
4
|
update?: {
|
|
5
5
|
selector: FilterableCustomerAddressProps;
|
|
6
|
-
update:
|
|
6
|
+
update: UpdateCustomerAddressDTO;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
9
|
export declare const maybeUnsetDefaultBillingAddressesStepId = "maybe-unset-default-billing-customer-addresses";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CreateCustomerAddressDTO,
|
|
1
|
+
import { CreateCustomerAddressDTO, UpdateCustomerAddressDTO, FilterableCustomerAddressProps } from "@medusajs/types";
|
|
2
2
|
type StepInput = {
|
|
3
3
|
create?: CreateCustomerAddressDTO[];
|
|
4
4
|
update?: {
|
|
5
5
|
selector: FilterableCustomerAddressProps;
|
|
6
|
-
update:
|
|
6
|
+
update: UpdateCustomerAddressDTO;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
9
|
export declare const maybeUnsetDefaultShippingAddressesStepId = "maybe-unset-default-shipping-customer-addresses";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UpdateCustomerAddressDTO, FilterableCustomerAddressProps } from "@medusajs/types";
|
|
2
2
|
type UpdateCustomerAddresseStepInput = {
|
|
3
3
|
selector: FilterableCustomerAddressProps;
|
|
4
|
-
update:
|
|
4
|
+
update: UpdateCustomerAddressDTO;
|
|
5
5
|
};
|
|
6
6
|
export declare const updateCustomerAddresseStepId = "update-customer-addresses";
|
|
7
|
-
export declare const updateCustomerAddressesStep: import("@medusajs/workflows-sdk").StepFunction<UpdateCustomerAddresseStepInput, CustomerAddressDTO[]>;
|
|
7
|
+
export declare const updateCustomerAddressesStep: import("@medusajs/workflows-sdk").StepFunction<UpdateCustomerAddresseStepInput, import("@medusajs/types").CustomerAddressDTO[]>;
|
|
8
8
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UpdateCustomerAddressDTO, FilterableCustomerAddressProps, ICustomerModuleService } from "@medusajs/types";
|
|
2
2
|
import { StepResponse } from "@medusajs/workflows-sdk";
|
|
3
3
|
export declare const unsetForUpdate: (data: {
|
|
4
4
|
selector: FilterableCustomerAddressProps;
|
|
5
|
-
update:
|
|
5
|
+
update: UpdateCustomerAddressDTO;
|
|
6
6
|
}, customerService: ICustomerModuleService, field: "is_default_billing" | "is_default_shipping") => Promise<StepResponse<undefined, undefined> | StepResponse<undefined, string[]>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FilterableCustomerAddressProps, CustomerAddressDTO } from "@medusajs/types";
|
|
1
|
+
import { FilterableCustomerAddressProps, CustomerAddressDTO, UpdateCustomerAddressDTO } from "@medusajs/types";
|
|
2
2
|
type WorkflowInput = {
|
|
3
3
|
selector: FilterableCustomerAddressProps;
|
|
4
|
-
update:
|
|
4
|
+
update: UpdateCustomerAddressDTO;
|
|
5
5
|
};
|
|
6
6
|
export declare const updateCustomerAddressesWorkflowId = "update-customer-addresses";
|
|
7
7
|
export declare const updateCustomerAddressesWorkflow: import("@medusajs/workflows-sdk").ReturnWorkflow<WorkflowInput, CustomerAddressDTO[], Record<string, Function>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from "./update-customer-groups";
|
|
2
2
|
export * from "./delete-customer-groups";
|
|
3
3
|
export * from "./create-customer-groups";
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./delete-customer-group-customers";
|
|
4
|
+
export * from "./link-customers-customer-group";
|
|
@@ -17,5 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./update-customer-groups"), exports);
|
|
18
18
|
__exportStar(require("./delete-customer-groups"), exports);
|
|
19
19
|
__exportStar(require("./create-customer-groups"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./delete-customer-group-customers"), exports);
|
|
20
|
+
__exportStar(require("./link-customers-customer-group"), exports);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { LinkWorkflowInput } from "@medusajs/types/src";
|
|
2
|
+
export declare const linkCustomersToCustomerGroupStepId = "link-customers-to-customer-group";
|
|
3
|
+
export declare const linkCustomersToCustomerGroupStep: import("@medusajs/workflows-sdk").StepFunction<LinkWorkflowInput, undefined>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linkCustomersToCustomerGroupStep = exports.linkCustomersToCustomerGroupStepId = void 0;
|
|
4
|
+
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
5
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
6
|
+
const utils_1 = require("@medusajs/utils");
|
|
7
|
+
exports.linkCustomersToCustomerGroupStepId = "link-customers-to-customer-group";
|
|
8
|
+
exports.linkCustomersToCustomerGroupStep = (0, workflows_sdk_1.createStep)(exports.linkCustomersToCustomerGroupStepId, async (data, { container }) => {
|
|
9
|
+
const service = container.resolve(modules_sdk_1.ModuleRegistrationName.CUSTOMER);
|
|
10
|
+
const toAdd = (data.add ?? []).map((customerId) => {
|
|
11
|
+
return {
|
|
12
|
+
customer_id: customerId,
|
|
13
|
+
customer_group_id: data.id,
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
const toRemove = (data.remove ?? []).map((customerId) => {
|
|
17
|
+
return {
|
|
18
|
+
customer_id: customerId,
|
|
19
|
+
customer_group_id: data.id,
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
const promises = [];
|
|
23
|
+
if (toAdd.length) {
|
|
24
|
+
promises.push(service.addCustomerToGroup(toAdd));
|
|
25
|
+
}
|
|
26
|
+
if (toRemove.length) {
|
|
27
|
+
promises.push(service.removeCustomerFromGroup(toRemove));
|
|
28
|
+
}
|
|
29
|
+
await (0, utils_1.promiseAll)(promises);
|
|
30
|
+
return new workflows_sdk_1.StepResponse(void 0, { toAdd, toRemove });
|
|
31
|
+
}, async (prevData, { container }) => {
|
|
32
|
+
if (!prevData) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const service = container.resolve(modules_sdk_1.ModuleRegistrationName.CUSTOMER);
|
|
36
|
+
if (prevData.toAdd.length) {
|
|
37
|
+
await service.removeCustomerFromGroup(prevData.toAdd);
|
|
38
|
+
}
|
|
39
|
+
if (prevData.toRemove.length) {
|
|
40
|
+
await service.addCustomerToGroup(prevData.toRemove);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from "./update-customer-groups";
|
|
2
2
|
export * from "./delete-customer-groups";
|
|
3
3
|
export * from "./create-customer-groups";
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./delete-customer-group-customers";
|
|
4
|
+
export * from "./link-customers-customer-group";
|
|
@@ -17,5 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./update-customer-groups"), exports);
|
|
18
18
|
__exportStar(require("./delete-customer-groups"), exports);
|
|
19
19
|
__exportStar(require("./create-customer-groups"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
21
|
-
__exportStar(require("./delete-customer-group-customers"), exports);
|
|
20
|
+
__exportStar(require("./link-customers-customer-group"), exports);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { LinkWorkflowInput } from "@medusajs/types/src";
|
|
2
|
+
export declare const linkCustomersToCustomerGroupWorkflowId = "link-customers-to-customer-group";
|
|
3
|
+
export declare const linkCustomersToCustomerGroupWorkflow: import("@medusajs/workflows-sdk").ReturnWorkflow<LinkWorkflowInput, void, Record<string, Function>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linkCustomersToCustomerGroupWorkflow = exports.linkCustomersToCustomerGroupWorkflowId = void 0;
|
|
4
|
+
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
5
|
+
const steps_1 = require("../steps");
|
|
6
|
+
exports.linkCustomersToCustomerGroupWorkflowId = "link-customers-to-customer-group";
|
|
7
|
+
exports.linkCustomersToCustomerGroupWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.linkCustomersToCustomerGroupWorkflowId, (input) => {
|
|
8
|
+
return (0, steps_1.linkCustomersToCustomerGroupStep)(input);
|
|
9
|
+
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addShippingMethodToCartStep = exports.addShippingMethodToCartStepId = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
4
5
|
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
5
|
-
const dist_1 = require("../../../../../modules-sdk/dist");
|
|
6
6
|
exports.addShippingMethodToCartStepId = "add-shipping-method-to-cart-step";
|
|
7
7
|
exports.addShippingMethodToCartStep = (0, workflows_sdk_1.createStep)(exports.addShippingMethodToCartStepId, async (data, { container }) => {
|
|
8
|
-
const cartService = container.resolve(
|
|
8
|
+
const cartService = container.resolve(modules_sdk_1.ModuleRegistrationName.CART);
|
|
9
9
|
const methods = await cartService.addShippingMethods(data.shipping_methods);
|
|
10
10
|
return new workflows_sdk_1.StepResponse(methods, methods);
|
|
11
11
|
}, async (methods, { container }) => {
|
|
12
|
-
const cartService = container.resolve(
|
|
12
|
+
const cartService = container.resolve(modules_sdk_1.ModuleRegistrationName.CART);
|
|
13
13
|
if (!methods?.length) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addToCartStep = exports.addToCartStepId = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
4
5
|
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
5
|
-
const dist_1 = require("../../../../../modules-sdk/dist");
|
|
6
6
|
exports.addToCartStepId = "add-to-cart-step";
|
|
7
7
|
exports.addToCartStep = (0, workflows_sdk_1.createStep)(exports.addToCartStepId, async (data, { container }) => {
|
|
8
|
-
const cartService = container.resolve(
|
|
8
|
+
const cartService = container.resolve(modules_sdk_1.ModuleRegistrationName.CART);
|
|
9
9
|
const items = await cartService.addLineItems(data.items);
|
|
10
10
|
return new workflows_sdk_1.StepResponse(items, items);
|
|
11
11
|
}, async (createdLineItems, { container }) => {
|
|
12
|
-
const cartService = container.resolve(
|
|
12
|
+
const cartService = container.resolve(modules_sdk_1.ModuleRegistrationName.CART);
|
|
13
13
|
if (!createdLineItems?.length) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.confirmInventoryStep = exports.confirmInventoryStepId = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
4
5
|
const utils_1 = require("@medusajs/utils");
|
|
5
6
|
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
6
7
|
const medusa_core_utils_1 = require("medusa-core-utils");
|
|
7
|
-
const dist_1 = require("../../../../../modules-sdk/dist");
|
|
8
8
|
exports.confirmInventoryStepId = "confirm-inventory-step";
|
|
9
9
|
exports.confirmInventoryStep = (0, workflows_sdk_1.createStep)(exports.confirmInventoryStepId, async (data, { container }) => {
|
|
10
|
-
const inventoryService = container.resolve(
|
|
10
|
+
const inventoryService = container.resolve(modules_sdk_1.ModuleRegistrationName.INVENTORY);
|
|
11
11
|
// TODO: Should be bulk
|
|
12
|
-
const promises = data.items.map((item) => {
|
|
12
|
+
const promises = data.items.map(async (item) => {
|
|
13
13
|
const itemQuantity = item.required_quantity * item.quantity;
|
|
14
|
-
return inventoryService.confirmInventory(item.inventory_item_id, item.location_ids, itemQuantity);
|
|
14
|
+
return await inventoryService.confirmInventory(item.inventory_item_id, item.location_ids, itemQuantity);
|
|
15
15
|
});
|
|
16
16
|
const inventoryCoverage = await (0, utils_1.promiseAll)(promises);
|
|
17
17
|
if (inventoryCoverage.some((hasCoverage) => !hasCoverage)) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { BigNumberInput } from "@medusajs/types";
|
|
1
2
|
type StepInput = {
|
|
2
3
|
region_id: string;
|
|
3
4
|
currency_code: string;
|
|
4
|
-
amount:
|
|
5
|
+
amount: BigNumberInput;
|
|
5
6
|
metadata?: Record<string, unknown>;
|
|
6
7
|
};
|
|
7
8
|
export declare const createPaymentCollectionsStepId = "create-payment-collections";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getItemTaxLinesStep = exports.getItemTaxLinesStepId = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
4
5
|
const utils_1 = require("@medusajs/utils");
|
|
5
6
|
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
6
|
-
const dist_1 = require("../../../../../modules-sdk/dist");
|
|
7
7
|
function normalizeTaxModuleContext(cart, forceTaxCalculation) {
|
|
8
8
|
const address = cart.shipping_address;
|
|
9
9
|
const shouldCalculateTax = forceTaxCalculation || cart.region?.automatic_taxes;
|
|
@@ -16,7 +16,7 @@ function normalizeTaxModuleContext(cart, forceTaxCalculation) {
|
|
|
16
16
|
if (!address?.country_code) {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const customer = cart.customer
|
|
20
20
|
? {
|
|
21
21
|
id: cart.customer.id,
|
|
22
22
|
email: cart.customer.email,
|
|
@@ -61,7 +61,7 @@ function normalizeLineItemsForShipping(cart, shippingMethods) {
|
|
|
61
61
|
exports.getItemTaxLinesStepId = "get-item-tax-lines";
|
|
62
62
|
exports.getItemTaxLinesStep = (0, workflows_sdk_1.createStep)(exports.getItemTaxLinesStepId, async (data, { container }) => {
|
|
63
63
|
const { cart, items, shipping_methods: shippingMethods, force_tax_calculation: forceTaxCalculation = false, } = data;
|
|
64
|
-
const taxService = container.resolve(
|
|
64
|
+
const taxService = container.resolve(modules_sdk_1.ModuleRegistrationName.TAX);
|
|
65
65
|
const taxContext = normalizeTaxModuleContext(cart, forceTaxCalculation);
|
|
66
66
|
if (!taxContext) {
|
|
67
67
|
return new workflows_sdk_1.StepResponse({
|
|
@@ -13,6 +13,7 @@ export * from "./get-shipping-option-price-sets";
|
|
|
13
13
|
export * from "./get-variant-price-sets";
|
|
14
14
|
export * from "./get-variants";
|
|
15
15
|
export * from "./prepare-adjustments-from-promotion-actions";
|
|
16
|
+
export * from "./refresh-cart-shipping-methods";
|
|
16
17
|
export * from "./remove-line-item-adjustments";
|
|
17
18
|
export * from "./remove-shipping-method-adjustments";
|
|
18
19
|
export * from "./retrieve-cart";
|
|
@@ -20,4 +21,5 @@ export * from "./retrieve-cart-with-links";
|
|
|
20
21
|
export * from "./set-tax-lines-for-items";
|
|
21
22
|
export * from "./update-cart-promotions";
|
|
22
23
|
export * from "./update-carts";
|
|
24
|
+
export * from "./validate-cart-shipping-options";
|
|
23
25
|
export * from "./validate-variants-existence";
|
|
@@ -29,6 +29,7 @@ __exportStar(require("./get-shipping-option-price-sets"), exports);
|
|
|
29
29
|
__exportStar(require("./get-variant-price-sets"), exports);
|
|
30
30
|
__exportStar(require("./get-variants"), exports);
|
|
31
31
|
__exportStar(require("./prepare-adjustments-from-promotion-actions"), exports);
|
|
32
|
+
__exportStar(require("./refresh-cart-shipping-methods"), exports);
|
|
32
33
|
__exportStar(require("./remove-line-item-adjustments"), exports);
|
|
33
34
|
__exportStar(require("./remove-shipping-method-adjustments"), exports);
|
|
34
35
|
__exportStar(require("./retrieve-cart"), exports);
|
|
@@ -36,4 +37,5 @@ __exportStar(require("./retrieve-cart-with-links"), exports);
|
|
|
36
37
|
__exportStar(require("./set-tax-lines-for-items"), exports);
|
|
37
38
|
__exportStar(require("./update-cart-promotions"), exports);
|
|
38
39
|
__exportStar(require("./update-carts"), exports);
|
|
40
|
+
__exportStar(require("./validate-cart-shipping-options"), exports);
|
|
39
41
|
__exportStar(require("./validate-variants-existence"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CartDTO } from "@medusajs/types";
|
|
2
|
+
interface StepInput {
|
|
3
|
+
cart: CartDTO;
|
|
4
|
+
}
|
|
5
|
+
export declare const refreshCartShippingMethodsStepId = "refresh-cart-shipping-methods";
|
|
6
|
+
export declare const refreshCartShippingMethodsStep: import("@medusajs/workflows-sdk").StepFunction<StepInput, undefined>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refreshCartShippingMethodsStep = exports.refreshCartShippingMethodsStepId = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
|
+
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
7
|
+
exports.refreshCartShippingMethodsStepId = "refresh-cart-shipping-methods";
|
|
8
|
+
exports.refreshCartShippingMethodsStep = (0, workflows_sdk_1.createStep)(exports.refreshCartShippingMethodsStepId, async (data, { container }) => {
|
|
9
|
+
const { cart } = data;
|
|
10
|
+
const { shipping_methods: shippingMethods = [] } = cart;
|
|
11
|
+
if (!shippingMethods?.length) {
|
|
12
|
+
return new workflows_sdk_1.StepResponse(void 0, []);
|
|
13
|
+
}
|
|
14
|
+
const fulfillmentModule = container.resolve(modules_sdk_1.ModuleRegistrationName.FULFILLMENT);
|
|
15
|
+
const cartModule = container.resolve(modules_sdk_1.ModuleRegistrationName.CART);
|
|
16
|
+
const shippingOptionIds = shippingMethods.map((sm) => sm.shipping_option_id);
|
|
17
|
+
const validShippingOptions = await fulfillmentModule.listShippingOptionsForContext({
|
|
18
|
+
id: shippingOptionIds,
|
|
19
|
+
context: { ...cart },
|
|
20
|
+
address: {
|
|
21
|
+
country_code: cart.shipping_address?.country_code,
|
|
22
|
+
province_code: cart.shipping_address?.province,
|
|
23
|
+
city: cart.shipping_address?.city,
|
|
24
|
+
postal_expression: cart.shipping_address?.postal_code,
|
|
25
|
+
},
|
|
26
|
+
}, { relations: ["rules"] });
|
|
27
|
+
const validShippingOptionIds = validShippingOptions.map((o) => o.id);
|
|
28
|
+
const invalidShippingOptionIds = (0, utils_1.arrayDifference)(shippingOptionIds, validShippingOptionIds);
|
|
29
|
+
const shippingMethodsToDelete = shippingMethods
|
|
30
|
+
.filter((sm) => invalidShippingOptionIds.includes(sm.shipping_option_id))
|
|
31
|
+
.map((sm) => sm.id);
|
|
32
|
+
await cartModule.softDeleteShippingMethods(shippingMethodsToDelete);
|
|
33
|
+
return new workflows_sdk_1.StepResponse(void 0, shippingMethodsToDelete);
|
|
34
|
+
}, async (shippingMethodsToRestore, { container }) => {
|
|
35
|
+
if (shippingMethodsToRestore?.length) {
|
|
36
|
+
const cartModule = container.resolve(modules_sdk_1.ModuleRegistrationName.CART);
|
|
37
|
+
await cartModule.restoreShippingMethods(shippingMethodsToRestore);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -4,7 +4,7 @@ exports.updateTaxLinesStep = exports.updateTaxLinesStepId = void 0;
|
|
|
4
4
|
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
5
5
|
const workflows_1 = require("../workflows");
|
|
6
6
|
exports.updateTaxLinesStepId = "update-tax-lines-step";
|
|
7
|
-
exports.updateTaxLinesStep = (0, workflows_sdk_1.createStep)(exports.updateTaxLinesStepId, async (input, { container
|
|
7
|
+
exports.updateTaxLinesStep = (0, workflows_sdk_1.createStep)(exports.updateTaxLinesStepId, async (input, { container }) => {
|
|
8
8
|
const { transaction } = await (0, workflows_1.updateTaxLinesWorkflow)(container).run({
|
|
9
9
|
input,
|
|
10
10
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CartDTO } from "@medusajs/types";
|
|
2
|
+
interface StepInput {
|
|
3
|
+
cart: CartDTO;
|
|
4
|
+
option_ids: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const validateCartShippingOptionsStepId = "validate-cart-shipping-options";
|
|
7
|
+
export declare const validateCartShippingOptionsStep: import("@medusajs/workflows-sdk").StepFunction<StepInput, undefined>;
|
|
8
|
+
export {};
|