@mikro-orm/core 7.2.2-dev.13 → 7.2.2-dev.15

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.
@@ -633,7 +633,7 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
633
633
  /**
634
634
  * @internal
635
635
  */
636
- tryCache<T extends object, R>(entityName: EntityName<T>, config: boolean | number | [string, number] | undefined, key: unknown, refresh?: boolean, merge?: boolean): Promise<{
636
+ tryCache<T extends object, R>(entityName: EntityName<T>, config: boolean | number | [string, number] | undefined, key: unknown, refresh?: boolean, merge?: boolean, schema?: string): Promise<{
637
637
  data?: R | null;
638
638
  key: string;
639
639
  } | undefined>;
package/EntityManager.js CHANGED
@@ -133,7 +133,7 @@ export class EntityManager {
133
133
  options.populate = (await em.preparePopulate(entityName, options));
134
134
  const populate = options.populate;
135
135
  const cacheKey = em.cacheKey(entityName, options, 'em.find', where);
136
- const cached = await em.tryCache(entityName, options.cache, cacheKey, options.refresh, true);
136
+ const cached = await em.tryCache(entityName, options.cache, cacheKey, options.refresh, true, options.schema);
137
137
  if (cached?.data) {
138
138
  await em.#entityLoader.populate(entityName, cached.data, populate, {
139
139
  ...options,
@@ -834,7 +834,7 @@ export class EntityManager {
834
834
  validateParams(where);
835
835
  options.populate = (await em.preparePopulate(entityName, options));
836
836
  const cacheKey = em.cacheKey(entityName, options, 'em.findOne', where);
837
- const cached = await em.tryCache(entityName, options.cache, cacheKey, options.refresh, true);
837
+ const cached = await em.tryCache(entityName, options.cache, cacheKey, options.refresh, true, options.schema);
838
838
  if (cached?.data !== undefined) {
839
839
  if (cached.data) {
840
840
  await em.#entityLoader.populate(entityName, [cached.data], options.populate, {
@@ -2340,7 +2340,7 @@ export class EntityManager {
2340
2340
  /**
2341
2341
  * @internal
2342
2342
  */
2343
- async tryCache(entityName, config, key, refresh, merge) {
2343
+ async tryCache(entityName, config, key, refresh, merge, schema) {
2344
2344
  config ??= this.config.get('resultCache').global;
2345
2345
  if (!config) {
2346
2346
  return undefined;
@@ -2362,6 +2362,7 @@ export class EntityManager {
2362
2362
  merge: true,
2363
2363
  convertCustomTypes: false,
2364
2364
  refresh,
2365
+ schema,
2365
2366
  recomputeSnapshot: true,
2366
2367
  };
2367
2368
  if (Array.isArray(cached) && merge) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.2.2-dev.13",
3
+ "version": "7.2.2-dev.15",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "keywords": [
6
6
  "data-mapper",
@@ -111,9 +111,17 @@ export class QueryHelper {
111
111
  const op = this.liftGroupOperators(value, prop.targetMeta, metadata, k);
112
112
  if (op) {
113
113
  delete where[k];
114
- where[op] = value[op].map((v) => {
114
+ const group = value[op].map((v) => {
115
115
  return { [k]: v };
116
116
  });
117
+ if (op in where) {
118
+ // Sibling groups are conjunctive, even when both use `$or`.
119
+ where.$and ??= [];
120
+ where.$and.push({ [op]: group });
121
+ }
122
+ else {
123
+ where[op] = group;
124
+ }
117
125
  }
118
126
  }
119
127
  return undefined;
package/utils/Utils.js CHANGED
@@ -153,7 +153,7 @@ export function parseJsonSafe(value) {
153
153
  /** Collection of general-purpose utility methods used throughout the ORM. */
154
154
  export class Utils {
155
155
  static PK_SEPARATOR = '~~~';
156
- static #ORM_VERSION = '7.2.2-dev.13';
156
+ static #ORM_VERSION = '7.2.2-dev.15';
157
157
  /** Default session variable name backing an RLS filter argument (`current_setting('mikro.<filter>.<arg>')`). */
158
158
  static getRlsSettingName(filterName, argName) {
159
159
  return `mikro.${filterName}.${argName}`;