Commit Graph

2135 Commits

Author SHA1 Message Date
Carlos R. L. Rodrigues
b776fd55dc chore(core-flows): lock on cart operations (#13424)
What:
 - acquire a lock before cart mutations to avoid concurrent changes, e.g applying promotions.
2025-09-08 18:05:09 +00:00
Adrien de Peretti
8e5c22a8e8 chore(): Improve workflows sdk tooling (#13421)
RESOLVES CORE-1171

**What**
 - Reduced async overhead for objects with mixed sync/async properties
 - Lower memory pressure from eliminated promise allocations
 - Faster primitive value processing with early returns
 - Better concurrency through selective batching of truly async operations
 - Event loop friendly behavior preventing artificial delays
 - Reduced memory allocation from eliminated duplicate processing
 - Decreased GC pressure from WeakMap-based caching instead of map

**note**
Now, `resolveValue`always treat every resoltion as sync operation unless it is not, meaning we do not create promise overhead when not necessary and only when actually treating with promises
2025-09-08 16:24:10 +00:00
Oli Juhl
8e11998895 fix(medusa): Use default logger in plugin:develop (#13375)
**What**

Use default logger for plugin command, since there is no `medusa-config.ts` to load the container with (the container that holds the custom logger)
2025-09-08 16:19:42 +00:00
Adrien de Peretti
d7692100e7 chore(orchestration): add support for autoRetry, maxAwaitingRetries, retryStep (#13391)
RESOLVES CORE-1163
RESOLVES CORE-1164

**What**

### Add support for non auto retryable steps.

When marking a step with `maxRetries`, when it will fail it will be marked as temporary failure and then retry itself automatically. Thats the default behaviour, if you now add `autoRetry: false`, when the step will fail it will be marked as temporary failure but not retry automatically. you can now call the workflow engine run to resume the workflow from the failing step to be retried.

### Add support for `maxAwaitingRetries`

When setting `retyIntervalAwaiting` a step that is awaiting will be retried after the specified interval without maximun retry. Now you can set `maxAwaitingRetries` to force a maximum awaiting retry number

### Add support to manually retry an awaiting step

In some scenario, either a machine dies while a step is executing or a step is taking longer than expected, you can now call `retryStep` on the workflow engine to force a retry of the step that is supposedly stucked
2025-09-08 12:46:30 +00:00
0xFl4g
a0693727a0 fix(medusa-test-utils): add DB_PORT env variable support (#12782)
* fix(medusa-test-utils): add DB_PORT environment variable support

- Add DB_PORT constant with default value "5432"
- Update pgGodCredentials to include port property
- Modify getDatabaseURL to include port in connection string
- Allows custom PostgreSQL port configuration via DB_PORT env var

* chore: add changeset for DB_PORT support

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2025-09-07 22:47:53 +02:00
Patryk Spychalski
ca471eb8f4 feat: Add return type in createPaymentCollectionForCartWorkflow (#13385)
* return created payment collection in createPaymentCollectionForCartWorkflow

* changeset

* Update .changeset/tasty-ghosts-work.md

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>

* declare return type

* return single payment collection instead of array

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
2025-09-07 19:24:09 +02:00
Carlos R. L. Rodrigues
71d8a0031f fix(index): index enum fields (#13428)
https://github.com/medusajs/medusa/issues/13372

What:
 - It handles enum fields corretly when added to filterable fields
2025-09-07 13:39:58 +00:00
Oli Juhl
637d4cf7ef fix: Missing DB traces in instrumentation (#13429)
* chore: Fix issue with missing DB traces

* Fix missing DB traces in Medusa package

Fixes an issue related to missing database traces in the Medusa package.
2025-09-07 15:04:15 +02:00
Adrien de Peretti
2fe68a975b chore(): Improve some cart operation flows to remove extraneous operations when not required (#13418)
RESOLVES CORE-1155

**What**
- prevent update payment collection worklow to fetch data and call steps when there is no payment collection
- prevent refresh Cart Shipping Methods Workflow to fetch data and call steps when there is no shipping methods
- update promotion step to remove extraneous module call
2025-09-07 12:52:36 +00:00
William Bouchard
9b3831d258 fix(dashboard): support more decimals for tx rates (#13407)
* Percentage formatter set maximum digits to 4

* Modify Tax Region Forms to allow 4 digits tax rates

* Add changeset

* Revert placeholder value to use only 2 decimals

* fix(dashboard): support more decimals for tx rates

* changeset

* bypass scale

* refactor

* fix removal of deprecated input

* cleanup deprecated percentage input

* small mistake in onchange

* add deprecated percentage input back

* import

* remove file extension

* frane comment

---------

Co-authored-by: AmbroziuBaban <ambroziubaban@gmail.com>
2025-09-05 13:02:44 +02:00
Frane Polić
0000ed6998 fix(draft-order, medusa, types): ui polish (#13376)
**What**
- ensure unique promotion changes are displayed in the activity section
- check linked promotions by id and not code
- list promotions - add id param
- make address payload fields nullish
- Add items view UI tweaks

---

CLOSES SUP-2400
2025-09-05 06:55:07 +00:00
Frane Polić
e67974ffe5 fix(dashboard): customer has_acccount flag (#13414) 2025-09-05 08:01:29 +02:00
Adrien de Peretti
55a35e4721 chore(workflows-sdk, utils): Prevent unnecessary serialization (#13413)
* chore(workflows-sdk, utils): Prevent unnecessary serialization

* Create poor-mugs-cheat.md
2025-09-04 16:19:35 +02:00
Frane Polić
b7fef5b7ef fix(dashboard): promotion decimal value definition (#13371)
* fix(dashboard): pormotion decimal value definition

* fix: typo

* fix: fixed value decimals

* fix: translation
2025-09-04 16:07:29 +02:00
Adrien de Peretti
2b89510df3 chore(): only execute race execution checks and publish message only for async workflows (#13396)
* chore(): only execute race execution checks for async workflows

* chore(): workflow redis publish only for async flows

* Create cyan-gorillas-poke.md

* chore(): workflow redis publish only for async flows

* fix negative check

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-09-04 09:12:09 +02:00
William Bouchard
faae150a58 fix(utils): big bumber should give numeric value of 0 for small numbers (#13394)
* fix(utils): big bumber should give numeric value of 0 for small numbers

* circular dep

* fix imports

* fix infinite loop

* fix test

* changeset
2025-09-03 13:45:41 -04:00
Oli Juhl
115a1deb49 chore: Fix scripts in CLI pipeline (#13402)
* chore: Fix scripts in CLI pipeline

* Create curly-lizards-dress.md
2025-09-03 14:07:24 +02:00
William Bouchard
2f6edf367a feat(dashboard,cart,types,utils): refine order details summary (#13313)
* feat(dashboard,types,utils): refine order details summary

* fix tests

* changeset

* ui corrections

* tests again

* weird tests failing

* revert update to subtotal

* revert http tests too

* comments

* move credit lines so it makes more sense

* remove currency codes and add bold prices

* add new properties in default for storefront

* minor to patch

* remove bold on things that should be

* olis comment about taxes

* remove bold from shipping
2025-09-02 20:50:37 +02:00
Pepijn
753e8081c4 fix(dashboard): promotion expired status check when limit is null (#13373)
* Fix promotion expired status

* Update .changeset/bright-spoons-float.md

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-09-02 11:46:32 +02:00
Adrien de Peretti
bd206cb250 chore(): improve workflow engine storage (#13345)
* chore(workflow-engines): Improve race condition management

* cleanup

* cleanup

* chore(workflow-engines): Improve race condition management

* chore(workflow-engines): Improve race condition management

* chore(workflow-engines): heartbeat extend TTL

* Refactor chore title for workflow engine improvements

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* update tests

* revert idempotent

* add run_id index + await deletion

* improve saving

* comment

* remove only

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-09-02 11:18:12 +02:00
Adrien de Peretti
b85a46e85b chore(): faster serialization (#13325)
* chore(): Improve serialization perf

* better optimization with monomorphic approach and consistent object shape and array operations

* cleanup

* cleanup

* fix

* Create short-birds-help.md

* ref work

* ref work

* address feedback

* save intermediary changes

* save intermediary changes
2025-09-02 10:19:59 +02:00
Frane Polić
fb71bc6405 fix(core-flows): handle cacluated shipping options on draft orders gracefully (#13353)
* fix(core-flows): handle calculated shipping options on draft orders gracefully

* fix: throw medusa error
2025-09-02 10:06:31 +02:00
Carlos R. L. Rodrigues
b4c0f131b7 chore(framework,medusa): load custom flags before medusa config (#13312)
* chore(framework,medusa): load custom flags before medusa config

* test

* test runner

* changeset

* check manager featureFlags

* discover and register flags

* rm comments

* update changeset

* changeset

* use local cli

* execute from local medusa command

---------

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2025-09-01 16:04:43 +02:00
Frane Polić
f53f027ce6 fix(dashboard): rules form operator change (#13324)
**What**
- fix condition rules form sometimes rendering multi and single selects unrelated to the attribute operator selected
- reset rule value when operator is changed
- disable selecting rule values untill operator is selected
- translate labels
2025-08-29 15:53:00 +00:00
github-actions[bot]
6dca59d0a5 chore: Version Packages (#13338)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-28 22:58:13 +02:00
Carlos R. L. Rodrigues
8176d0f684 chore(core-flows): revert idempotent cart (#13336) 2025-08-28 22:45:43 +02:00
github-actions[bot]
08ec3ed9f2 chore: Version Packages (#13209)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-28 17:25:32 +02:00
William Bouchard
65dfcf9be4 chore(dashboard): move shipping option type page (#13323)
* chore(dashboard): move shipping option type page

* small issue with the toast for edit
2025-08-28 15:31:51 +02:00
Carlos R. L. Rodrigues
e2213448ac feat: custom logger (#13156)
* feat: custom logger

* mock log

* unit test

* FF and jobs loader

* unit test

* add to ResourceLoader

* get from container

* mock

* rm log

* default logger mock

* link loaders, express

* comments

* initialize container as first step

* db conn

* test

* initialize start

* plugin build using default logger

* ignore .medusa

* revert ignroe

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-28 15:31:19 +02:00
Carlos R. L. Rodrigues
9412669e65 chore: idempotent cart operations (#13236)
* chore(core-flows): idempotent cart operations

* changeset

* add tests

* revert

* revert route

* promo test

* skip bugs

* fix test

* tests

* avoid workflow name conflict

* prevent nested workflow from being deleted until the top level parent finishes

* remove unused setTimeout

* update changeset

* rm comments

---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
2025-08-28 15:04:00 +02:00
Carlos R. L. Rodrigues
b111d01898 chore(core-flows): order payment status fix (#13321)
What:
 - Consider epsilon to check if an order is fully captured or refunded.
2025-08-28 12:59:24 +00:00
Adrien de Peretti
ff152e7ace fix(orchestration): Use the step definition max retries on set step failure (#13319)
* fix(orchestration): Use the step definition max retries on set step failure

* Create sweet-turkeys-wait.md

* allow to force permanent failure

* update changeset
2025-08-28 14:35:31 +02:00
Oli Juhl
cbaa403744 chore: Enable draft order plugin by default (#13314)
* wip

* fix

* fix tests

* update lockfile

* fix deps

* Enable draft order plugin by default

* remove double negation

* support merging modules
2025-08-28 14:14:40 +02:00
Frane Polić
be62cf87c7 fix(core-flows): list order shipping options param type (#13316) 2025-08-28 13:50:27 +02:00
Carlos R. L. Rodrigues
f764b3a364 feat(index): $nin and $not operators (#13289)
* feat(index): add $not and $nin operators

* logical operator

* test

* test

* types

* logical

* schema ID

* types and $ilike fix

* index type
2025-08-28 11:56:17 +02:00
Oli Juhl
b3fb0f7634 chore: Revert #13189 (#13318) 2025-08-28 11:46:01 +02:00
Frane Polić
6b04fbcc50 fix(core-flows): pass backorder flag when recreating reservations after fulfilment cancelation (#13076) 2025-08-27 21:22:03 +02:00
William Bouchard
059bfc1475 chore(fulfillment): cleanup old auto-generatred shipping type (#13298)
* chore(fulfillment): cleanup old auto-generatred shipping type

* changeset

* integrationt ests

* random id

* wrong code

* switch steps around

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-27 11:09:31 -04:00
Oli Juhl
a0fca16570 feat: Add Draft Order plugin (#13291)
* feat: Add draft order plugin

* version draft order plugin

* update readme

* chore: Update scripts

* Create purple-dolls-cheer.md

* port over latest changes

* chore: Make package public
2025-08-27 10:14:17 +02:00
Frane Polić
5382afccfa chore(core-flows): throw Medusa error for exceptions in the fulifllment flows (#13302)
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-26 20:02:55 +02:00
Frane Polić
71818e43cb fix(medusa): fetching a product without a category with categories filed passed (#13020)
**What**
- adding `categories` to `fields` param would return 404 for an existing product if the product was not associated with a category

---

CLOSES CMRC-1046
2025-08-26 16:35:41 +00:00
Carlos R. L. Rodrigues
e413cfefc2 feat(utils): define file config (#13283)
** What
 - Allow auto-loaded Medusa files to export a config object.
 - Currently supports isDisabled to control loading.
 - new instance `FeatureFlag` exported by `@medusajs/framework/utils`
 - `feature-flags` is now a supported folder for medusa projects, modules, providers and plugins. They will be loaded and added to `FeatureFlag`

** Why
 - Enables conditional loading of routes, migrations, jobs, subscribers, workflows, and other files based on feature flags.

```ts
// /src/feature-flags

import { FlagSettings } from "@medusajs/framework/feature-flags"

const CustomFeatureFlag: FlagSettings = {
  key: "custom_feature",
  default_val: false,
  env_key: "FF_MY_CUSTOM_FEATURE",
  description: "Enable xyz",
}

export default CustomFeatureFlag
```

```ts
// /src/modules/my-custom-module/migration/Migration20250822135845.ts

import { FeatureFlag } from "@medusajs/framework/utils"

export class Migration20250822135845 extends Migration {
  override async up(){ }
  override async down(){ }
}

defineFileConfig({
  isDisabled: () => !FeatureFlag.isFeatureEnabled("custom_feature")
})
```
2025-08-26 12:22:30 +00:00
Frane Polić
87a61baf8f fix(dashboard): handle large resource count in tax rule override edit form (#13297)
* fix(dashboard): handle larege resource count in tax rule override edit form

* fix: typo

* fix: rm log
2025-08-26 10:45:27 +02:00
William Bouchard
338a42f728 chore(promotion): cleanup old unused promotion codebase (#13294)
* chore(promotion): cleanup old unused code

* changeset
2025-08-25 09:35:17 -04:00
Adrien de Peretti
fc49253273 feat(core, event-bus): Compensate emit event step utility (#13281)
* feat(core, event-bus): Compensate emit event step utility

* tests

* Update changeset to remove integration-tests-modules

Removed integration-tests-modules from changeset.

* revert test script
2025-08-25 15:08:09 +02:00
Frane Polić
57077406f9 fix(fulfillment): don't cascade shipping option delete to shipping option type (#13280)
**What**
- don't cascade delete shipping option type when shipping option is deleted since types can be shared between options
- prevent shipping option type deletion if there are options associated with it
2025-08-25 08:00:41 +00:00
Adrien de Peretti
6264a6262b fix: Cart operation should calculate item prices accounting for quantity (#13251)
* fix(): Cart operation should calculate item prices accounting for quantity

* fix(): Cart operation should calculate item prices accounting for quantity

* fix(): Cart operation should calculate item prices accounting for quantity

* fix when call warning

* fix tests and remove unnecessary object copy

* Create warm-dancers-allow.md

* fix update line item in cart workflow

* fix changeset

* update order flows

* fix cart spec integration tests

* improve create order workflow

* fixes and tests adjustments/improvements

* configurable useQueryGraphStep return type

* revert nullable take

* cleanup useQueryGraphStep
2025-08-25 09:38:58 +02:00
William Bouchard
486621383a feat(dashboard,core,modules): free shipping promotion in dashboard (#13263)
* feat(dashboard,core,modules): free shipping promotion in dashboard

* self-review

* adapt for edit to work

* changeset

* integration tests

* across for each

* remove only from tests

* remove console log

* revert to across

* update wording for shipping promotions

* modify changeset

* suggestion frane

* fix i18n schema
2025-08-22 16:30:30 -04:00
Patryk Spychalski
36c20ed188 fix(dashboard): fix translations for polish (#13266)
* remove unused translations

* add missing translations

* Revert "remove unused translations"

This reverts commit 99eaeb4d199c6ececdeed127b1a237f1ff140151.

* changeset
2025-08-22 10:52:15 +02:00
Adrien de Peretti
06ef9197f8 chore(pricing): Fix excessive db queries during price sets update (#13258)
* chore(pricing): Fix excessive db queries during price sets update

* chore(pricing): Fix excessive db queries during price sets update

* finalize upsert with replace of the rules

* fix limit

* Create quiet-pumpkins-hang.md

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-22 10:51:50 +02:00