@mikro-orm/core 7.2.7-dev.11 → 7.2.7-dev.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.2.7-dev.11",
3
+ "version": "7.2.7-dev.13",
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",
@@ -125,6 +125,10 @@ export { RawQueryFragment as Raw };
125
125
  export const ALIAS_REPLACEMENT = '[::alias::]';
126
126
  /** @internal */
127
127
  export const ALIAS_REPLACEMENT_RE = '\\[::alias::\\]';
128
+ // a query builder param is embedded as a sub-query instead of being bound as a value
129
+ function toRawParam(param) {
130
+ return isSubquery(param) ? param.toRaw() : param;
131
+ }
128
132
  /**
129
133
  * Creates raw SQL query fragment that can be assigned to a property or part of a filter. This fragment is represented
130
134
  * by `RawQueryFragment` class instance that can be serialized to a string, so it can be used both as an object value
@@ -208,12 +212,12 @@ export function raw(sql, params) {
208
212
  if (!Object.hasOwn(dict, key)) {
209
213
  return match;
210
214
  }
211
- objectParams.push(dict[key]);
215
+ objectParams.push(toRawParam(dict[key]));
212
216
  return identifier ? '??' : '?';
213
217
  });
214
218
  return new RawQueryFragment(sql, objectParams);
215
219
  }
216
- return new RawQueryFragment(sql, params);
220
+ return new RawQueryFragment(sql, params?.map(toRawParam));
217
221
  }
218
222
  /**
219
223
  * Alternative to the `raw()` helper allowing to use it as a tagged template function for the simple cases.
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.7-dev.11';
156
+ static #ORM_VERSION = '7.2.7-dev.13';
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}`;