@mikro-orm/core 6.3.3 → 6.3.4-dev.1

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.
@@ -308,7 +308,7 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
308
308
  merge<Entity extends object>(entityName: EntityName<Entity>, data: EntityData<Entity> | EntityDTO<Entity>, options?: MergeOptions): Entity;
309
309
  /**
310
310
  * Creates new instance of given entity and populates it with given data.
311
- * The entity constructor will be used unless you provide `{ managed: true }` in the options parameter.
311
+ * The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
312
312
  * The constructor will be given parameters based on the defined constructor of the entity. If the constructor
313
313
  * parameter matches a property name, its value will be extracted from `data`. If no matching property exists,
314
314
  * the whole `data` parameter will be passed. This means we can also define `constructor(data: Partial<T>)` and
@@ -317,11 +317,14 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
317
317
  * The parameters are strictly checked, you need to provide all required properties. You can use `OptionalProps`
318
318
  * symbol to omit some properties from this check without making them optional. Alternatively, use `partial: true`
319
319
  * in the options to disable the strict checks for required properties. This option has no effect on runtime.
320
+ *
321
+ * The newly created entity will be automatically marked for persistence via `em.persist` unless you disable this
322
+ * behavior, either locally via `persist: false` option, or globally via `persistOnCreate` ORM config option.
320
323
  */
321
324
  create<Entity extends object, Convert extends boolean = false>(entityName: EntityName<Entity>, data: RequiredEntityData<Entity, never, Convert>, options?: CreateOptions<Convert>): Entity;
322
325
  /**
323
326
  * Creates new instance of given entity and populates it with given data.
324
- * The entity constructor will be used unless you provide `{ managed: true }` in the options parameter.
327
+ * The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
325
328
  * The constructor will be given parameters based on the defined constructor of the entity. If the constructor
326
329
  * parameter matches a property name, its value will be extracted from `data`. If no matching property exists,
327
330
  * the whole `data` parameter will be passed. This means we can also define `constructor(data: Partial<T>)` and
@@ -330,6 +333,9 @@ export declare class EntityManager<Driver extends IDatabaseDriver = IDatabaseDri
330
333
  * The parameters are strictly checked, you need to provide all required properties. You can use `OptionalProps`
331
334
  * symbol to omit some properties from this check without making them optional. Alternatively, use `partial: true`
332
335
  * in the options to disable the strict checks for required properties. This option has no effect on runtime.
336
+ *
337
+ * The newly created entity will be automatically marked for persistence via `em.persist` unless you disable this
338
+ * behavior, either locally via `persist: false` option, or globally via `persistOnCreate` ORM config option.
333
339
  */
