sonamu 0.4.1 → 0.4.3

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.
Files changed (35) hide show
  1. package/dist/bin/cli.js +51 -51
  2. package/dist/bin/cli.js.map +1 -1
  3. package/dist/bin/cli.mjs +2 -2
  4. package/dist/bin/cli.mjs.map +1 -1
  5. package/dist/{chunk-FLPD24HS.mjs → chunk-4K2F3SOM.mjs} +2 -2
  6. package/dist/{chunk-I2MMJRJN.mjs → chunk-HIUT56RE.mjs} +32 -15
  7. package/dist/chunk-HIUT56RE.mjs.map +1 -0
  8. package/dist/{chunk-QK5XXJUX.mjs → chunk-HVVCQLAU.mjs} +2 -2
  9. package/dist/{chunk-Z2P7XTXE.js → chunk-JBKIW5LD.js} +130 -113
  10. package/dist/chunk-JBKIW5LD.js.map +1 -0
  11. package/dist/{chunk-U636LQJJ.js → chunk-N6N3LENC.js} +4 -4
  12. package/dist/{chunk-W7KDVJLQ.js → chunk-UAG3SKFM.js} +7 -7
  13. package/dist/{chunk-XT6LHCX5.js → chunk-WJGRXAXE.js} +12 -4
  14. package/dist/chunk-WJGRXAXE.js.map +1 -0
  15. package/dist/{chunk-PP2PSSAG.mjs → chunk-ZFLQLW37.mjs} +12 -4
  16. package/dist/{chunk-PP2PSSAG.mjs.map → chunk-ZFLQLW37.mjs.map} +1 -1
  17. package/dist/database/drivers/knex/base-model.js +8 -8
  18. package/dist/database/drivers/knex/base-model.mjs +3 -3
  19. package/dist/database/drivers/kysely/base-model.js +9 -9
  20. package/dist/database/drivers/kysely/base-model.mjs +3 -3
  21. package/dist/index.d.mts +4 -3
  22. package/dist/index.d.ts +4 -3
  23. package/dist/index.js +7 -7
  24. package/dist/index.mjs +3 -3
  25. package/package.json +2 -2
  26. package/src/api/sonamu.ts +17 -4
  27. package/src/bin/cli.ts +1 -0
  28. package/src/entity/migrator.ts +51 -19
  29. package/dist/chunk-I2MMJRJN.mjs.map +0 -1
  30. package/dist/chunk-XT6LHCX5.js.map +0 -1
  31. package/dist/chunk-Z2P7XTXE.js.map +0 -1
  32. /package/dist/{chunk-FLPD24HS.mjs.map → chunk-4K2F3SOM.mjs.map} +0 -0
  33. /package/dist/{chunk-QK5XXJUX.mjs.map → chunk-HVVCQLAU.mjs.map} +0 -0
  34. /package/dist/{chunk-U636LQJJ.js.map → chunk-N6N3LENC.js.map} +0 -0
  35. /package/dist/{chunk-W7KDVJLQ.js.map → chunk-UAG3SKFM.js.map} +0 -0
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkXT6LHCX5js = require('./chunk-XT6LHCX5.js');
19
+ var _chunkWJGRXAXEjs = require('./chunk-WJGRXAXE.js');
20
20
 
21
21
  // src/entity/migrator.ts
22
22
  var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash);
