@mikro-orm/entity-generator 7.0.0-dev.22 → 7.0.0-dev.23

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/README.md CHANGED
@@ -11,7 +11,6 @@ TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-or
11
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
- [![Maintainability](https://api.codeclimate.com/v1/badges/27999651d3adc47cfa40/maintainability)](https://codeclimate.com/github/mikro-orm/mikro-orm/maintainability)
15
14
  [![Build Status](https://github.com/mikro-orm/mikro-orm/workflows/tests/badge.svg?branch=master)](https://github.com/mikro-orm/mikro-orm/actions?workflow=tests)
16
15
 
17
16
  ## 🤔 Unit of What?
@@ -141,7 +140,7 @@ There is also auto-generated [CHANGELOG.md](CHANGELOG.md) file based on commit m
141
140
  - [Composite and Foreign Keys as Primary Key](https://mikro-orm.io/docs/composite-keys)
142
141
  - [Filters](https://mikro-orm.io/docs/filters)
143
142
  - [Using `QueryBuilder`](https://mikro-orm.io/docs/query-builder)
144
- - [Preloading Deeply Nested Structures via populate](https://mikro-orm.io/docs/nested-populate)
143
+ - [Populating relations](https://mikro-orm.io/docs/populating-relations)
145
144
  - [Property Validation](https://mikro-orm.io/docs/property-validation)
146
145
  - [Lifecycle Hooks](https://mikro-orm.io/docs/events#hooks)
147
146
  - [Vanilla JS Support](https://mikro-orm.io/docs/usage-with-js)
package/SourceFile.js CHANGED
@@ -99,9 +99,12 @@ export class SourceFile {
99
99
  if (typeof index.name === 'string') {
100
100
  indexOpt.name = this.quote(index.name);
101
101
  }
102
- if (index.expression) {
102
+ if (typeof index.expression === 'string') {
103
103
  indexOpt.expression = this.quote(index.expression);
104
104
  }
105
+ else if (typeof index.expression === 'function') {
106
+ indexOpt.expression = `${index.expression}`.replace(')=>`', ') => `');
107
+ }
105
108
  if (isAtEntityLevel && index.properties) {
106
109
  indexOpt.properties = Utils.asArray(index.properties).map(prop => this.quote('' + prop));
107
110
  }
@@ -112,9 +115,12 @@ export class SourceFile {
112
115
  if (typeof index.name === 'string') {
113
116
  uniqueOpt.name = this.quote(index.name);
114
117
  }
115
- if (index.expression) {
118
+ if (typeof index.expression === 'string') {
116
119
  uniqueOpt.expression = this.quote(index.expression);
117
120
  }
121
+ else if (typeof index.expression === 'function') {
122
+ uniqueOpt.expression = `${index.expression}`.replace(')=>`', ') => `');
123
+ }
118
124
  if (isAtEntityLevel && index.properties) {
119
125
  uniqueOpt.properties = Utils.asArray(index.properties).map(prop => this.quote('' + prop));
120
126
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mikro-orm/entity-generator",
3
3
  "type": "module",
4
- "version": "7.0.0-dev.22",
4
+ "version": "7.0.0-dev.23",
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",
@@ -50,12 +50,12 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@mikro-orm/knex": "7.0.0-dev.22"
53
+ "@mikro-orm/knex": "7.0.0-dev.23"
54
54
  },
55
55
  "devDependencies": {
56
- "@mikro-orm/core": "^6.4.15"
56
+ "@mikro-orm/core": "^6.5.1"
57
57
  },
58
58
  "peerDependencies": {
59
- "@mikro-orm/core": "7.0.0-dev.22"
59
+ "@mikro-orm/core": "7.0.0-dev.23"
60
60
  }
61
61
  }