@koalarx/nest 3.1.2 → 3.1.4

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.
@@ -15,9 +15,6 @@ export declare abstract class RepositoryBase<TEntity extends EntityBase<TEntity>
15
15
  private readonly _modelName;
16
16
  private readonly _include?;
17
17
  private readonly _includeFindMany?;
18
- private readonly deepIncludeLimit;
19
- private deepIncludeCount;
20
- private resetDeepIncludeCount;
21
18
  constructor({ context, modelName, deepIncludeLimit, }: RepositoryInitProps<TEntity, TContext>);
22
19
  private getConnectPrismaSchemaForRelation;
23
20
  private getSelectRootPrismaSchema;
@@ -13,23 +13,16 @@ class RepositoryBase {
13
13
  _modelName;
14
14
  _include;
15
15
  _includeFindMany;
16
- deepIncludeLimit;
17
- deepIncludeCount = 0;
18
- resetDeepIncludeCount() {
19
- this.deepIncludeCount = 0;
20
- }
21
16
  constructor({ context, modelName, deepIncludeLimit, }) {
22
17
  this._context = context;
23
18
  this._modelName = modelName;
24
- this.deepIncludeLimit = deepIncludeLimit ?? 5;
25
19
  this._include = (0, generate_prisma_include_schema_1.generateIncludeSchema)({
26
20
  deepLimit: deepIncludeLimit || 5,
27
21
  entity: this._modelName,
28
22
  });
29
- this.resetDeepIncludeCount();
30
23
  this._includeFindMany = (0, generate_prisma_include_schema_1.generateIncludeSchema)({
31
24
  forList: true,
32
- deepLimit: deepIncludeLimit || 1,
25
+ deepLimit: 3,
33
26
  entity: this._modelName,
34
27
  });
35
28
  }
@@ -73,7 +66,7 @@ class RepositoryBase {
73
66
  return false;
74
67
  });
75
68
  }
76
- listRelationEntities(entity) {
69
+ listRelationEntities(entity, fromList = false) {
77
70
  const relationEntities = [];
78
71
  Object.keys(entity).forEach((key) => {
79
72
  if (entity[key] instanceof list_1.List) {
@@ -85,7 +78,7 @@ class RepositoryBase {
85
78
  relationEntities.push(item);
86
79
  });
87
80
  }
88
- else if (entity[key] instanceof entity_base_1.EntityBase) {
81
+ else if (entity[key] instanceof entity_base_1.EntityBase && !fromList) {
89
82
  relationEntities.push(entity[key]);
90
83
  }
91
84
  });
@@ -122,7 +115,7 @@ class RepositoryBase {
122
115
  },
123
116
  select: this.getSelectRootPrismaSchema(item),
124
117
  },
125
- relations: this.listRelationEntities(item),
118
+ relations: this.listRelationEntities(item, true),
126
119
  });
127
120
  });
128
121
  list.toArray('updated').forEach((item) => {
@@ -134,7 +127,7 @@ class RepositoryBase {
134
127
  data: this.entityToPrisma(item),
135
128
  select: this.getSelectRootPrismaSchema(item),
136
129
  },
137
- relations: this.listRelationEntities(item),
130
+ relations: this.listRelationEntities(item, true),
138
131
  });
139
132
  });
140
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalarx/nest",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "",
5
5
  "author": "Igor D. Rangel",
6
6
  "license": "MIT",