@mikro-orm/core 7.0.11-dev.5 → 7.0.11-dev.7
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 +1 -1
- package/typings.d.ts +4 -3
- package/utils/Utils.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.0.11-dev.
|
|
3
|
+
"version": "7.0.11-dev.7",
|
|
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",
|
package/typings.d.ts
CHANGED
|
@@ -441,12 +441,13 @@ type RequiredNullableKeys<T> = {
|
|
|
441
441
|
[K in keyof T]: Exclude<T[K], null> extends RequiredNullable.Brand ? K : never;
|
|
442
442
|
}[keyof T];
|
|
443
443
|
type ProbablyOptionalProps<T> = PrimaryProperty<T> | ExplicitlyOptionalProps<T> | Exclude<NonNullable<NullableKeys<T, null | undefined>>, RequiredNullableKeys<T>>;
|
|
444
|
+
type RestoreOptUnknown<T> = [Exclude<T, null | undefined>] extends [Opt.Brand] ? [Opt.Brand] extends [Exclude<T, null | undefined>] ? unknown : T : T;
|
|
444
445
|
type IsOptional<T, K extends keyof T, I> = T[K] extends CollectionShape ? true : ExtractType<T[K]> extends I ? true : K extends ProbablyOptionalProps<T> ? true : false;
|
|
445
446
|
type RequiredKeys<T, K extends keyof T, I> = IsOptional<T, K, I> extends false ? CleanKeys<T, K> : never;
|
|
446
447
|
type OptionalKeys<T, K extends keyof T, I> = IsOptional<T, K, I> extends false ? never : CleanKeys<T, K>;
|
|
447
448
|
/** Data shape for creating or updating entities. All properties are optional. Used in `em.create()` and `em.assign()`. */
|
|
448
449
|
export type EntityData<T, C extends boolean = false> = {
|
|
449
|
-
[K in EntityKey<T>]?: EntityDataItem<T[K] & {}, C>;
|
|
450
|
+
[K in EntityKey<T>]?: RestoreOptUnknown<T[K]> | EntityDataItem<T[K] & {}, C>;
|
|
450
451
|
};
|
|
451
452
|
/**
|
|
452
453
|
* Data shape for `em.create()` with required/optional distinction based on entity metadata.
|
|
@@ -454,9 +455,9 @@ export type EntityData<T, C extends boolean = false> = {
|
|
|
454
455
|
* `I` excludes additional types from being required (used for inverse side of relations).
|
|
455
456
|
*/
|
|
456
457
|
export type RequiredEntityData<T, I = never, C extends boolean = false> = {
|
|
457
|
-
[K in keyof T as RequiredKeys<T, K, I>]: T[K] | RequiredEntityDataProp<T[K], T, C> | Primary<T[K]> | PolymorphicPrimary<T[K]> | Raw;
|
|
458
|
+
[K in keyof T as RequiredKeys<T, K, I>]: RestoreOptUnknown<T[K]> | RequiredEntityDataProp<T[K], T, C> | Primary<T[K]> | PolymorphicPrimary<T[K]> | Raw;
|
|
458
459
|
} & {
|
|
459
|
-
[K in keyof T as OptionalKeys<T, K, I>]?: T[K] | RequiredEntityDataProp<T[K], T, C> | Primary<T[K]> | PolymorphicPrimary<T[K]> | Raw | null;
|
|
460
|
+
[K in keyof T as OptionalKeys<T, K, I>]?: RestoreOptUnknown<T[K]> | RequiredEntityDataProp<T[K], T, C> | Primary<T[K]> | PolymorphicPrimary<T[K]> | Raw | null;
|
|
460
461
|
};
|
|
461
462
|
/** `EntityData<T>` extended with an index signature, allowing arbitrary additional properties. */
|
|
462
463
|
export type EntityDictionary<T> = EntityData<T> & Record<any, any>;
|
package/utils/Utils.js
CHANGED
|
@@ -141,7 +141,7 @@ export function parseJsonSafe(value) {
|
|
|
141
141
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
142
142
|
export class Utils {
|
|
143
143
|
static PK_SEPARATOR = '~~~';
|
|
144
|
-
static #ORM_VERSION = '7.0.11-dev.
|
|
144
|
+
static #ORM_VERSION = '7.0.11-dev.7';
|
|
145
145
|
/**
|
|
146
146
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
147
147
|
*/
|