334
340
  create<Entity extends object, Convert extends boolean = false>(entityName: EntityName<Entity>, data: EntityData<Entity, Convert>, options: CreateOptions<Convert> & {
335
341
  partial: true;
package/EntityManager.js CHANGED
@@ -1158,15 +1158,18 @@ class EntityManager {
1158
1158
  }
1159
1159
  /**
1160
1160
  * Creates new instance of given entity and populates it with given data.
1161
- * The entity constructor will be used unless you provide `{ managed: true }` in the options parameter.
1161
+ * The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
1162
1162
  * The constructor will be given parameters based on the defined constructor of the entity. If the constructor
1163
1163
  * parameter matches a property name, its value will be extracted from `data`. If no matching property exists,
1164
1164
  * the whole `data` parameter will be passed. This means we can also define `constructor(data: Partial<T>)` and
1165
1165
  * `em.create()` will pass the data into it (unless we have a property named `data` too).
1166
1166
  *
1167
- The parameters are strictly checked, you need to provide all required properties. You can use `OptionalProps`
1168
- symbol to omit some properties from this check without making them optional. Alternatively, use `partial: true`
1169
- in the options to disable the strict checks for required properties. This option has no effect on runtime.
1167
+ * The parameters are strictly checked, you need to provide all required properties. You can use `OptionalProps`
1168
+ * symbol to omit some properties from this check without making them optional. Alternatively, use `partial: true`
1169
+ * in the options to disable the strict checks for required properties. This option has no effect on runtime.
1170
+ *
1171
+ * The newly created entity will be automatically marked for persistence via `em.persist` unless you disable this
1172
+ * behavior, either locally via `persist: false` option, or globally via `persistOnCreate` ORM config option.
1170
1173
  */
1171
1174
  create(entityName, data, options = {}) {
1172
1175
  const em = this.getContext();
package/README.md CHANGED
@@ -8,7 +8,7 @@ TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-or
8
8
 
9
9
  [![NPM version](https://img.shields.io/npm/v/@mikro-orm/core.svg)](https://www.npmjs.com/package/@mikro-orm/core)
10
10
  [![NPM dev version](https://img.shields.io/npm/v/@mikro-orm/core/next.svg)](https://www.npmjs.com/package/@mikro-orm/core)
11
- [![Chat on discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://discord.gg/w8bjxFHS7X)
11
+ [![Chat on discord](https://img.shields.io/discord/1214904142443839538?label=discord&color=blue)](https://discord.gg/w8bjxFHS7X)
12
12
  [![Downloads](https://img.shields.io/npm/dm/@mikro-orm/core.svg)](https://www.npmjs.com/package/@mikro-orm/core)
13
13
  [![Coverage Status](https://img.shields.io/coveralls/mikro-orm/mikro-orm.svg)](https://coveralls.io/r/mikro-orm/mikro-orm?branch=master)
14
14
  [![Maintainability](https://api.codeclimate.com/v1/badges/27999651d3adc47cfa40/maintainability)](https://codeclimate.com/github/mikro-orm/mikro-orm/maintainability)
@@ -132,14 +132,15 @@ export declare class EntityRepository<Entity extends object> {
132
132
  */
133
133
  populate<Ent extends Entity | Entity[], Hint extends string = never, Naked extends FromEntityType<Entity> = FromEntityType<Entity>, Fields extends string = '*', Excludes extends string = never>(entities: Ent, populate: AutoPath<Naked, Hint, PopulatePath.ALL>[] | false, options?: EntityLoaderOptions<Naked, Fields, Excludes>): Promise<Ent extends object[] ? MergeLoaded<ArrayElement<Ent>, Naked, Hint, Fields, Excludes>[] : MergeLoaded<Ent, Naked, Hint, Fields, Excludes>>;
134
134
  /**
135
- * Creates new instance of given entity and populates it with given data.
136
- * The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
137
- * The constructor will be given parameters based on the defined constructor of the entity. If the constructor
138
- * parameter matches a property name, its value will be extracted from `data`. If no matching property exists,
139
- * the whole `data` parameter will be passed. This means we can also define `constructor(data: Partial<Entity>)` and
140
- * `em.create()` will pass the data into it (unless we have a property named `data` too).
135
+ * @inheritDoc EntityManager.create
141
136
  */
142
137
  create<Convert extends boolean = false>(data: RequiredEntityData<Entity, never, Convert>, options?: CreateOptions<Convert>): Entity;
138
+ /**
139
+ * @inheritDoc EntityManager.create
140
+ */
141
+ create<Convert extends boolean = false>(data: EntityData<Entity, Convert>, options: CreateOptions<Convert> & {
142
+ partial: true;
143
+ }): Entity;
143
144
  /**
144
145
  * Shortcut for `wrap(entity).assign(data, { em })`
145
146
  */
@@ -153,12 +153,7 @@ class EntityRepository {
153
153
  return this.getEntityManager().populate(entities, populate, options);
154
154
  }
155
155
  /**
156
- * Creates new instance of given entity and populates it with given data.
157
- * The entity constructor will be used unless you provide `{ managed: true }` in the `options` parameter.
158
- * The constructor will be given parameters based on the defined constructor of the entity. If the constructor
159
- * parameter matches a property name, its value will be extracted from `data`. If no matching property exists,
160
- * the whole `data` parameter will be passed. This means we can also define `constructor(data: Partial<Entity>)` and
161
- * `em.create()` will pass the data into it (unless we have a property named `data` too).
156
+ * @inheritDoc EntityManager.create
162
157
  */
163
158
  create(data, options) {
164
159
  return this.getEntityManager().create(this.entityName, data, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.3.3",
3
+ "version": "6.3.4-dev.1",
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
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -64,7 +64,7 @@
64
64
  "esprima": "4.0.1",
65
65
  "fs-extra": "11.2.0",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.3.3",
67
+ "mikro-orm": "6.3.4-dev.1",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }