@mikro-orm/sql 7.1.0-dev.45 → 7.1.0-dev.46

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.
@@ -838,13 +838,19 @@ export class AbstractSqlDriver extends DatabaseDriver {
838
838
  else {
839
839
  const field = prop.fieldNames[0];
840
840
  if (!duplicates.includes(field) || !usedDups.includes(field)) {
841
+ const rowValue = row[prop.name];
842
+ const rowValueIsRaw = isRaw(rowValue);
841
843
  if (prop.customType &&
842
844
  !prop.object &&
843
845
  'convertToDatabaseValueSQL' in prop.customType &&
844
- row[prop.name] != null &&
845
- !isRaw(row[prop.name])) {
846
+ rowValue != null &&
847
+ !rowValueIsRaw) {
846
848
  keys.push(prop.customType.convertToDatabaseValueSQL('?', this.platform));
847
849
  }
850
+ else if (rowValueIsRaw && /^\s*(?:with|select)\b/i.test(rowValue.sql)) {
851
+ // raw subqueries must be parenthesized when inlined as a VALUES position
852
+ keys.push('(?)');
853
+ }
848
854
  else {
849
855
  keys.push('?');
850
856
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.1.0-dev.45",
3
+ "version": "7.1.0-dev.46",
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",
@@ -53,7 +53,7 @@
53
53
  "@mikro-orm/core": "^7.0.17"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.1.0-dev.45"
56
+ "@mikro-orm/core": "7.1.0-dev.46"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"
package/typings.d.ts CHANGED
@@ -397,7 +397,7 @@ type ClassEntityColumns<T, TOptions extends MikroKyselyPluginOptions = {}> = T e
397
397
  type ClassEntityColumnName<K, V, TOptions extends MikroKyselyPluginOptions = {}> = K extends symbol ? never : NonNullable<V> extends infer NV ? NV extends {
398
398
  [k: number]: any;
399
399
  readonly owner: object;
400
- } ? never : TOptions['columnNamingStrategy'] extends 'property' ? K : NV extends Scalar ? K extends string ? SnakeCase<K> : never : K extends string ? ClassEntityJoinColumnName<SnakeCase<K>, NV> : never : never;
400
+ } ? never : TOptions['columnNamingStrategy'] extends 'property' ? K : NV extends Scalar | readonly any[] ? K extends string ? SnakeCase<K> : never : K extends string ? ClassEntityJoinColumnName<SnakeCase<K>, NV> : never : never;
401
401
  type ClassEntityJoinColumnName<TName extends string, V> = PrimaryProperty<V> extends string ? `${TName}_${SnakeCase<PrimaryProperty<V>>}` : never;
402
- type ClassEntityColumnValue<V> = NonNullable<V> extends Scalar ? V : Primary<NonNullable<V>>;
402
+ type ClassEntityColumnValue<V> = NonNullable<V> extends Scalar | readonly any[] ? V : Primary<NonNullable<V>>;
403
403
  export {};