@postxl/generator 0.62.5 → 0.62.6

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.
@@ -60,6 +60,7 @@ function generateRepository({ model, meta }) {
60
60
  imports,
61
61
  blocks: {
62
62
  uniqueStringFieldsBlocks,
63
+ relationsBlocks,
63
64
  defaultValueBlocks,
64
65
  idBlocks,
65
66
  indexBlocks,
@@ -76,6 +77,7 @@ function generateRepository({ model, meta }) {
76
77
  imports,
77
78
  blocks: {
78
79
  uniqueStringFieldsBlocks,
80
+ relationsBlocks,
79
81
  defaultValueBlocks,
80
82
  idBlocks,
81
83
  indexBlocks,
@@ -241,8 +243,11 @@ function _generateMainBuildingBlocks_InMemoryOnly({ model, meta, schemaMeta, imp
241
243
  // eslint-disable-next-line @typescript-eslint/require-await
242
244
  public async init() {
243
245
  this.data.clear()
246
+
247
+ ${blocks.relationsBlocks.clearCode.join('\n')}
244
248
 
245
249
  ${blocks.uniqueStringFieldsBlocks.clearCode.join('\n')}
250
+
246
251
  ${blocks.defaultValueBlocks.init.resetCode}
247
252
 
248
253
  ${blocks.indexBlocks.initCode.join('\n')}
@@ -485,6 +490,8 @@ function generateMainBuildingBlocks_InDatabase({ model, meta, schemaMeta, import
485
490
  public async init() {
486
491
  this.data.clear()
487
492
 
493
+ ${blocks.relationsBlocks.clearCode.join('\n')}
494
+
488
495
  ${blocks.uniqueStringFieldsBlocks.clearCode.join('\n')}
489
496
 
490
497
  ${blocks.defaultValueBlocks.init.resetCode}
@@ -1324,6 +1331,7 @@ function generateRelationsBlocks({ model, imports, }) {
1324
1331
  const relations = model.fields.filter(schema_1.isFieldRelation);
1325
1332
  const result = {
1326
1333
  mapDeclarations: [],
1334
+ clearCode: [],
1327
1335
  getterFunctions: [],
1328
1336
  setCode: [],
1329
1337
  removeCode: [],
@@ -1336,6 +1344,7 @@ function generateRelationsBlocks({ model, imports, }) {
1336
1344
  from: relationModelMeta.types.importPath,
1337
1345
  });
1338
1346
  result.mapDeclarations.push(`protected ${r.name}Map: Map<${relationModelMeta.types.brandedIdType}, Map<${model.brandedIdType}, ${model.typeName}>> = new Map()`);
1347
+ result.clearCode.push(`this.${r.name}Map.clear()`);
1339
1348
  result.getterFunctions.push(`
1340
1349
  /**
1341
1350
  * Function to retrieve all ${(0, string_1.pluralize)(model.name)} that are related to a ${r.name}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postxl/generator",
3
- "version": "0.62.5",
3
+ "version": "0.62.6",
4
4
  "main": "./dist/generator.js",
5
5
  "typings": "./dist/generator.d.ts",
6
6
  "bin": {