Skip to content

refactor(core): align product service overloads and normalize step inputs#868

Open
vholik wants to merge 3 commits into
feat/product-workflows-and-patchesfrom
refactor/product-service-and-step-patterns
Open

refactor(core): align product service overloads and normalize step inputs#868
vholik wants to merge 3 commits into
feat/product-workflows-and-patchesfrom
refactor/product-service-and-step-patterns

Conversation

@vholik
Copy link
Copy Markdown
Collaborator

@vholik vholik commented Apr 15, 2026

Summary

  • Adopt Medusa-style overload declarations for createProducts, updateProducts, and addProductAction so callers get array-in/array-out and single-in/single-out typing without manual generics.
  • Normalize workflow steps under packages/core/src/workflows/product/steps/ to accept batched array inputs and mirror the updateXxx([{ selector, data }]) shape used by MedusaService.
  • Fix compensation handlers to pick only scalar fields — previously passing full DTOs leaked relations (products, product_changes, variants) into update payloads and broke typings.
  • Add missing brand and rejection-reason workflows/steps and wire up submit-seller-products alongside the existing product lifecycle flows.

Test plan

  • Run apps/api build — no TS regressions from the overloads
  • Submit a seller product end-to-end and verify product change + action are created
  • Accept / reject / request-changes / resubmit flows still update the product and emit events
  • Update a brand via the new brand workflow and verify the handle is derived from name
  • Trigger a compensation path (failing step mid-workflow) and confirm the previous state is restored without type errors

🤖 Generated with Claude Code

vholik and others added 3 commits April 15, 2026 11:27
…puts

- Adopt Medusa-style overload declarations for createProducts,
  updateProducts, and addProductAction so callers get array-in/array-out
  and single-in/single-out typing without manual generics.
- Normalize workflow steps to accept batched array inputs, mirroring the
  updateXxx([{ selector, data }]) shape used by MedusaService, and fix
  compensation handlers to pick only scalar fields so DTO relations
  don't leak into update payloads.
- Add missing brand and rejection-reason workflows/steps and wire up
  submit-seller-products alongside the existing product lifecycle flows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename steps that accept array inputs to match their batched shape:
create-product-change → create-product-changes,
create-product-change-action → create-product-change-actions,
confirm-product-change → confirm-product-changes. decline-product-change
stays singular since it still takes a single input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename the step input key from update to data in activate-product,
deactivate-product, and the update-products workflow so every caller
matches the UpdateProductsStepInput shape.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vholik vholik requested a review from Si3r4dz April 17, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants