@mikro-orm/core 7.0.7-dev.12 → 7.0.7-dev.14

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.
@@ -706,6 +706,9 @@ type MaybeScalarRef<Value, Options> = Options extends {
706
706
  } ? Value : Options extends {
707
707
  ref: true;
708
708
  } ? ScalarReference<Value> : Value;
709
+ type IsAllPropsOpt<T> = [Exclude<keyof T, symbol>] extends [never] ? false : {
710
+ [K in Exclude<keyof T, symbol>]-?: T[K] extends Opt ? never : K;
711
+ }[Exclude<keyof T, symbol>] extends never ? true : false;
709
712
  type MaybeOpt<Value, Options> = Options extends {
710
713
  mapToPk: true;
711
714
  } ? Value extends Opt<infer OriginalValue> ? OriginalValue : Value : Options extends {
@@ -722,7 +725,9 @@ type MaybeOpt<Value, Options> = Options extends {
722
725
  version: true;
723
726
  } | {
724
727
  formula: string | ((...args: any[]) => any);
725
- } ? Opt<NonNullable<Value>> | Extract<Value, null | undefined> : Value;
728
+ } ? Opt<NonNullable<Value>> | Extract<Value, null | undefined> : Options extends {
729
+ kind: 'embedded';
730
+ } ? IsAllPropsOpt<Value> extends true ? Opt<NonNullable<Value>> | Extract<Value, null | undefined> : Value : Value;
726
731
  type MaybeHidden<Value, Options> = Options extends {
727
732
  hidden: true;
728
733
  } ? Hidden<NonNullable<Value>> | Extract<Value, null | undefined> : Value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.0.7-dev.12",
3
+ "version": "7.0.7-dev.14",
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",
@@ -101,6 +101,8 @@ export class ChangeSetPersister {
101
101
  !prop.generated &&
102
102
  !prop.embedded &&
103
103
  ![ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(prop.kind) &&
104
+ !(prop.kind === ReferenceKind.EMBEDDED &&
105
+ prop.targetMeta?.props.every(p => p.formula || p.persist === false || p.primary)) &&
104
106
  prop.name !== wrapped.__meta.root.discriminatorColumn &&
105
107
  prop.type !== 'ObjectId' &&
106
108
  prop.persist !== false &&
package/utils/Utils.js CHANGED
@@ -132,7 +132,7 @@ export function parseJsonSafe(value) {
132
132
  /** Collection of general-purpose utility methods used throughout the ORM. */
133
133
  export class Utils {
134
134
  static PK_SEPARATOR = '~~~';
135
- static #ORM_VERSION = '7.0.7-dev.12';
135
+ static #ORM_VERSION = '7.0.7-dev.14';
136
136
  /**
137
137
  * Checks if the argument is instance of `Object`. Returns false for arrays.
138
138
  */