@mikro-orm/core 7.0.0-dev.212 → 7.0.0-dev.214

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.
@@ -359,7 +359,7 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
359
359
  * The newly created entity will be automatically marked for persistence via `em.persist` unless you disable this
360
360
  * behavior, either locally via `persist: false` option, or globally via `persistOnCreate` ORM config option.
361
361
  */
362
- create<Entity extends object, Convert extends boolean = false>(entityName: EntityName<Entity>, data: RequiredEntityData<Entity, never, Convert>, options?: CreateOptions<Convert>): Entity;
362
+ create<Entity extends object, Convert extends boolean = false, Data extends RequiredEntityData<Entity, never, Convert> = RequiredEntityData<Entity, never, Convert>>(entityName: EntityName<Entity>, data: Data & IsSubset<RequiredEntityData<Entity, never, Convert>, Data>, options?: CreateOptions<Convert>): Entity;
363
363
  /**
364
364
  * Creates new instance of given entity and populates it with given data.
365
365
  * The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
@@ -375,7 +375,7 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
375
375
  * The newly created entity will be automatically marked for persistence via `em.persist` unless you disable this
376
376
  * behavior, either locally via `persist: false` option, or globally via `persistOnCreate` ORM config option.
377
377
  */
378
- create<Entity extends object, Convert extends boolean = false>(entityName: EntityName<Entity>, data: EntityData<Entity, Convert>, options: CreateOptions<Convert> & {
378
+ create<Entity extends object, Convert extends boolean = false, Data extends EntityData<Entity, Convert> = EntityData<Entity, Convert>>(entityName: EntityName<Entity>, data: Data & IsSubset<EntityData<Entity, Convert>, Data>, options: CreateOptions<Convert> & {
379
379
  partial: true;
380
380
  }): Entity;
381
381
  /**
@@ -166,13 +166,13 @@ export declare class EntityRepository<Entity extends object> {
166
166
  * The newly created entity will be automatically marked for persistence via `em.persist` unless you disable this
167
167
  * behavior, either locally via `persist: false` option, or globally via `persistOnCreate` ORM config option.
168
168
  */
169
- create<Convert extends boolean = false>(data: RequiredEntityData<Entity, never, Convert>, options?: CreateOptions<Convert>): Entity;
169
+ create<Convert extends boolean = false, Data extends RequiredEntityData<Entity, never, Convert> = RequiredEntityData<Entity, never, Convert>>(data: Data & IsSubset<RequiredEntityData<Entity, never, Convert>, Data>, options?: CreateOptions<Convert>): Entity;
170
170
  /**
171
171
  * Creates new instance of given entity and populates it with given data.
172
172
  * The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
173
173
  * The constructor will be given parameters based on the defined constructor of the entity. If the constructor
174
174
  * parameter matches a property name, its value will be extracted from `data`. If no matching property exists,
175
- * the whole `data` parameter will be passed. This means we can also define `constructor(data: Partial<T>)` and
175
+ * the whole `data` parameter will be pass. This means we can also define `constructor(data: Partial<T>)` and
176
176
  * `em.create()` will pass the data into it (unless we have a property named `data` too).
177
177
  *
178
178
  * The parameters are strictly checked, you need to provide all required properties. You can use `OptionalProps`
@@ -182,7 +182,7 @@ export declare class EntityRepository<Entity extends object> {
182
182
  * The newly created entity will be automatically marked for persistence via `em.persist` unless you disable this
183
183
  * behavior, either locally via `persist: false` option, or globally via `persistOnCreate` ORM config option.
184
184
  */
185
- create<Convert extends boolean = false>(data: EntityData<Entity, Convert>, options: CreateOptions<Convert> & {
185
+ create<Convert extends boolean = false, Data extends EntityData<Entity, Convert> = EntityData<Entity, Convert>>(data: Data & IsSubset<EntityData<Entity, Convert>, Data>, options: CreateOptions<Convert> & {
186
186
  partial: true;
187
187
  }): Entity;
188
188
  /**
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.212",
4
+ "version": "7.0.0-dev.214",
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/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.212';
126
+ static #ORM_VERSION = '7.0.0-dev.214';
127
127
  /**
128
128
  * Checks if the argument is instance of `Object`. Returns false for arrays.
129
129
  */