@mikro-orm/core 7.0.0-dev.142 → 7.0.0-dev.144

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
3
  "type": "module",
4
- "version": "7.0.0-dev.142",
4
+ "version": "7.0.0-dev.144",
5
5
  "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.",
6
6
  "exports": {
7
7
  "./package.json": "./package.json",
package/typings.d.ts CHANGED
@@ -115,6 +115,7 @@ export type IPrimaryKey<T extends IPrimaryKeyValue = IPrimaryKeyValue> = T;
115
115
  export type Scalar = boolean | number | string | bigint | symbol | Date | RegExp | Uint8Array | {
116
116
  toHexString(): string;
117
117
  };
118
+ type Primitive = boolean | number | string | bigint | symbol;
118
119
  export type ExpandScalar<T> = null | (T extends string ? T | RegExp : T extends Date ? Date | string : T extends bigint ? bigint | string | number : T);
119
120
  export type OperatorMap<T> = {
120
121
  $and?: ExpandQuery<T>[];
@@ -291,7 +292,7 @@ export type Ref<T> = T extends any ? IsAny<T> extends true ? Reference<T & objec
291
292
  type ExtractHiddenProps<T> = (T extends {
292
293
  [HiddenProps]?: infer K;
293
294
  } ? K : never) | ({
294
- [K in keyof T]: T[K] extends Hidden ? K : never;
295
+ [K in keyof T]: T[K] extends Primitive ? (T[K] extends Hidden ? K : never) : never;
295
296
  }[keyof T] & {});
296
297
  type ExcludeHidden<T, K extends keyof T> = K extends ExtractHiddenProps<T> ? never : K;
297
298
  type ExtractConfig<T> = T extends {
package/utils/Utils.d.ts CHANGED
@@ -139,7 +139,7 @@ export declare class Utils {
139
139
  * Extracts all possible values of a TS enum. Works with both string and numeric enums.
140
140
  */
141
141
  static extractEnumValues(target: Dictionary): (string | number)[];
142
- static flatten<T>(arrays: T[][]): T[];
142
+ static flatten<T>(arrays: T[][], deep?: boolean): T[];
143
143
  static isOperator(key: PropertyKey, includeGroupOperators?: boolean): boolean;
144
144
  static hasNestedKey(object: unknown, key: string): boolean;
145
145
  static getORMVersion(): string;
package/utils/Utils.js CHANGED
@@ -123,7 +123,7 @@ export function parseJsonSafe(value) {
123
123
  }
124
124
  export class Utils {
125
125
  static PK_SEPARATOR = '~~~';
126
- static #ORM_VERSION = '7.0.0-dev.142';
126
+ static #ORM_VERSION = '7.0.0-dev.144';
127
127
  /**
128
128
  * Checks if the argument is instance of `Object`. Returns false for arrays.
129
129
  */
@@ -642,8 +642,8 @@ export class Utils {
642
642
  }
643
643
  return values;
644
644
  }
645
- static flatten(arrays) {
646
- return [].concat.apply([], arrays);
645
+ static flatten(arrays, deep) {
646
+ return arrays.flatMap(v => deep && Array.isArray(v) ? this.flatten(v, true) : v);
647
647
  }
648
648
  static isOperator(key, includeGroupOperators = true) {
649
649
  if (!includeGroupOperators) {