chore: update mikro-orm to 6.6.12#15018
Conversation
🦋 Changeset detectedLatest commit: 687b3d5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 77 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 9 Skipped Deployments
|
| // There is no public API to unregister subscribers or check if a subscriber is already | ||
| // registered. This means that we need to manually check if the subscriber is already | ||
| // registered, otherwise we will register the same subscriber twice. | ||
| const hasListeners = (manager.getEventManager() as any).subscribers.some( | ||
| (s) => s.constructor.name === subscriberInstance.constructor.name | ||
| ) | ||
| const hasListeners = Array.from( | ||
| manager.getEventManager().getSubscribers() | ||
| ).some((s) => s.constructor.name === subscriberInstance.constructor.name) | ||
| if (!hasListeners) { |
There was a problem hiding this comment.
Reason: subscribers changed from a TypeScript private array to a JS #private Set, which is inacessible by any. However, we can use the getSubscribers public method that returns the set.
| // Introduced in MikroORM 6.5.0: when enabled, MikroORM auto-joins referenced entities | ||
| // (e.g. INNER JOINs PaymentSession when querying Payment) to apply their global filters | ||
| // (e.g. softDeletable). For non-nullable FKs this uses INNER JOIN, silently excluding | ||
| // owning entities (e.g. Payment) when the referenced entity (e.g. PaymentSession) is | ||
| // soft-deleted. Medusa was designed around MikroORM 6.4.x where this didn't exist, so | ||
| // we disable it to preserve the expected behavior. | ||
| autoJoinRefsForFilters: false, |
There was a problem hiding this comment.
this flag was added in v6.0.0, not v6.5
maybe you want to diable just the filters on relations via filtersOnRelations: false instead
https://mikro-orm.io/blog/mikro-orm-6-6-released#more-control-over-filters-on-relations
There was a problem hiding this comment.
Thanks for reviewing @B4nan !
Setting filtersOnRelations: false doesn't fix the affected issue. Only autoJoinRefsForFilters: false does. filtersOnRelations: false seems to affect other areas as well where relations aren't being retrieved as expected.
Update MikroORM dependencies as a mitigation to the following vulnerabilities:
Issues fixed following the update:
subscriberson the entity manager that wasn't publicly accessible, and following the update this caused an error. Latest version has agetSubscribersAPI to access it.autoJoinRefsForFiltersoption, which reverts the behavior to the v6.4.16 behavior that our code is built onrawcallback inpopulateWhereconditions, where the alias parameter is resolved to the correct entity alias at query-build time instead of being hardcoded. Additionally,findAndCountwas updated to run find and count as separate queries, since the count query uses JOINED strategy internally (with a different alias context) but the version subqueries were built forSELECT_INaliases.