@medusajs/core-flows 0.0.7 → 0.0.9-next-20240425093236
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 +5 -0
- package/dist/common/steps/remove-remote-links.js +32 -0
- package/dist/customer/steps/delete-addresses.js +1 -1
- 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/defaults/index.d.ts +2 -0
- package/dist/defaults/index.js +18 -0
- package/dist/defaults/steps/create-default-store.d.ts +7 -0
- package/dist/defaults/steps/create-default-store.js +34 -0
- package/dist/defaults/steps/index.d.ts +1 -0
- package/dist/defaults/steps/index.js +17 -0
- package/dist/defaults/workflows/create-defaults.d.ts +2 -0
- package/dist/defaults/workflows/create-defaults.js +21 -0
- package/dist/defaults/workflows/index.d.ts +1 -0
- package/dist/defaults/workflows/index.js +17 -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/update-tax-lines.js +11 -3
- 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/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-product-variants.js +1 -1
- 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 +9 -1
- package/dist/index.js +9 -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 +3 -1
- package/dist/inventory/steps/index.js +3 -1
- package/dist/inventory/steps/update-inventory-items.d.ts +3 -0
- package/dist/inventory/steps/update-inventory-items.js +25 -0
- package/dist/inventory/steps/update-inventory-levels.d.ts +3 -0
- package/dist/inventory/steps/update-inventory-levels.js +30 -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/delete-inventory-items.js +5 -1
- package/dist/inventory/workflows/index.d.ts +3 -0
- package/dist/inventory/workflows/index.js +3 -0
- package/dist/inventory/workflows/update-inventory-items.d.ts +7 -0
- package/dist/inventory/workflows/update-inventory-items.js +9 -0
- package/dist/inventory/workflows/update-inventory-levels.d.ts +7 -0
- package/dist/inventory/workflows/update-inventory-levels.js +9 -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/delete-price-lists.js +2 -4
- 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 +7 -7
- 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 +8 -8
- 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.d.ts +1 -1
- package/dist/product/steps/update-product-options.js +7 -9
- 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 +3 -1
- package/dist/product/steps/update-product-variants.js +12 -9
- 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 -2
- package/dist/product/workflows/delete-products.js +12 -6
- 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/create-default-sales-channel.d.ts +7 -0
- package/dist/sales-channel/steps/create-default-sales-channel.js +22 -0
- 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 +4 -0
- package/dist/sales-channel/steps/index.js +4 -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/index.d.ts +2 -0
- package/dist/stock-location/index.js +18 -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/create-stock-locations.d.ts +3 -0
- package/dist/stock-location/steps/create-stock-locations.js +17 -0
- package/dist/stock-location/steps/delete-stock-locations.d.ts +2 -0
- package/dist/stock-location/steps/delete-stock-locations.js +17 -0
- package/dist/stock-location/steps/index.d.ts +3 -0
- package/dist/stock-location/steps/index.js +19 -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/create-stock-locations.d.ts +7 -0
- package/dist/stock-location/workflows/create-stock-locations.js +10 -0
- package/dist/stock-location/workflows/delete-stock-locations.d.ts +6 -0
- package/dist/stock-location/workflows/delete-stock-locations.js +14 -0
- package/dist/stock-location/workflows/index.d.ts +5 -0
- package/dist/stock-location/workflows/index.js +21 -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/dist/user/workflows/create-user-account.d.ts +8 -0
- package/dist/user/workflows/create-user-account.js +17 -0
- package/dist/user/workflows/index.d.ts +2 -1
- package/dist/user/workflows/index.js +2 -1
- 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/inventory/steps/deatach-inventory-items.d.ts +0 -2
- package/dist/inventory/steps/deatach-inventory-items.js +0 -35
- 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 -29
- 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);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DeleteEntityInput } from "@medusajs/modules-sdk";
|
|
2
|
+
type RemoveRemoteLinksStepInput = DeleteEntityInput | DeleteEntityInput[];
|
|
3
|
+
export declare const removeRemoteLinkStepId = "remove-remote-links";
|
|
4
|
+
export declare const removeRemoteLinkStep: import("@medusajs/workflows-sdk").StepFunction<RemoveRemoteLinksStepInput, DeleteEntityInput>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeRemoteLinkStep = exports.removeRemoteLinkStepId = void 0;
|
|
4
|
+
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
5
|
+
const utils_1 = require("@medusajs/utils");
|
|
6
|
+
exports.removeRemoteLinkStepId = "remove-remote-links";
|
|
7
|
+
exports.removeRemoteLinkStep = (0, workflows_sdk_1.createStep)(exports.removeRemoteLinkStepId, async (data, { container }) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const entries = Array.isArray(data) ? data : [data];
|
|
10
|
+
const grouped = {};
|
|
11
|
+
for (const entry of entries) {
|
|
12
|
+
for (const moduleName of Object.keys(entry)) {
|
|
13
|
+
grouped[moduleName] ?? (grouped[moduleName] = {});
|
|
14
|
+
for (const linkableKey of Object.keys(entry[moduleName])) {
|
|
15
|
+
(_a = grouped[moduleName])[linkableKey] ?? (_a[linkableKey] = []);
|
|
16
|
+
const keys = Array.isArray(entry[moduleName][linkableKey])
|
|
17
|
+
? entry[moduleName][linkableKey]
|
|
18
|
+
: [entry[moduleName][linkableKey]];
|
|
19
|
+
grouped[moduleName][linkableKey] = grouped[moduleName][linkableKey].concat(keys);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const link = container.resolve(utils_1.ContainerRegistrationKeys.REMOTE_LINK);
|
|
24
|
+
await link.delete(grouped);
|
|
25
|
+
return new workflows_sdk_1.StepResponse(grouped, grouped);
|
|
26
|
+
}, async (removedLinks, { container }) => {
|
|
27
|
+
if (!removedLinks) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const link = container.resolve(utils_1.ContainerRegistrationKeys.REMOTE_LINK);
|
|
31
|
+
await link.restore(removedLinks);
|
|
32
|
+
});
|
|
@@ -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,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
|
+
});
|
|
@@ -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"), exports);
|
|
18
|
+
__exportStar(require("./workflows"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CreateStoreDTO } from "@medusajs/types";
|
|
2
|
+
type CreateDefaultStoreStepInput = {
|
|
3
|
+
store: CreateStoreDTO;
|
|
4
|
+
};
|
|
5
|
+
export declare const createDefaultStoreStepId = "create-default-store";
|
|
6
|
+
export declare const createDefaultStoreStep: import("@medusajs/workflows-sdk").StepFunction<CreateDefaultStoreStepInput, any>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDefaultStoreStep = exports.createDefaultStoreStepId = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
6
|
+
const store_1 = require("../../store");
|
|
7
|
+
exports.createDefaultStoreStepId = "create-default-store";
|
|
8
|
+
exports.createDefaultStoreStep = (0, workflows_sdk_1.createStep)(exports.createDefaultStoreStepId, async (data, { container }) => {
|
|
9
|
+
const storeService = container.resolve(modules_sdk_1.ModuleRegistrationName.STORE);
|
|
10
|
+
let shouldDelete = false;
|
|
11
|
+
let [store] = await storeService.list({}, { take: 1 });
|
|
12
|
+
if (!store) {
|
|
13
|
+
store = await (0, store_1.createStoresWorkflow)(container).run({
|
|
14
|
+
input: {
|
|
15
|
+
stores: [
|
|
16
|
+
{
|
|
17
|
+
// TODO: Revisit for a more sophisticated approach
|
|
18
|
+
...data.store,
|
|
19
|
+
supported_currency_codes: ["usd"],
|
|
20
|
+
default_currency_code: "usd",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
shouldDelete = true;
|
|
26
|
+
}
|
|
27
|
+
return new workflows_sdk_1.StepResponse(store, { storeId: store.id, shouldDelete });
|
|
28
|
+
}, async (data, { container }) => {
|
|
29
|
+
if (!data || !data.shouldDelete) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const service = container.resolve(modules_sdk_1.ModuleRegistrationName.STORE);
|
|
33
|
+
await service.delete(data.storeId);
|
|
34
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./create-default-store";
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./create-default-store"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDefaultsWorkflow = exports.createDefaultsWorkflowID = void 0;
|
|
4
|
+
const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
5
|
+
const sales_channel_1 = require("../../sales-channel");
|
|
6
|
+
const create_default_store_1 = require("../steps/create-default-store");
|
|
7
|
+
exports.createDefaultsWorkflowID = "create-defaults";
|
|
8
|
+
exports.createDefaultsWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.createDefaultsWorkflowID, (input) => {
|
|
9
|
+
const salesChannel = (0, sales_channel_1.createDefaultSalesChannelStep)({
|
|
10
|
+
data: {
|
|
11
|
+
name: "Default Sales Channel",
|
|
12
|
+
description: "Created by Medusa",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
const store = (0, create_default_store_1.createDefaultStoreStep)({
|
|
16
|
+
store: {
|
|
17
|
+
default_sales_channel_id: salesChannel.id,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return store;
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./create-defaults";
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./create-defaults"), exports);
|
|
@@ -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({
|
|
@@ -5,7 +5,15 @@ const workflows_sdk_1 = require("@medusajs/workflows-sdk");
|
|
|
5
5
|
const workflows_1 = require("../workflows");
|
|
6
6
|
exports.updateTaxLinesStepId = "update-tax-lines-step";
|
|
7
7
|
exports.updateTaxLinesStep = (0, workflows_sdk_1.createStep)(exports.updateTaxLinesStepId, async (input, { container }) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const { transaction } = await (0, workflows_1.updateTaxLinesWorkflow)(container).run({
|
|
9
|
+
input,
|
|
10
|
+
});
|
|
11
|
+
return new workflows_sdk_1.StepResponse(null, { transaction });
|
|
12
|
+
}, async (flow, { container }) => {
|
|
13
|
+
if (!flow) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
await (0, workflows_1.updateTaxLinesWorkflow)(container).cancel({
|
|
17
|
+
transaction: flow.transaction,
|
|
18
|
+
});
|
|
11
19
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BigNumberInput } from "@medusajs/types";
|
|
1
2
|
interface ConfirmInventoryPreparationInput {
|
|
2
3
|
product_variant_inventory_items: {
|
|
3
4
|
variant_id: string;
|
|
@@ -6,7 +7,7 @@ interface ConfirmInventoryPreparationInput {
|
|
|
6
7
|
}[];
|
|
7
8
|
items: {
|
|
8
9
|
variant_id?: string;
|
|
9
|
-
quantity:
|
|
10
|
+
quantity: BigNumberInput;
|
|
10
11
|
}[];
|
|
11
12
|
variants: {
|
|
12
13
|
id: string;
|