@graf-research/adf-codegen-model-typeorm 0.0.14 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
package/dist/exec.js CHANGED
File without changes
package/dist/index.js CHANGED
@@ -72,9 +72,9 @@ var TypeORMModel;
72
72
  case "enum": return `./model/enum/${item.name}${extension !== null && extension !== void 0 ? extension : ''}`;
73
73
  }
74
74
  }
75
- function buildTableDependency(table, list_model) {
75
+ function buildTableDependency(except_self_name, table, list_model) {
76
76
  return table.columns
77
- .filter((tc) => tc.type.type === 'relation' || tc.type.type === 'enum')
77
+ .filter((tc) => (tc.type.type === 'relation' && tc.type.table_name !== except_self_name) || tc.type.type === 'enum')
78
78
  .map((tc) => {
79
79
  const type = tc.type;
80
80
  switch (type.type) {
@@ -254,7 +254,7 @@ var TypeORMModel;
254
254
  filename: getModelFileName(table, '.ts'),
255
255
  content: [
256
256
  'import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryColumn, PrimaryGeneratedColumn, UpdateDateColumn, BaseEntity } from "typeorm";',
257
- ...lodash_1.default.uniq(buildTableDependency(table, list_model)),
257
+ ...lodash_1.default.uniq(buildTableDependency(table.name, table, list_model)),
258
258
  '',
259
259
  `@Entity('${table.name}')`,
260
260
  `export class ${table.name} extends BaseEntity {`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graf-research/adf-codegen-model-typeorm",
3
- "version": "0.0.14",
3
+ "version": "0.0.20",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "rm -rf dist && tsc",