@@ -34,10 +34,10 @@ var Migrator = class {
34
34
  constructor(options) {
35
35
  this.mode = options.mode;
36
36
  if (this.mode === "dev") {
37
- const devDB = _chunkXT6LHCX5js.DB.getClient("development_master");
38
- const testDB = _chunkXT6LHCX5js.DB.getClient("test");
39
- const fixtureLocalDB = _chunkXT6LHCX5js.DB.getClient("fixture_local");
40
- const uniqConfigs = _chunkXT6LHCX5js.DB.getUniqueConfigs([
37
+ const devDB = _chunkWJGRXAXEjs.DB.getClient("development_master");
38
+ const testDB = _chunkWJGRXAXEjs.DB.getClient("test");
39
+ const fixtureLocalDB = _chunkWJGRXAXEjs.DB.getClient("fixture_local");
40
+ const uniqConfigs = _chunkWJGRXAXEjs.DB.getUniqueConfigs([
41
41
  "development_master",
42
42
  "test",
43
43
  "fixture_local",
@@ -45,7 +45,7 @@ var Migrator = class {
45
45
  ]);
46
46
  const applyDBs = [devDB, testDB, fixtureLocalDB];
47
47
  if (uniqConfigs.length === 4) {
48
- const fixtureRemoteDB = _chunkXT6LHCX5js.DB.getClient("fixture_remote");
48
+ const fixtureRemoteDB = _chunkWJGRXAXEjs.DB.getClient("fixture_remote");
49
49
  applyDBs.push(fixtureRemoteDB);
50
50
  }
51
51
  this.targets = {
@@ -55,8 +55,8 @@ var Migrator = class {
55
55
  apply: applyDBs
56
56
  };
57
57
  } else if (this.mode === "deploy") {
58
- const productionDB = _chunkXT6LHCX5js.DB.getClient("production_master");
59
- const testDB = _chunkXT6LHCX5js.DB.getClient("test");
58
+ const productionDB = _chunkWJGRXAXEjs.DB.getClient("production_master");
59
+ const testDB = _chunkWJGRXAXEjs.DB.getClient("test");
60
60
  this.targets = {
61
61
  pending: productionDB,
62
62
  shadow: testDB,
@@ -67,8 +67,8 @@ var Migrator = class {
67
67
  }
68
68
  }
69
69
  async getMigrationCodes() {
70
- const srcMigrationsDir = `${_chunkXT6LHCX5js.Sonamu.apiRootPath}/src/migrations`;
71
- const distMigrationsDir = `${_chunkXT6LHCX5js.Sonamu.apiRootPath}/dist/migrations`;
70
+ const srcMigrationsDir = `${_chunkWJGRXAXEjs.Sonamu.apiRootPath}/src/migrations`;
71
+ const distMigrationsDir = `${_chunkWJGRXAXEjs.Sonamu.apiRootPath}/dist/migrations`;
72
72
  if (_fsextra2.default.existsSync(srcMigrationsDir) === false) {
73
73
  _fsextra2.default.mkdirSync(srcMigrationsDir, {
74
74
  recursive: true
@@ -113,8 +113,8 @@ var Migrator = class {
113
113
  const { normal, onlyTs, onlyJs } = await this.getMigrationCodes();
114
114
  if (onlyTs.length > 0) {
115
115
  console.debug({ onlyTs });
116
- throw new (0, _chunkXT6LHCX5js.ServiceUnavailableException)(
117
- `There is an un-compiled TS migration files.
116
+ throw new (0, _chunkWJGRXAXEjs.ServiceUnavailableException)(
117
+ `There are un-compiled TS migration files.
118
118
  Please compile them first.
119
119
 
120
120
  ${onlyTs.map((f) => f.name).join("\n")}`
@@ -130,12 +130,12 @@ ${onlyTs.map((f) => f.name).join("\n")}`
130
130
  })
131
131
  );
132
132
  }
133
- const connKeys = Object.keys(_chunkXT6LHCX5js.DB.fullConfig).filter(
133
+ const connKeys = Object.keys(_chunkWJGRXAXEjs.DB.fullConfig).filter(
134
134
  (key) => key.endsWith("_slave") === false
135
135
  );
136
136
  const statuses = await Promise.all(
137
137
  connKeys.map(async (connKey) => {
138
- const tConn = _chunkXT6LHCX5js.DB.getClient(connKey);
138
+ const tConn = _chunkWJGRXAXEjs.DB.getClient(connKey);
139
139
  const status = await (async () => {
140
140
  try {
141
141
  return await tConn.status();
@@ -172,7 +172,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
172
172
  if (status0conn === void 0) {
173
173
  return [];
174
174
  }
175
- const compareDBconn = _chunkXT6LHCX5js.DB.getClient(status0conn.connKey);
175
+ const compareDBconn = _chunkWJGRXAXEjs.DB.getClient(status0conn.connKey);
176
176
  const genCodes = await this.compareMigrations(compareDBconn);
177
177
  await compareDBconn.destroy();
178
178
  return genCodes;
@@ -184,11 +184,11 @@ ${onlyTs.map((f) => f.name).join("\n")}`
184
184
  };
185
185
  }
186
186
  async runAction(action, targets) {
187
- const configs = _chunkXT6LHCX5js.DB.getUniqueConfigs(targets);
187
+ const configs = _chunkWJGRXAXEjs.DB.getUniqueConfigs(targets);
188
188
  const conns = await Promise.all(
189
189
  configs.map(async (config) => ({
190
190
  connKey: config.connKey,
191
- db: _chunkXT6LHCX5js.DB.getClient(config.connKey)
191
+ db: _chunkWJGRXAXEjs.DB.getClient(config.connKey)
192
192
  }))
193
193
  );
194
194
  const result = await (async () => {
@@ -236,8 +236,8 @@ ${onlyTs.map((f) => f.name).join("\n")}`
236
236
  );
237
237
  }
238
238
  const delFiles = codeNames.map((codeName) => [
239
- `${_chunkXT6LHCX5js.Sonamu.apiRootPath}/src/migrations/${codeName}.ts`,
240
- `${_chunkXT6LHCX5js.Sonamu.apiRootPath}/dist/migrations/${codeName}.js`
239
+ `${_chunkWJGRXAXEjs.Sonamu.apiRootPath}/src/migrations/${codeName}.ts`,
240
+ `${_chunkWJGRXAXEjs.Sonamu.apiRootPath}/dist/migrations/${codeName}.js`
241
241
  ]).flat();
242
242
  const res = await Promise.all(
243
243
  delFiles.map((delFile) => {
@@ -257,7 +257,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
257
257
  console.log(_chalk2.default.green("\n\uD604\uC7AC \uBAA8\uB450 \uC2F1\uD06C\uB41C \uC0C1\uD0DC\uC785\uB2C8\uB2E4."));
258
258
  return 0;
259
259
  }
260
- const migrationsDir = `${_chunkXT6LHCX5js.Sonamu.apiRootPath}/src/migrations`;
260
+ const migrationsDir = `${_chunkWJGRXAXEjs.Sonamu.apiRootPath}/src/migrations`;
261
261
  preparedCodes.filter((pcode) => pcode.formatted).map((pcode, index) => {
262
262
  const dateTag = _luxon.DateTime.local().plus({ seconds: index }).toFormat("yyyyMMddHHmmss");
263
263
  const filePath = `${migrationsDir}/${dateTag}_${pcode.title}.ts`;
@@ -268,7 +268,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
268
268
  }
269
269
  async clearPendingList() {
270
270
  const pendingList = await this.targets.pending.getMigrations();
271
- const migrationsDir = `${_chunkXT6LHCX5js.Sonamu.apiRootPath}/src/migrations`;
271
+ const migrationsDir = `${_chunkWJGRXAXEjs.Sonamu.apiRootPath}/src/migrations`;
272
272
  const delList = pendingList.map((df) => {
273
273
  return _path2.default.join(migrationsDir, `${df}.ts`);
274
274
  });
@@ -332,7 +332,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
332
332
  if (answer.value === false) {
333
333
  return;
334
334
  }
335
- const migrationsDir = `${_chunkXT6LHCX5js.Sonamu.apiRootPath}/src/migrations`;
335
+ const migrationsDir = `${_chunkWJGRXAXEjs.Sonamu.apiRootPath}/src/migrations`;
336
336
  codes.filter((code) => code.formatted).map((code, index) => {
337
337
  const dateTag = _luxon.DateTime.local().plus({ seconds: index }).toFormat("yyyyMMddHHmmss");
338
338
  const filePath = `${migrationsDir}/${dateTag}_${code.title}.ts`;
@@ -354,7 +354,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
354
354
  const files = ["src", "dist"].reduce(
355
355
  (r, which) => {
356
356
  const migrationPath = _path2.default.join(
357
- _chunkXT6LHCX5js.Sonamu.apiRootPath,
357
+ _chunkWJGRXAXEjs.Sonamu.apiRootPath,
358
358
  which,
359
359
  "migrations"
360
360
  );
@@ -402,7 +402,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
402
402
  }
403
403
  }
404
404
  const filesToRm = diffOnDist.map((filename) => {
405
- return _path2.default.join(_chunkXT6LHCX5js.Sonamu.apiRootPath, "dist", "migrations", filename);
405
+ return _path2.default.join(_chunkWJGRXAXEjs.Sonamu.apiRootPath, "dist", "migrations", filename);
406
406
  });
407
407
  filesToRm.map((filePath) => {
408
408
  _fsextra2.default.unlinkSync(filePath);
@@ -411,7 +411,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
411
411
  }
412
412
  }
413
413
  async runShadowTest() {
414
- const tdb = _chunkXT6LHCX5js.DB.getClient("test");
414
+ const tdb = _chunkWJGRXAXEjs.DB.getClient("test");
415
415
  const tdbConn = tdb.connectionInfo;
416
416
  const shadowDatabase = tdbConn.database + "__migration_shadow";
417
417
  const tmpSqlPath = `/tmp/${shadowDatabase}.sql`;
@@ -449,7 +449,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
449
449
  ];
450
450
  } catch (e) {
451
451
  console.error(e);
452
- throw new (0, _chunkXT6LHCX5js.ServiceUnavailableException)("Shadow DB \uD14C\uC2A4\uD2B8 \uC9C4\uD589 \uC911 \uC5D0\uB7EC");
452
+ throw new (0, _chunkWJGRXAXEjs.ServiceUnavailableException)("Shadow DB \uD14C\uC2A4\uD2B8 \uC9C4\uD589 \uC911 \uC5D0\uB7EC");
453
453
  } finally {
454
454
  await tdb.destroy();
455
455
  }
@@ -472,32 +472,41 @@ ${onlyTs.map((f) => f.name).join("\n")}`
472
472
  );
473
473
  console.log({ rollbackAllResult });
474
474
  console.timeEnd(_chalk2.default.red("rollback-all:"));
475
- const migrationsDir = `${_chunkXT6LHCX5js.Sonamu.apiRootPath}/src/migrations`;
475
+ const migrationsDir = `${_chunkWJGRXAXEjs.Sonamu.apiRootPath}/src/migrations`;
476
476
  console.time(_chalk2.default.red("delete migration files"));
477
477
  _child_process.execSync.call(void 0, `rm -f ${migrationsDir}/*`);
478
478
  _child_process.execSync.call(void 0, `rm -f ${migrationsDir.replace("/src/", "/dist/")}/*`);
479
479
  console.timeEnd(_chalk2.default.red("delete migration files"));
480
480
  }
481
481
  async compareMigrations(compareDB) {
482
- const entityIds = _chunkXT6LHCX5js.EntityManager.getAllIds();
482
+ const entityIds = _chunkWJGRXAXEjs.EntityManager.getAllIds();
483
483
  const entitySetsWithJoinTable = entityIds.filter((entityId) => {
484
- const entity = _chunkXT6LHCX5js.EntityManager.get(entityId);
484
+ const entity = _chunkWJGRXAXEjs.EntityManager.get(entityId);
485
485
  return entity.props.length > 0;
486
486
  }).map((entityId) => {
487
- const entity = _chunkXT6LHCX5js.EntityManager.get(entityId);
488
- return this.getMigrationSetFromMD(entity);
487
+ const entity = _chunkWJGRXAXEjs.EntityManager.get(entityId);
488
+ return this.getMigrationSetFromEntity(entity);
489
489
  });
490
- const joinTables = _lodash2.default.uniqBy(
491
- entitySetsWithJoinTable.map((entitySet) => entitySet.joinTables).flat(),
492
- (joinTable) => {
493
- return joinTable.table;
490
+ const joinTablesWithDup = entitySetsWithJoinTable.map((entitySet) => entitySet.joinTables).flat();
491
+ const joinTables = Object.values(
492
+ _lodash2.default.groupBy(joinTablesWithDup, (jt) => jt.table)
493
+ ).map((tables) => {
494
+ if (tables.length === 1) {
495
+ return tables[0];
494
496
  }
495
- );
497
+ return {
498
+ ...tables[0],
499
+ indexes: _lodash2.default.uniqBy(
500
+ tables.flatMap((t) => t.indexes),
501
+ (index) => [index.type, ...index.columns.sort()].join("-")
502
+ )
503
+ };
504
+ });
496
505
  const entitySets = [
497
506
  ...entitySetsWithJoinTable,
498
507
  ...joinTables
499
508
  ];
500
- let codes = (await Promise.all(
509
+ const codes = (await Promise.all(
501
510
  entitySets.map(async (entitySet) => {
502
511
  const dbSet = await this.getMigrationSetFromDB(
503
512
  compareDB,
@@ -505,12 +514,12 @@ ${onlyTs.map((f) => f.name).join("\n")}`
505
514
  );
506
515
  if (dbSet === null) {
507
516
  return [
508
- await _chunkXT6LHCX5js.DB.generator.generateCreateCode_ColumnAndIndexes(
517
+ await _chunkWJGRXAXEjs.DB.generator.generateCreateCode_ColumnAndIndexes(
509
518
  entitySet.table,
510
519
  entitySet.columns,
511
520
  entitySet.indexes
512
521
  ),
513
- ...await _chunkXT6LHCX5js.DB.generator.generateCreateCode_Foreign(
522
+ ...await _chunkWJGRXAXEjs.DB.generator.generateCreateCode_Foreign(
514
523
  entitySet.table,
515
524
  entitySet.foreigns
516
525
  )
@@ -556,7 +565,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
556
565
  if (isEqualColumns && isEqualIndexes) {
557
566
  return null;
558
567
  } else {
559
- return _chunkXT6LHCX5js.DB.generator.generateAlterCode_ColumnAndIndexes(
568
+ return _chunkWJGRXAXEjs.DB.generator.generateAlterCode_ColumnAndIndexes(
560
569
  entitySet.table,
561
570
  entityColumns,
562
571
  entityIndexes,
@@ -582,7 +591,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
582
591
  (a) => [a.to, ...a.columns].join("-")
583
592
  ).map((f) => replaceNoActionOnMySQL(f));
584
593
  if (_fastdeepequal2.default.call(void 0, entityForeigns, dbForeigns) === false) {
585
- return _chunkXT6LHCX5js.DB.generator.generateAlterCode_Foreigns(
594
+ return _chunkWJGRXAXEjs.DB.generator.generateAlterCode_Foreigns(
586
595
  entitySet.table,
587
596
  entityForeigns,
588
597
  dbForeigns
@@ -621,7 +630,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
621
630
  table
622
631
  );
623
632
  } catch (e) {
624
- if (_chunkXT6LHCX5js.isKnexError.call(void 0, e) && e.code === "ER_NO_SUCH_TABLE") {
633
+ if (_chunkWJGRXAXEjs.isKnexError.call(void 0, e) && e.code === "ER_NO_SUCH_TABLE") {
625
634
  return null;
626
635
  }
627
636
  console.error(e);
@@ -793,22 +802,22 @@ ${onlyTs.map((f) => f.name).join("\n")}`
793
802
  }
794
803
  }
795
804
  /*
796
- MD 내용 읽어서 MigrationSetAndJoinTable 추출
805
+ Entity 내용 읽어서 MigrationSetAndJoinTable 추출
797
806
  */
798
- getMigrationSetFromMD(entity) {
807
+ getMigrationSetFromEntity(entity) {
799
808
  const migrationSet = entity.props.reduce(
800
809
  (r, prop) => {
801
- if (_chunkXT6LHCX5js.isVirtualProp.call(void 0, prop)) {
810
+ if (_chunkWJGRXAXEjs.isVirtualProp.call(void 0, prop)) {
802
811
  return r;
803
812
  }
804
- if (_chunkXT6LHCX5js.isHasManyRelationProp.call(void 0, prop)) {
813
+ if (_chunkWJGRXAXEjs.isHasManyRelationProp.call(void 0, prop)) {
805
814
  return r;
806
815
  }
807
- if (!_chunkXT6LHCX5js.isRelationProp.call(void 0, prop)) {
816
+ if (!_chunkWJGRXAXEjs.isRelationProp.call(void 0, prop)) {
808
817
  let type;
809
- if (_chunkXT6LHCX5js.isTextProp.call(void 0, prop)) {
818
+ if (_chunkWJGRXAXEjs.isTextProp.call(void 0, prop)) {
810
819
  type = prop.textType;
811
- } else if (_chunkXT6LHCX5js.isEnumProp.call(void 0, prop)) {
820
+ } else if (_chunkWJGRXAXEjs.isEnumProp.call(void 0, prop)) {
812
821
  type = "string";
813
822
  } else {
814
823
  type = prop.type;
@@ -816,8 +825,8 @@ ${onlyTs.map((f) => f.name).join("\n")}`
816
825
  const column = {
817
826
  name: prop.name,
818
827
  type,
819
- ..._chunkXT6LHCX5js.isIntegerProp.call(void 0, prop) && { unsigned: prop.unsigned === true },
820
- ...(_chunkXT6LHCX5js.isStringProp.call(void 0, prop) || _chunkXT6LHCX5js.isEnumProp.call(void 0, prop)) && {
828
+ ..._chunkWJGRXAXEjs.isIntegerProp.call(void 0, prop) && { unsigned: prop.unsigned === true },
829
+ ...(_chunkWJGRXAXEjs.isStringProp.call(void 0, prop) || _chunkWJGRXAXEjs.isEnumProp.call(void 0, prop)) && {
821
830
  length: prop.length
822
831
  },
823
832
  nullable: prop.nullable === true,
@@ -831,15 +840,15 @@ ${onlyTs.map((f) => f.name).join("\n")}`
831
840
  })(),
832
841
  // FIXME: float(N, M) deprecated
833
842
  // Decimal, Float 타입의 경우 precision, scale 추가
834
- ...(_chunkXT6LHCX5js.isDecimalProp.call(void 0, prop) || _chunkXT6LHCX5js.isFloatProp.call(void 0, prop)) && {
843
+ ...(_chunkWJGRXAXEjs.isDecimalProp.call(void 0, prop) || _chunkWJGRXAXEjs.isFloatProp.call(void 0, prop)) && {
835
844
  precision: _nullishCoalesce(prop.precision, () => ( 8)),
836
845
  scale: _nullishCoalesce(prop.scale, () => ( 2))
837
846
  }
838
847
  };
839
848
  r.columns.push(column);
840
849
  }
841
- if (_chunkXT6LHCX5js.isManyToManyRelationProp.call(void 0, prop)) {
842
- const relMd = _chunkXT6LHCX5js.EntityManager.get(prop.with);
850
+ if (_chunkWJGRXAXEjs.isManyToManyRelationProp.call(void 0, prop)) {
851
+ const relMd = _chunkWJGRXAXEjs.EntityManager.get(prop.with);
843
852
  const [table1, table2] = prop.joinTable.split("__");
844
853
  const join = {
845
854
  from: `${entity.table}.id`,
@@ -894,16 +903,24 @@ ${onlyTs.map((f) => f.name).join("\n")}`
894
903
  }
895
904
  ],
896
905
  foreigns: fields.map((field) => {
906
+ const col = field.split(".")[1];
907
+ const to = (() => {
908
+ if (_inflection2.default.singularize(join.to.split(".")[0]) + "_id" === col) {
909
+ return join.to;
910
+ } else {
911
+ return join.from;
912
+ }
913
+ })();
897
914
  return {
898
- columns: [field.split(".")[1]],
899
- to: through.to.includes(field) ? join.to : join.from,
915
+ columns: [col],
916
+ to,
900
917
  onUpdate: through.onUpdate,
901
918
  onDelete: through.onDelete
902
919
  };
903
920
  })
904
921
  });
905
922
  return r;
906
- } else if (_chunkXT6LHCX5js.isBelongsToOneRelationProp.call(void 0, prop) || _chunkXT6LHCX5js.isOneToOneRelationProp.call(void 0, prop) && prop.hasJoinColumn) {
923
+ } else if (_chunkWJGRXAXEjs.isBelongsToOneRelationProp.call(void 0, prop) || _chunkWJGRXAXEjs.isOneToOneRelationProp.call(void 0, prop) && prop.hasJoinColumn) {
907
924
  const idColumnName = prop.name + "_id";
908
925
  r.columns.push({
909
926
  name: idColumnName,
@@ -947,7 +964,7 @@ ${onlyTs.map((f) => f.name).join("\n")}`
947
964
  */
948
965
  showMigrationSet(which, migrationSet) {
949
966
  const { columns, indexes, foreigns } = migrationSet;
950
- const styledChalk = which === "MD" ? _chalk2.default.bgGreen.black : _chalk2.default.bgBlue.black;
967
+ const styledChalk = which === "Entity" ? _chalk2.default.bgGreen.black : _chalk2.default.bgBlue.black;
951
968
  console.log(
952
969
  styledChalk(
953
970
  `${which} ${migrationSet.table} Columns `
@@ -1039,13 +1056,13 @@ var RelationGraph = (_class = class {constructor() { _class.prototype.__init.cal
1039
1056
  const node = this.graph.get(fixture.fixtureId);
1040
1057
  for (const [, column] of Object.entries(fixture.columns)) {
1041
1058
  const prop = column.prop;
1042
- if (_chunkXT6LHCX5js.isRelationProp.call(void 0, prop)) {
1043
- if (_chunkXT6LHCX5js.isBelongsToOneRelationProp.call(void 0, prop) || _chunkXT6LHCX5js.isOneToOneRelationProp.call(void 0, prop) && prop.hasJoinColumn) {
1059
+ if (_chunkWJGRXAXEjs.isRelationProp.call(void 0, prop)) {
1060
+ if (_chunkWJGRXAXEjs.isBelongsToOneRelationProp.call(void 0, prop) || _chunkWJGRXAXEjs.isOneToOneRelationProp.call(void 0, prop) && prop.hasJoinColumn) {
1044
1061
  const relatedFixtureId = `${prop.with}#${column.value}`;
1045
1062
  if (this.graph.has(relatedFixtureId)) {
1046
1063
  node.related.add(relatedFixtureId);
1047
1064
  }
1048
- } else if (_chunkXT6LHCX5js.isManyToManyRelationProp.call(void 0, prop)) {
1065
+ } else if (_chunkWJGRXAXEjs.isManyToManyRelationProp.call(void 0, prop)) {
1049
1066
  const relatedIds = column.value;
1050
1067
  for (const relatedId of relatedIds) {
1051
1068
  const relatedFixtureId = `${prop.with}#${relatedId}`;
@@ -1071,11 +1088,11 @@ var RelationGraph = (_class = class {constructor() { _class.prototype.__init.cal
1071
1088
  }
1072
1089
  tempVisited.add(fixtureId);
1073
1090
  const node = this.graph.get(fixtureId);
1074
- const entity = _chunkXT6LHCX5js.EntityManager.get(node.entityId);
1091
+ const entity = _chunkWJGRXAXEjs.EntityManager.get(node.entityId);
1075
1092
  for (const depId of node.related) {
1076
1093
  const depNode = this.graph.get(depId);
1077
1094
  const relationProp = entity.props.find(
1078
- (prop) => _chunkXT6LHCX5js.isRelationProp.call(void 0, prop) && (_chunkXT6LHCX5js.isBelongsToOneRelationProp.call(void 0, prop) || _chunkXT6LHCX5js.isOneToOneRelationProp.call(void 0, prop) && prop.hasJoinColumn) && prop.with === depNode.entityId
1095
+ (prop) => _chunkWJGRXAXEjs.isRelationProp.call(void 0, prop) && (_chunkWJGRXAXEjs.isBelongsToOneRelationProp.call(void 0, prop) || _chunkWJGRXAXEjs.isOneToOneRelationProp.call(void 0, prop) && prop.hasJoinColumn) && prop.with === depNode.entityId
1079
1096
  );
1080
1097
  if (relationProp && !relationProp.nullable) {
1081
1098
  visit(depId);
@@ -1101,39 +1118,39 @@ var RelationGraph = (_class = class {constructor() { _class.prototype.__init.cal
1101
1118
  var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__init2.call(this); }
1102
1119
  __init2() {this.relationGraph = new RelationGraph()}
1103
1120
  init() {
1104
- _chunkXT6LHCX5js.DB.testInit();
1121
+ _chunkWJGRXAXEjs.DB.testInit();
1105
1122
  }
1106
1123
  async cleanAndSeed(usingTables) {
1107
1124
  const tableNames = await (async () => {
1108
1125
  if (usingTables) {
1109
1126
  return usingTables;
1110
1127
  }
1111
- const tables = await _chunkXT6LHCX5js.DB.tdb.raw(
1128
+ const tables = await _chunkWJGRXAXEjs.DB.tdb.raw(
1112
1129
  `SHOW TABLE STATUS WHERE Engine IS NOT NULL`
1113
1130
  );
1114
1131
  return tables.map((tableInfo) => tableInfo["Name"]);
1115
1132
  })();
1116
- await _chunkXT6LHCX5js.DB.tdb.raw(`SET FOREIGN_KEY_CHECKS = 0`);
1133
+ await _chunkWJGRXAXEjs.DB.tdb.raw(`SET FOREIGN_KEY_CHECKS = 0`);
1117
1134
  for await (let tableName of tableNames) {
1118
1135
  if (tableName == "migrations") {
1119
1136
  continue;
1120
1137
  }
1121
- const [fdbChecksumRow] = await _chunkXT6LHCX5js.DB.fdb.raw(
1138
+ const [fdbChecksumRow] = await _chunkWJGRXAXEjs.DB.fdb.raw(
1122
1139
  `CHECKSUM TABLE ${tableName}`
1123
1140
  );
1124
1141
  const fdbChecksum = fdbChecksumRow["Checksum"];
1125
- const [tdbChecksumRow] = await _chunkXT6LHCX5js.DB.tdb.raw(
1142
+ const [tdbChecksumRow] = await _chunkWJGRXAXEjs.DB.tdb.raw(
1126
1143
  `CHECKSUM TABLE ${tableName}`
1127
1144
  );
1128
1145
  const tdbChecksum = tdbChecksumRow["Checksum"];
1129
1146
  if (fdbChecksum !== tdbChecksum) {
1130
- await _chunkXT6LHCX5js.DB.tdb.truncate(tableName);
1131
- const rawQuery = `INSERT INTO ${_chunkXT6LHCX5js.DB.connectionInfo.test.database}.${tableName}
1132
- SELECT * FROM ${_chunkXT6LHCX5js.DB.connectionInfo.fixture_local.database}.${tableName}`;
1133
- await _chunkXT6LHCX5js.DB.tdb.raw(rawQuery);
1147
+ await _chunkWJGRXAXEjs.DB.tdb.truncate(tableName);
1148
+ const rawQuery = `INSERT INTO ${_chunkWJGRXAXEjs.DB.connectionInfo.test.database}.${tableName}
1149
+ SELECT * FROM ${_chunkWJGRXAXEjs.DB.connectionInfo.fixture_local.database}.${tableName}`;
1150
+ await _chunkWJGRXAXEjs.DB.tdb.raw(rawQuery);
1134
1151
  }
1135
1152
  }
1136
- await _chunkXT6LHCX5js.DB.tdb.raw(`SET FOREIGN_KEY_CHECKS = 1`);
1153
+ await _chunkWJGRXAXEjs.DB.tdb.raw(`SET FOREIGN_KEY_CHECKS = 1`);
1137
1154
  }
1138
1155
  async getChecksum(db, tableName) {
1139
1156
  const [checksumRow] = await db.raw(
@@ -1142,8 +1159,8 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1142
1159
  return checksumRow.Checksum;
1143
1160
  }
1144
1161
  async sync() {
1145
- const frdb = _chunkXT6LHCX5js.DB.getClient("fixture_remote");
1146
- const tables = await _chunkXT6LHCX5js.DB.fdb.raw(
1162
+ const frdb = _chunkWJGRXAXEjs.DB.getClient("fixture_remote");
1163
+ const tables = await _chunkWJGRXAXEjs.DB.fdb.raw(
1147
1164
  "SHOW TABLE STATUS WHERE Engine IS NOT NULL"
1148
1165
  );
1149
1166
  const tableNames = tables.map(
@@ -1152,13 +1169,13 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1152
1169
  console.log(_chalk2.default.magenta("SYNC..."));
1153
1170
  await Promise.all(
1154
1171
  tableNames.map(async (tableName) => {
1155
- if (tableName.startsWith(_chunkXT6LHCX5js.DB.migrationTable)) {
1172
+ if (tableName.startsWith(_chunkWJGRXAXEjs.DB.migrationTable)) {
1156
1173
  return;
1157
1174
  }
1158
1175
  const remoteChecksum = await this.getChecksum(frdb, tableName);
1159
- const localChecksum = await this.getChecksum(_chunkXT6LHCX5js.DB.fdb, tableName);
1176
+ const localChecksum = await this.getChecksum(_chunkWJGRXAXEjs.DB.fdb, tableName);
1160
1177
  if (remoteChecksum !== localChecksum) {
1161
- await _chunkXT6LHCX5js.DB.fdb.trx(async (transaction) => {
1178
+ await _chunkWJGRXAXEjs.DB.fdb.trx(async (transaction) => {
1162
1179
  await transaction.raw(`SET FOREIGN_KEY_CHECKS = 0`);
1163
1180
  await transaction.truncate(tableName);
1164
1181
  const rows = await frdb.raw(`SELECT * FROM ${tableName}`);
@@ -1189,7 +1206,7 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1189
1206
  })
1190
1207
  )).flat()
1191
1208
  );
1192
- const wdb = _chunkXT6LHCX5js.DB.toClient(_chunkXT6LHCX5js.DB.getDB("w"));
1209
+ const wdb = _chunkWJGRXAXEjs.DB.toClient(_chunkWJGRXAXEjs.DB.getDB("w"));
1193
1210
  for (let query of queries) {
1194
1211
  const [rsh] = await wdb.raw(query);
1195
1212
  console.log({
@@ -1200,23 +1217,23 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1200
1217
  }
1201
1218
  async getImportQueries(entityId, field, id) {
1202
1219
  console.log({ entityId, field, id });
1203
- const entity = _chunkXT6LHCX5js.EntityManager.get(entityId);
1204
- const wdb = _chunkXT6LHCX5js.DB.toClient(_chunkXT6LHCX5js.DB.getDB("w"));
1220
+ const entity = _chunkWJGRXAXEjs.EntityManager.get(entityId);
1221
+ const wdb = _chunkWJGRXAXEjs.DB.toClient(_chunkWJGRXAXEjs.DB.getDB("w"));
1205
1222
  const [row] = await wdb.raw(
1206
1223
  `SELECT * FROM ${entity.table} WHERE ${field} = ${id} LIMIT 1`
1207
1224
  );
1208
1225
  if (row === void 0) {
1209
1226
  throw new Error(`${entityId}#${id} row\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.`);
1210
1227
  }
1211
- const fixtureDatabase = _chunkXT6LHCX5js.DB.connectionInfo.fixture_remote.database;
1212
- const realDatabase = _chunkXT6LHCX5js.DB.connectionInfo.production_master.database;
1228
+ const fixtureDatabase = _chunkWJGRXAXEjs.DB.connectionInfo.fixture_remote.database;
1229
+ const realDatabase = _chunkWJGRXAXEjs.DB.connectionInfo.production_master.database;
1213
1230
  const selfQuery = `INSERT IGNORE INTO \`${fixtureDatabase}\`.\`${entity.table}\` (SELECT * FROM \`${realDatabase}\`.\`${entity.table}\` WHERE \`id\` = ${id})`;
1214
1231
  const args = Object.entries(entity.relations).filter(
1215
- ([, relation]) => _chunkXT6LHCX5js.isBelongsToOneRelationProp.call(void 0, relation) || _chunkXT6LHCX5js.isOneToOneRelationProp.call(void 0, relation) && relation.customJoinClause === void 0
1232
+ ([, relation]) => _chunkWJGRXAXEjs.isBelongsToOneRelationProp.call(void 0, relation) || _chunkWJGRXAXEjs.isOneToOneRelationProp.call(void 0, relation) && relation.customJoinClause === void 0
1216
1233
  ).map(([, relation]) => {
1217
1234
  let field2;
1218
1235
  let id2;
1219
- if (_chunkXT6LHCX5js.isOneToOneRelationProp.call(void 0, relation) && !relation.hasJoinColumn) {
1236
+ if (_chunkWJGRXAXEjs.isOneToOneRelationProp.call(void 0, relation) && !relation.hasJoinColumn) {
1220
1237
  field2 = `${relation.name}_id`;
1221
1238
  id2 = row["id"];
1222
1239
  } else {
@@ -1237,14 +1254,14 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1237
1254
  return [..._lodash2.default.uniq(relQueries.reverse().flat()), selfQuery];
1238
1255
  }
1239
1256
  async destory() {
1240
- await _chunkXT6LHCX5js.DB.testDestroy();
1241
- await _chunkXT6LHCX5js.DB.destroy();
1257
+ await _chunkWJGRXAXEjs.DB.testDestroy();
1258
+ await _chunkWJGRXAXEjs.DB.destroy();
1242
1259
  }
1243
1260
  async getFixtures(sourceDBName, targetDBName, searchOptions) {
1244
- const sourceDB = _chunkXT6LHCX5js.DB.getClient(sourceDBName);
1245
- const targetDB = _chunkXT6LHCX5js.DB.getClient(targetDBName);
1261
+ const sourceDB = _chunkWJGRXAXEjs.DB.getClient(sourceDBName);
1262
+ const targetDB = _chunkWJGRXAXEjs.DB.getClient(targetDBName);
1246
1263
  const { entityId, field, value, searchType } = searchOptions;
1247
- const entity = _chunkXT6LHCX5js.EntityManager.get(entityId);
1264
+ const entity = _chunkWJGRXAXEjs.EntityManager.get(entityId);
1248
1265
  const column = _optionalChain([entity, 'access', _10 => _10.props, 'access', _11 => _11.find, 'call', _12 => _12((prop) => prop.name === field), 'optionalAccess', _13 => _13.type]) === "relation" ? `${field}_id` : field;
1249
1266
  let query = sourceDB.from(entity.table).selectAll();
1250
1267
  if (searchType === "equals") {
@@ -1269,7 +1286,7 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1269
1286
  }
1270
1287
  }
1271
1288
  for await (const fixture of fixtures) {
1272
- const entity2 = _chunkXT6LHCX5js.EntityManager.get(fixture.entityId);
1289
+ const entity2 = _chunkWJGRXAXEjs.EntityManager.get(fixture.entityId);
1273
1290
  const [row] = await targetDB.from(entity2.table).selectAll().where(["id", "=", fixture.id]).first().execute();
1274
1291
  if (row) {
1275
1292
  const [record] = await this.createFixtureRecord(entity2, row, {
@@ -1312,43 +1329,43 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1312
1329
  belongsRecords: []
1313
1330
  };
1314
1331
  for (const prop of entity2.props) {
1315
- if (_chunkXT6LHCX5js.isVirtualProp.call(void 0, prop)) {
1332
+ if (_chunkWJGRXAXEjs.isVirtualProp.call(void 0, prop)) {
1316
1333
  continue;
1317
1334
  }
1318
1335
  record.columns[prop.name] = {
1319
1336
  prop,
1320
1337
  value: row2[prop.name]
1321
1338
  };
1322
- const db = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _14 => _14._db]), () => ( _chunkXT6LHCX5js.DB.toClient(_chunkXT6LHCX5js.DB.getDB("w"))));
1323
- if (_chunkXT6LHCX5js.isManyToManyRelationProp.call(void 0, prop)) {
1324
- const relatedEntity = _chunkXT6LHCX5js.EntityManager.get(prop.with);
1339
+ const db = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _14 => _14._db]), () => ( _chunkWJGRXAXEjs.DB.toClient(_chunkWJGRXAXEjs.DB.getDB("w"))));
1340
+ if (_chunkWJGRXAXEjs.isManyToManyRelationProp.call(void 0, prop)) {
1341
+ const relatedEntity = _chunkWJGRXAXEjs.EntityManager.get(prop.with);
1325
1342
  const throughTable = prop.joinTable;
1326
1343
  const fromColumn = `${_inflection2.default.singularize(entity2.table)}_id`;
1327
1344
  const toColumn = `${_inflection2.default.singularize(relatedEntity.table)}_id`;
1328
1345
  const _relatedIds = await db.from(throughTable).select(toColumn).where([fromColumn, "=", row2.id]).execute();
1329
1346
  const relatedIds = _relatedIds.map((r) => parseInt(r[toColumn]));
1330
1347
  record.columns[prop.name].value = relatedIds;
1331
- } else if (_chunkXT6LHCX5js.isHasManyRelationProp.call(void 0, prop)) {
1332
- const relatedEntity = _chunkXT6LHCX5js.EntityManager.get(prop.with);
1348
+ } else if (_chunkWJGRXAXEjs.isHasManyRelationProp.call(void 0, prop)) {
1349
+ const relatedEntity = _chunkWJGRXAXEjs.EntityManager.get(prop.with);
1333
1350
  const relatedIds = await db.from(relatedEntity.table).select("id").where([prop.joinColumn, "=", row2.id]).pluck("id");
1334
1351
  record.columns[prop.name].value = relatedIds;
1335
- } else if (_chunkXT6LHCX5js.isOneToOneRelationProp.call(void 0, prop) && !prop.hasJoinColumn) {
1336
- const relatedEntity = _chunkXT6LHCX5js.EntityManager.get(prop.with);
1352
+ } else if (_chunkWJGRXAXEjs.isOneToOneRelationProp.call(void 0, prop) && !prop.hasJoinColumn) {
1353
+ const relatedEntity = _chunkWJGRXAXEjs.EntityManager.get(prop.with);
1337
1354
  const relatedProp = relatedEntity.props.find(
1338
- (p) => _chunkXT6LHCX5js.isRelationProp.call(void 0, p) && p.with === entity2.id
1355
+ (p) => _chunkWJGRXAXEjs.isRelationProp.call(void 0, p) && p.with === entity2.id
1339
1356
  );
1340
1357
  if (relatedProp) {
1341
1358
  const [relatedRow] = await db.from(relatedEntity.table).select("id").where([relatedProp.name, "=", row2.id]).first().execute();
1342
1359
  record.columns[prop.name].value = _optionalChain([relatedRow, 'optionalAccess', _15 => _15.id]);
1343
1360
  }
1344
- } else if (_chunkXT6LHCX5js.isRelationProp.call(void 0, prop)) {
1361
+ } else if (_chunkWJGRXAXEjs.isRelationProp.call(void 0, prop)) {
1345
1362
  const relatedId = row2[`${prop.name}_id`];
1346
1363
  record.columns[prop.name].value = relatedId;
1347
1364
  if (relatedId) {
1348
1365
  record.belongsRecords.push(`${prop.with}#${relatedId}`);
1349
1366
  }
1350
1367
  if (!_optionalChain([options, 'optionalAccess', _16 => _16.singleRecord]) && relatedId) {
1351
- const relatedEntity = _chunkXT6LHCX5js.EntityManager.get(prop.with);
1368
+ const relatedEntity = _chunkWJGRXAXEjs.EntityManager.get(prop.with);
1352
1369
  const [relatedRow] = await db.from(relatedEntity.table).selectAll().where(["id", "=", relatedId]).first().execute();
1353
1370
  if (relatedRow) {
1354
1371
  await create(relatedEntity, relatedRow);
@@ -1365,7 +1382,7 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1365
1382
  const fixtures = _lodash2.default.uniqBy(_fixtures, (f) => f.fixtureId);
1366
1383
  this.relationGraph.buildGraph(fixtures);
1367
1384
  const insertionOrder = this.relationGraph.getInsertionOrder();
1368
- const db = _chunkXT6LHCX5js.DB.getClient(dbName);
1385
+ const db = _chunkWJGRXAXEjs.DB.getClient(dbName);
1369
1386
  await db.trx(async (trx) => {
1370
1387
  await trx.raw(`SET FOREIGN_KEY_CHECKS = 0`);
1371
1388
  for (const fixtureId of insertionOrder) {
@@ -1395,7 +1412,7 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1395
1412
  });
1396
1413
  const records = [];
1397
1414
  for await (const r of fixtures) {
1398
- const entity = _chunkXT6LHCX5js.EntityManager.get(r.entityId);
1415
+ const entity = _chunkWJGRXAXEjs.EntityManager.get(r.entityId);
1399
1416
  const [record] = await db.from(entity.table).selectAll().where(["id", "=", r.id]).first().execute();
1400
1417
  records.push({
1401
1418
  entityId: r.entityId,
@@ -1407,17 +1424,17 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1407
1424
  prepareInsertData(fixture) {
1408
1425
  const insertData = {};
1409
1426
  for (const [propName, column] of Object.entries(fixture.columns)) {
1410
- if (_chunkXT6LHCX5js.isVirtualProp.call(void 0, column.prop)) {
1427
+ if (_chunkWJGRXAXEjs.isVirtualProp.call(void 0, column.prop)) {
1411
1428
  continue;
1412
1429
  }
1413
1430
  const prop = column.prop;
1414
- if (!_chunkXT6LHCX5js.isRelationProp.call(void 0, prop)) {
1431
+ if (!_chunkWJGRXAXEjs.isRelationProp.call(void 0, prop)) {
1415
1432
  if (prop.type === "json") {
1416
1433
  insertData[propName] = JSON.stringify(column.value);
1417
1434
  } else {
1418
1435
  insertData[propName] = column.value;
1419
1436
  }
1420
- } else if (_chunkXT6LHCX5js.isBelongsToOneRelationProp.call(void 0, prop) || _chunkXT6LHCX5js.isOneToOneRelationProp.call(void 0, prop) && prop.hasJoinColumn) {
1437
+ } else if (_chunkWJGRXAXEjs.isBelongsToOneRelationProp.call(void 0, prop) || _chunkWJGRXAXEjs.isOneToOneRelationProp.call(void 0, prop) && prop.hasJoinColumn) {
1421
1438
  insertData[`${propName}_id`] = column.value;
1422
1439
  }
1423
1440
  }
@@ -1425,7 +1442,7 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1425
1442
  }
1426
1443
  async insertFixture(db, fixture) {
1427
1444
  const insertData = this.prepareInsertData(fixture);
1428
- const entity = _chunkXT6LHCX5js.EntityManager.get(fixture.entityId);
1445
+ const entity = _chunkWJGRXAXEjs.EntityManager.get(fixture.entityId);
1429
1446
  try {
1430
1447
  const uniqueFound = await this.checkUniqueViolation(db, entity, fixture);
1431
1448
  if (uniqueFound) {
@@ -1454,15 +1471,15 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1454
1471
  async handleManyToManyRelations(db, fixture, fixtures) {
1455
1472
  for (const [, column] of Object.entries(fixture.columns)) {
1456
1473
  const prop = column.prop;
1457
- if (_chunkXT6LHCX5js.isManyToManyRelationProp.call(void 0, prop)) {
1474
+ if (_chunkWJGRXAXEjs.isManyToManyRelationProp.call(void 0, prop)) {
1458
1475
  const joinTable = prop.joinTable;
1459
1476
  const relatedIds = column.value;
1460
1477
  for (const relatedId of relatedIds) {
1461
1478
  if (!fixtures.find((f) => f.fixtureId === `${prop.with}#${relatedId}`)) {
1462
1479
  continue;
1463
1480
  }
1464
- const entity = _chunkXT6LHCX5js.EntityManager.get(fixture.entityId);
1465
- const relatedEntity = _chunkXT6LHCX5js.EntityManager.get(prop.with);
1481
+ const entity = _chunkWJGRXAXEjs.EntityManager.get(fixture.entityId);
1482
+ const relatedEntity = _chunkWJGRXAXEjs.EntityManager.get(prop.with);
1466
1483
  if (!entity || !relatedEntity) {
1467
1484
  throw new Error(
1468
1485
  `Entity not found: ${fixture.entityId}, ${prop.with}`
@@ -1495,7 +1512,7 @@ var FixtureManagerClass = (_class2 = class {constructor() { _class2.prototype.__
1495
1512
  }
1496
1513
  }
1497
1514
  async addFixtureLoader(code) {
1498
- const path2 = _chunkXT6LHCX5js.Sonamu.apiRootPath + "/src/testing/fixture.ts";
1515
+ const path2 = _chunkWJGRXAXEjs.Sonamu.apiRootPath + "/src/testing/fixture.ts";
1499
1516
  let content = _fs.readFileSync.call(void 0, path2).toString();
1500
1517
  const fixtureLoaderStart = content.indexOf("const fixtureLoader = {");
1501
1518
  const fixtureLoaderEnd = content.indexOf("};", fixtureLoaderStart);
@@ -1547,4 +1564,4 @@ var FixtureManager = new FixtureManagerClass();
1547
1564
 
1548
1565
 
1549
1566
  exports.Migrator = Migrator; exports.FixtureManagerClass = FixtureManagerClass; exports.FixtureManager = FixtureManager;
1550
- //# sourceMappingURL=chunk-Z2P7XTXE.js.map
1567
+ //# sourceMappingURL=chunk-JBKIW5LD.js.map