@cheetah.js/orm 0.1.5 → 0.1.7

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/dist/bun/index.js CHANGED
@@ -219060,7 +219060,7 @@ var Reflect2;
219060
219060
  });
219061
219061
  })(Reflect2 || (Reflect2 = {}));
219062
219062
 
219063
- // /export/htdocs/p/framework/packages/core/dist/domain/provider-type.js
219063
+ // ../../node_modules/balanced-match/index.jsodules/minimatch
219064
219064
  var ProviderType;
219065
219065
  (function(ProviderType2) {
219066
219066
  ProviderType2["ROUTES"] = "routes";
@@ -219069,7 +219069,7 @@ var ProviderType;
219069
219069
  ProviderType2["CONTROLLER"] = "controller";
219070
219070
  })(ProviderType || (ProviderType = {}));
219071
219071
 
219072
- // /export/htdocs/p/framework/packages/core/dist/domain/provider-scope.js
219072
+ // ../../node_modules/balanced-match/index.jsodules/minimatch/
219073
219073
  var ProviderScope;
219074
219074
  (function(ProviderScope2) {
219075
219075
  ProviderScope2["REQUEST"] = "request";
@@ -219077,16 +219077,33 @@ var ProviderScope;
219077
219077
  ProviderScope2["SINGLETON"] = "singleton";
219078
219078
  })(ProviderScope || (ProviderScope = {}));
219079
219079
 
219080
+ // /export/htdocs/p/framework/packages/core/dist/domain/provider-type.js
219081
+ var ProviderType2;
219082
+ (function(ProviderType3) {
219083
+ ProviderType3["ROUTES"] = "routes";
219084
+ ProviderType3["SERVICE"] = "service";
219085
+ ProviderType3["PROVIDER"] = "provider";
219086
+ ProviderType3["CONTROLLER"] = "controller";
219087
+ })(ProviderType2 || (ProviderType2 = {}));
219088
+
219089
+ // /export/htdocs/p/framework/packages/core/dist/domain/provider-scope.js
219090
+ var ProviderScope2;
219091
+ (function(ProviderScope3) {
219092
+ ProviderScope3["REQUEST"] = "request";
219093
+ ProviderScope3["INSTANCE"] = "instance";
219094
+ ProviderScope3["SINGLETON"] = "singleton";
219095
+ })(ProviderScope2 || (ProviderScope2 = {}));
219096
+
219080
219097
  // /export/htdocs/p/framework/packages/core/dist/domain/provider.js
219081
219098
  class Provider {
219082
- type = ProviderType.PROVIDER;
219099
+ type = ProviderType2.PROVIDER;
219083
219100
  deps = [];
219084
219101
  instance;
219085
219102
  _provide;
219086
219103
  _useClass;
219087
219104
  hooks;
219088
219105
  path;
219089
- scope = ProviderScope.SINGLETON;
219106
+ scope = ProviderScope2.SINGLETON;
219090
219107
  children = [];
219091
219108
  parent;
219092
219109
  constructor(token, options = {}) {
@@ -219198,7 +219215,7 @@ class ProviderControl extends Map {
219198
219215
  }
219199
219216
  }
219200
219217
  createIfNotExists(key, options) {
219201
- const type = options.type || ProviderType.PROVIDER;
219218
+ const type = options.type || ProviderType2.PROVIDER;
219202
219219
  if (!this.has(key)) {
219203
219220
  const { model = Provider } = this.settings.get(type) || {};
219204
219221
  const item = new model(key, options);
@@ -219215,9 +219232,9 @@ function registerProvider(provider3) {
219215
219232
  }
219216
219233
  return GlobalProvider.merge(provider3.provide, provider3);
219217
219234
  }
219218
- GlobalProvider.createRegistry(ProviderType.CONTROLLER, Provider);
219219
- GlobalProvider.createRegistry(ProviderType.ROUTES, Provider);
219220
- var registerController = GlobalProvider.createRegisterFn(ProviderType.CONTROLLER);
219235
+ GlobalProvider.createRegistry(ProviderType2.CONTROLLER, Provider);
219236
+ GlobalProvider.createRegistry(ProviderType2.ROUTES, Provider);
219237
+ var registerController = GlobalProvider.createRegisterFn(ProviderType2.CONTROLLER);
219221
219238
  // /export/htdocs/p/framework/node_modules/globby/index.js
219222
219239
  var import_merge2 = __toESM(require_merge2(), 1);
219223
219240
  var import_fast_glob2 = __toESM(require_out4(), 1);
@@ -221440,7 +221457,7 @@ var InjectorService = InjectorService_1 = class InjectorService2 {
221440
221457
  resolveControllers() {
221441
221458
  if (!this.settings)
221442
221459
  return {};
221443
- const controllers = GlobalProvider.getByType(ProviderType.CONTROLLER).filter((controller2) => !controller2.isChild());
221460
+ const controllers = GlobalProvider.getByType(ProviderType2.CONTROLLER).filter((controller2) => !controller2.isChild());
221444
221461
  let hydrateRoute = new Map;
221445
221462
  for (const controller2 of controllers) {
221446
221463
  let routes = Metadata.get(CONTROLLER_ROUTES, controller2.token);
@@ -221564,16 +221581,16 @@ var InjectorService = InjectorService_1 = class InjectorService2 {
221564
221581
  const construct = (deps2) => new provider3.useClass(...deps2);
221565
221582
  let instance;
221566
221583
  if (isRequestScope(provider3, deps, this)) {
221567
- scope = ProviderScope.REQUEST;
221584
+ scope = ProviderScope2.REQUEST;
221568
221585
  }
221569
221586
  const services = deps.filter((t) => !isPrimitiveType(t)).map((token) => this.invoke(getClassOrSymbol(token), locals));
221570
221587
  instance = construct(services);
221571
221588
  switch (scope) {
221572
- case ProviderScope.SINGLETON:
221589
+ case ProviderScope2.SINGLETON:
221573
221590
  provider3.instance = instance;
221574
221591
  this.container.addProvider(provider3.token, provider3);
221575
221592
  break;
221576
- case ProviderScope.REQUEST:
221593
+ case ProviderScope2.REQUEST:
221577
221594
  const clone = provider3.clone();
221578
221595
  clone.instance = instance;
221579
221596
  locals.set(clone.token, clone);
@@ -221625,7 +221642,7 @@ var InjectorService = InjectorService_1 = class InjectorService2 {
221625
221642
  return methodInfo;
221626
221643
  }
221627
221644
  scopeOf(provider3) {
221628
- return provider3.scope || ProviderScope.SINGLETON;
221645
+ return provider3.scope || ProviderScope2.SINGLETON;
221629
221646
  }
221630
221647
  getConstructorDependencies(target, propertyKey) {
221631
221648
  return Metadata.getOwn("override:ctor:design:paramtypes", target, propertyKey) || [...Metadata.getParamTypes(target, propertyKey)];
@@ -221756,7 +221773,7 @@ var Context = Context_1 = class Context2 {
221756
221773
  }
221757
221774
  };
221758
221775
  Context = Context_1 = __decorate2([
221759
- Injectable({ scope: ProviderScope.REQUEST }),
221776
+ Injectable({ scope: ProviderScope2.REQUEST }),
221760
221777
  __metadata("design:paramtypes", [])
221761
221778
  ], Context);
221762
221779
  // /export/htdocs/p/framework/packages/core/dist/domain/LocalsContainer.js
@@ -222137,7 +222154,7 @@ function isRequestScope(provider4, deps, injector) {
222137
222154
  const depProvider = injector.get(dep);
222138
222155
  if (!depProvider)
222139
222156
  return false;
222140
- return depProvider.scope === ProviderScope.REQUEST;
222157
+ return depProvider.scope === ProviderScope2.REQUEST;
222141
222158
  });
222142
222159
  }
222143
222160
  // /export/htdocs/p/framework/packages/core/dist/utils/nameOf.js
@@ -222306,73 +222323,16 @@ LoggerService = __decorate4([
222306
222323
  Service(),
222307
222324
  __metadata3("design:paramtypes", [InjectorService])
222308
222325
  ], LoggerService);
222309
- // ../../node_modules/balanced-match/
222310
- function Entity(options) {
222311
- return (target) => {
222312
- const entities = Metadata.get(ENTITIES, Reflect) || [];
222313
- entities.push({ target, options });
222314
- Metadata.set(ENTITIES, entities, Reflect);
222315
- };
222316
- }
222317
- // ../../node_m
222318
- function getDefaultLength(type) {
222319
- return null;
222320
- }
222321
-
222322
- // ../../node_modules/balanced-match/in
222323
- function Property(options) {
222324
- return (target, propertyKey) => {
222325
- const properties = Metadata.get(PROPERTIES, target.constructor) || [];
222326
- const type = Metadata.getType(target, propertyKey);
222327
- const length = options && options.length || getDefaultLength(type.name);
222328
- options = { length, ...options };
222329
- properties.push({ propertyKey, options });
222330
- Metadata.set(PROPERTIES, properties, target.constructor);
222331
- if (options.isPrimary) {
222332
- const indexes = Metadata.get("indexes", target.constructor) || [];
222333
- indexes.push({ name: `[TABLE]_pkey`, properties: [propertyKey] });
222334
- Metadata.set("indexes", indexes, target.constructor);
222335
- }
222336
- properties.forEach((property) => {
222337
- const types = Metadata.get(PROPERTIES_METADATA, target.constructor) || {};
222338
- const type2 = Metadata.getType(target, property.propertyKey);
222339
- types[property.propertyKey] = { type: type2, options: property.options };
222340
- Metadata.set(PROPERTIES_METADATA, types, target.constructor);
222341
- });
222342
- };
222343
- }
222344
- // ../../node_modules/balanced-match/index
222345
- function PrimaryKey(options) {
222346
- const isPrimary = true;
222347
- return Property({ ...options, isPrimary, unique: true });
222348
- }
222349
- // ../../node_modules/balanced-match/index.jsodules/minimatch
222350
- var ProviderType2;
222351
- (function(ProviderType3) {
222352
- ProviderType3["ROUTES"] = "routes";
222353
- ProviderType3["SERVICE"] = "service";
222354
- ProviderType3["PROVIDER"] = "provider";
222355
- ProviderType3["CONTROLLER"] = "controller";
222356
- })(ProviderType2 || (ProviderType2 = {}));
222357
-
222358
- // ../../node_modules/balanced-match/index.jsodules/minimatch/
222359
- var ProviderScope2;
222360
- (function(ProviderScope3) {
222361
- ProviderScope3["REQUEST"] = "request";
222362
- ProviderScope3["INSTANCE"] = "instance";
222363
- ProviderScope3["SINGLETON"] = "singleton";
222364
- })(ProviderScope2 || (ProviderScope2 = {}));
222365
-
222366
222326
  // ../../node_modules/balanced-match/index.jsodules/mini
222367
222327
  class Provider2 {
222368
- type = ProviderType2.PROVIDER;
222328
+ type = ProviderType.PROVIDER;
222369
222329
  deps = [];
222370
222330
  instance;
222371
222331
  _provide;
222372
222332
  _useClass;
222373
222333
  hooks;
222374
222334
  path;
222375
- scope = ProviderScope2.SINGLETON;
222335
+ scope = ProviderScope.SINGLETON;
222376
222336
  children = [];
222377
222337
  parent;
222378
222338
  constructor(token, options = {}) {
@@ -222484,7 +222444,7 @@ class ProviderControl5 extends Map {
222484
222444
  }
222485
222445
  }
222486
222446
  createIfNotExists(key, options) {
222487
- const type = options.type || ProviderType2.PROVIDER;
222447
+ const type = options.type || ProviderType.PROVIDER;
222488
222448
  if (!this.has(key)) {
222489
222449
  const { model = Provider2 } = this.settings.get(type) || {};
222490
222450
  const item = new model(key, options);
@@ -222495,9 +222455,9 @@ class ProviderControl5 extends Map {
222495
222455
  }
222496
222456
  var GlobalProvider2 = new ProviderControl5;
222497
222457
  // ../../node_modules/balanced-match/index.jsodules/minimatch/dist/cjs/unesc
222498
- GlobalProvider2.createRegistry(ProviderType2.CONTROLLER, Provider2);
222499
- GlobalProvider2.createRegistry(ProviderType2.ROUTES, Provider2);
222500
- var registerController2 = GlobalProvider2.createRegisterFn(ProviderType2.CONTROLLER);
222458
+ GlobalProvider2.createRegistry(ProviderType.CONTROLLER, Provider2);
222459
+ GlobalProvider2.createRegistry(ProviderType.ROUTES, Provider2);
222460
+ var registerController2 = GlobalProvider2.createRegisterFn(ProviderType.CONTROLLER);
222501
222461
  // ../../node_modules/balanced-match/index.jsodules/minimatch/dist/cjs/unes
222502
222462
  function createParamDecorator2(func) {
222503
222463
  return (data) => (target, propertyKey, parameterIndex) => {
@@ -222867,7 +222827,7 @@ var InjectorService5 = InjectorService_12 = class InjectorService6 {
222867
222827
  resolveControllers() {
222868
222828
  if (!this.settings)
222869
222829
  return {};
222870
- const controllers = GlobalProvider.getByType(ProviderType.CONTROLLER).filter((controller3) => !controller3.isChild());
222830
+ const controllers = GlobalProvider.getByType(ProviderType2.CONTROLLER).filter((controller3) => !controller3.isChild());
222871
222831
  let hydrateRoute = new Map;
222872
222832
  for (const controller3 of controllers) {
222873
222833
  let routes = Metadata.get(CONTROLLER_ROUTES, controller3.token);
@@ -222991,16 +222951,16 @@ var InjectorService5 = InjectorService_12 = class InjectorService6 {
222991
222951
  const construct = (deps2) => new provider6.useClass(...deps2);
222992
222952
  let instance;
222993
222953
  if (isRequestScope(provider6, deps, this)) {
222994
- scope = ProviderScope.REQUEST;
222954
+ scope = ProviderScope2.REQUEST;
222995
222955
  }
222996
222956
  const services = deps.filter((t) => !isPrimitiveType(t)).map((token) => this.invoke(getClassOrSymbol(token), locals));
222997
222957
  instance = construct(services);
222998
222958
  switch (scope) {
222999
- case ProviderScope.SINGLETON:
222959
+ case ProviderScope2.SINGLETON:
223000
222960
  provider6.instance = instance;
223001
222961
  this.container.addProvider(provider6.token, provider6);
223002
222962
  break;
223003
- case ProviderScope.REQUEST:
222963
+ case ProviderScope2.REQUEST:
223004
222964
  const clone = provider6.clone();
223005
222965
  clone.instance = instance;
223006
222966
  locals.set(clone.token, clone);
@@ -223052,7 +223012,7 @@ var InjectorService5 = InjectorService_12 = class InjectorService6 {
223052
223012
  return methodInfo;
223053
223013
  }
223054
223014
  scopeOf(provider6) {
223055
- return provider6.scope || ProviderScope.SINGLETON;
223015
+ return provider6.scope || ProviderScope2.SINGLETON;
223056
223016
  }
223057
223017
  getConstructorDependencies(target, propertyKey) {
223058
223018
  return Metadata.getOwn("override:ctor:design:paramtypes", target, propertyKey) || [...Metadata.getParamTypes(target, propertyKey)];
@@ -223178,7 +223138,7 @@ var Context4 = Context_12 = class Context5 {
223178
223138
  }
223179
223139
  };
223180
223140
  Context4 = Context_12 = __decorate6([
223181
- Injectable({ scope: ProviderScope.REQUEST }),
223141
+ Injectable({ scope: ProviderScope2.REQUEST }),
223182
223142
  __metadata4("design:paramtypes", [])
223183
223143
  ], Context4);
223184
223144
  // ../../node_modules/balanced-match/index.jsodules/mini
@@ -223477,19 +223437,59 @@ LoggerService3 = __decorate8([
223477
223437
  Service(),
223478
223438
  __metadata6("design:paramtypes", [InjectorService])
223479
223439
  ], LoggerService3);
223440
+ // ../../node_modules/balanced-match/
223441
+ function Entity(options) {
223442
+ return (target) => {
223443
+ const entities = Metadata3.get(ENTITIES, Reflect) || [];
223444
+ entities.push({ target, options });
223445
+ Metadata3.set(ENTITIES, entities, Reflect);
223446
+ };
223447
+ }
223448
+ // ../../node_m
223449
+ function getDefaultLength(type) {
223450
+ return null;
223451
+ }
223452
+
223453
+ // ../../node_modules/balanced-match/in
223454
+ function Property(options) {
223455
+ return (target, propertyKey) => {
223456
+ const properties = Metadata.get(PROPERTIES, target.constructor) || [];
223457
+ const type = Metadata.getType(target, propertyKey);
223458
+ const length = options && options.length || getDefaultLength(type.name);
223459
+ options = { length, ...options };
223460
+ properties.push({ propertyKey, options });
223461
+ Metadata.set(PROPERTIES, properties, target.constructor);
223462
+ if (options.isPrimary) {
223463
+ const indexes = Metadata.get("indexes", target.constructor) || [];
223464
+ indexes.push({ name: `[TABLE]_pkey`, properties: [propertyKey] });
223465
+ Metadata.set("indexes", indexes, target.constructor);
223466
+ }
223467
+ properties.forEach((property) => {
223468
+ const types = Metadata.get(PROPERTIES_METADATA, target.constructor) || {};
223469
+ const type2 = Metadata.getType(target, property.propertyKey);
223470
+ types[property.propertyKey] = { type: type2, options: property.options };
223471
+ Metadata.set(PROPERTIES_METADATA, types, target.constructor);
223472
+ });
223473
+ };
223474
+ }
223475
+ // ../../node_modules/balanced-match/index
223476
+ function PrimaryKey(options) {
223477
+ const isPrimary = true;
223478
+ return Property({ ...options, isPrimary, unique: true });
223479
+ }
223480
223480
  // ../../node_modules/balanced-match/in
223481
223481
  function OneToMany(entity, fkKey) {
223482
223482
  return (target, propertyKey) => {
223483
- const existing = Metadata3.get(PROPERTIES_RELATIONS, target.constructor) || [];
223484
- existing.push({ relation: "one-to-many", propertyKey, isRelation: true, entity, fkKey, type: Metadata3.getType(target, propertyKey) });
223485
- Metadata3.set(PROPERTIES_RELATIONS, existing, target.constructor);
223483
+ const existing = Metadata.get(PROPERTIES_RELATIONS, target.constructor) || [];
223484
+ existing.push({ relation: "one-to-many", propertyKey, isRelation: true, entity, fkKey, type: Metadata.getType(target, propertyKey) });
223485
+ Metadata.set(PROPERTIES_RELATIONS, existing, target.constructor);
223486
223486
  };
223487
223487
  }
223488
223488
  function ManyToOne(entity) {
223489
223489
  return (target, propertyKey) => {
223490
- const existing = Metadata3.get(PROPERTIES_RELATIONS, target.constructor) || [];
223491
- existing.push({ relation: "many-to-one", propertyKey, isRelation: true, entity, type: Metadata3.getType(target, propertyKey) });
223492
- Metadata3.set(PROPERTIES_RELATIONS, existing, target.constructor);
223490
+ const existing = Metadata.get(PROPERTIES_RELATIONS, target.constructor) || [];
223491
+ existing.push({ relation: "many-to-one", propertyKey, isRelation: true, entity, type: Metadata.getType(target, propertyKey) });
223492
+ Metadata.set(PROPERTIES_RELATIONS, existing, target.constructor);
223493
223493
  };
223494
223494
  }
223495
223495
  // ../../node_modules/balanced-match
@@ -224562,784 +224562,8 @@ class Email extends ValueObject {
224562
224562
  return REGEX.test(value);
224563
224563
  }
224564
224564
  }
224565
- // ../../node_module
224566
- var ENTITIES2 = "cheetah:entities";
224567
- var PROPERTIES_METADATA2 = "cheetah:properties:metadata";
224568
- var PROPERTIES_RELATIONS2 = "cheetah:properties:relations";
224569
- // ../../node_mo
224570
- function getDefaultLength2(type) {
224571
- return null;
224572
- }
224573
- // ../../node_modules/bala
224574
- var __decorate9 = function(decorators5, target, key, desc) {
224575
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
224576
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
224577
- r = Reflect.decorate(decorators5, target, key, desc);
224578
- else
224579
- for (var i = decorators5.length - 1;i >= 0; i--)
224580
- if (d = decorators5[i])
224581
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
224582
- return c > 3 && r && Object.defineProperty(target, key, r), r;
224583
- };
224584
- var __metadata7 = function(k, v) {
224585
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
224586
- return Reflect.metadata(k, v);
224587
- };
224588
- var EntityStorage_1;
224589
- var EntityStorage2 = class EntityStorage3 {
224590
- static {
224591
- EntityStorage_1 = this;
224592
- }
224593
- static instance;
224594
- entities = new Map;
224595
- constructor() {
224596
- EntityStorage_1.instance = this;
224597
- }
224598
- add(entity, properties, relations) {
224599
- const entityName = entity.options?.tableName || entity.target.name.toLowerCase();
224600
- const indexes = Metadata.get("indexes", entity.target) || [];
224601
- this.entities.set(entity.target, {
224602
- showProperties: properties,
224603
- hideProperties: [],
224604
- relations,
224605
- indexes: indexes.map((index) => {
224606
- return {
224607
- table: entityName,
224608
- indexName: index.name.replace("[TABLE]", entityName),
224609
- columnName: index.properties.join(",")
224610
- };
224611
- }),
224612
- tableName: entityName,
224613
- ...entity.options
224614
- });
224615
- }
224616
- get(entity) {
224617
- return this.entities.get(entity);
224618
- }
224619
- entries() {
224620
- return this.entities.entries();
224621
- }
224622
- static getInstance() {
224623
- return EntityStorage_1.instance;
224624
- }
224625
- async snapshot(values) {
224626
- return {
224627
- tableName: values.tableName,
224628
- schema: values.schema || "public",
224629
- indexes: values.indexes || [],
224630
- columns: this.snapshotColumns(values)
224631
- };
224632
- }
224633
- snapshotColumns(values) {
224634
- let properties = Object.entries(values.showProperties).map(([key, value]) => {
224635
- return {
224636
- name: key,
224637
- type: value.options.dbType ?? value.type.name,
224638
- nullable: value.options?.nullable,
224639
- default: value.options?.default,
224640
- autoIncrement: value.options?.autoIncrement,
224641
- primary: value.options?.isPrimary,
224642
- unique: value.options?.unique,
224643
- length: value.options?.length
224644
- };
224645
- });
224646
- let relations = values.relations && values.relations.map((relation) => {
224647
- const type = this.getFkType(relation);
224648
- return {
224649
- name: relation.propertyKey,
224650
- type,
224651
- nullable: relation.nullable,
224652
- unique: relation.unique,
224653
- length: relation.length || getDefaultLength2(type),
224654
- default: relation.default,
224655
- autoIncrement: relation.autoIncrement,
224656
- primary: relation.isPrimary,
224657
- foreignKeys: [
224658
- {
224659
- referencedColumnName: this.getFkKey(relation),
224660
- referencedTableName: this.get(relation.entity()).tableName
224661
- }
224662
- ]
224663
- };
224664
- });
224665
- if (!relations) {
224666
- relations = [];
224667
- }
224668
- if (!properties) {
224669
- properties = [];
224670
- }
224671
- return [...properties, ...relations];
224672
- }
224673
- snapshotIndexes(values) {
224674
- return Object.entries(values.showProperties).map(([key, value]) => {
224675
- return {
224676
- indexName: key,
224677
- columnName: key,
224678
- table: values.tableName
224679
- };
224680
- });
224681
- }
224682
- getFkType(relation) {
224683
- const entity = this.get(relation.entity());
224684
- if (!entity) {
224685
- return "unknown";
224686
- }
224687
- return entity.showProperties[this.getFkKey(relation)].type.name;
224688
- }
224689
- getFkKey(relationShip) {
224690
- if (typeof relationShip.fkKey === "undefined") {
224691
- const entity = this.entities.get(relationShip.entity());
224692
- const property3 = Object.entries(entity.showProperties).find(([key, value]) => value.options.isPrimary === true);
224693
- if (!property3) {
224694
- throw new Error(`Entity ${entity.tableName} does not have a primary key`);
224695
- }
224696
- return property3[0];
224697
- }
224698
- if (typeof relationShip.fkKey === "string") {
224699
- return relationShip.fkKey;
224700
- }
224701
- const match = /\.(?<propriedade>[\w]+)/.exec(relationShip.fkKey.toString());
224702
- return match ? match.groups.propriedade : "";
224703
- }
224704
- };
224705
- EntityStorage2 = EntityStorage_1 = __decorate9([
224706
- Service(),
224707
- __metadata7("design:paramtypes", [])
224708
- ], EntityStorage2);
224709
-
224710
- // ../../node_modules/balanced
224711
- class ValueObject2 {
224712
- value;
224713
- constructor(value) {
224714
- if (!this.validate(value)) {
224715
- throw new HttpException(`Invalid value for ${this.constructor.name}`, 400);
224716
- }
224717
- this.setValue(value);
224718
- }
224719
- static from(value) {
224720
- return new this(value);
224721
- }
224722
- getValue() {
224723
- return this.value;
224724
- }
224725
- equals(vo) {
224726
- return this.getValue() === vo.getValue();
224727
- }
224728
- setValue(value) {
224729
- this.value = value;
224730
- }
224731
- }
224732
-
224733
- // ../../node_modules
224734
- class SqlBuilder4 {
224735
- driver;
224736
- entityStorage;
224737
- statements = {};
224738
- entity;
224739
- model;
224740
- aliases = new Set;
224741
- lastKeyNotOperator = "";
224742
- logger;
224743
- updatedColumns = [];
224744
- constructor(model) {
224745
- const orm4 = Orm.getInstance();
224746
- this.driver = orm4.driverInstance;
224747
- this.logger = orm4.logger;
224748
- this.entityStorage = EntityStorage2.getInstance();
224749
- this.getEntity(model);
224750
- }
224751
- select(columns) {
224752
- const tableName = this.entity.tableName || this.model.name.toLowerCase();
224753
- const schema = this.entity.schema || "public";
224754
- this.statements.statement = "select";
224755
- this.statements.columns = columns;
224756
- this.statements.alias = this.getAlias(tableName);
224757
- this.statements.table = `"${schema}"."${tableName}"`;
224758
- return this;
224759
- }
224760
- insert(values) {
224761
- const { tableName, schema } = this.getTableName();
224762
- for (let value in values) {
224763
- if (this.extendsFrom(ValueObject2, values[value].constructor.prototype)) {
224764
- values[value] = values[value].getValue();
224765
- }
224766
- }
224767
- this.statements.statement = "insert";
224768
- this.statements.alias = this.getAlias(tableName);
224769
- this.statements.table = `"${schema}"."${tableName}"`;
224770
- this.statements.values = this.withUpdatedValues(this.withDefaultValues(values, this.entity), this.entity);
224771
- return this;
224772
- }
224773
- update(values) {
224774
- const { tableName, schema } = this.getTableName();
224775
- for (let value in values) {
224776
- if (this.extendsFrom(ValueObject2, values[value].constructor.prototype)) {
224777
- values[value] = values[value].getValue();
224778
- }
224779
- }
224780
- this.statements.statement = "update";
224781
- this.statements.alias = this.getAlias(tableName);
224782
- this.statements.table = `${schema}.${tableName}`;
224783
- this.statements.values = this.withUpdatedValues(values, this.entity);
224784
- return this;
224785
- }
224786
- where(where) {
224787
- if (typeof where === "undefined" || Object.entries(where).length === 0) {
224788
- return this;
224789
- }
224790
- this.statements.where = this.conditionToSql(where, this.statements.alias);
224791
- return this;
224792
- }
224793
- orderBy(orderBy) {
224794
- if (typeof orderBy === "undefined") {
224795
- return this;
224796
- }
224797
- this.statements.orderBy = this.objectToStringMap(orderBy);
224798
- return this;
224799
- }
224800
- limit(limit) {
224801
- this.statements.limit = limit;
224802
- return this;
224803
- }
224804
- offset(offset) {
224805
- this.statements.offset = offset;
224806
- return this;
224807
- }
224808
- async executeAndReturnFirst() {
224809
- this.statements.limit = 1;
224810
- const result = await this.execute();
224811
- if (result.query.rows.length === 0) {
224812
- return;
224813
- }
224814
- return this.transformToModel(result.query.rows[0]);
224815
- }
224816
- async executeAndReturnFirstOrFail() {
224817
- this.statements.limit = 1;
224818
- const result = await this.execute();
224819
- if (result.query.rows.length === 0) {
224820
- throw new Error("Result not found");
224821
- }
224822
- return this.transformToModel(result.query.rows[0]);
224823
- }
224824
- async executeAndReturnAll() {
224825
- const result = await this.execute();
224826
- if (result.query.rows.length === 0) {
224827
- return [];
224828
- }
224829
- return result.query.rows.map((row) => this.transformToModel(row));
224830
- }
224831
- async execute() {
224832
- if (!this.statements.columns) {
224833
- let columns = [
224834
- ...this.getColumnsEntity(this.model, this.statements.alias)
224835
- ];
224836
- if (this.statements.join) {
224837
- columns = [
224838
- ...columns,
224839
- ...this.statements.join.flatMap((join) => this.getColumnsEntity(join.joinEntity, join.joinAlias))
224840
- ];
224841
- }
224842
- this.statements.columns = columns;
224843
- } else {
224844
- this.statements.columns = this.statements.columns.map((column) => {
224845
- return this.discoverColumnAlias(column);
224846
- }).flat();
224847
- }
224848
- this.statements.columns.push(...this.updatedColumns);
224849
- const result = await this.driver.executeStatement(this.statements);
224850
- this.logger.debug(`SQL: ${result.sql} [${Date.now() - result.startTime}ms]`);
224851
- return result;
224852
- }
224853
- startTransaction() {
224854
- return this.driver.startTransaction();
224855
- }
224856
- commit() {
224857
- return this.driver.commitTransaction();
224858
- }
224859
- rollback() {
224860
- return this.driver.rollbackTransaction();
224861
- }
224862
- async inTransaction(callback) {
224863
- await this.startTransaction();
224864
- try {
224865
- const result = await callback(this);
224866
- await this.commit();
224867
- return result;
224868
- } catch (e) {
224869
- await this.rollback();
224870
- throw e;
224871
- }
224872
- }
224873
- objectToStringMap(obj, parentKey = "") {
224874
- let result = [];
224875
- for (let key in obj) {
224876
- if (obj.hasOwnProperty(key)) {
224877
- let fullKey = parentKey ? `${parentKey}.${key}` : key;
224878
- if (typeof obj[key] === "object" && obj[key] !== null) {
224879
- result = result.concat(this.objectToStringMap(obj[key], fullKey));
224880
- } else {
224881
- result.push(`${this.discoverColumnAlias(fullKey, true)} ${obj[key]}`);
224882
- }
224883
- }
224884
- }
224885
- return result;
224886
- }
224887
- discoverColumnAlias(column, onlyAlias = false) {
224888
- if (!column.includes(".")) {
224889
- if (onlyAlias) {
224890
- return `${this.statements.alias}."${column}"`;
224891
- }
224892
- return `${this.statements.alias}."${column}" as ${this.statements.alias}_${column}`;
224893
- }
224894
- if (typeof this.statements.join === "undefined") {
224895
- throw new Error("Join not found");
224896
- }
224897
- const entities5 = column.split(".");
224898
- let lastEntity = this.model;
224899
- let lastAlias = this.statements.alias;
224900
- const relationsMap = new Map(this.entity.relations.map((rel) => [rel.propertyKey, rel]));
224901
- const joinMap = new Map(this.statements.join.map((join) => [join.joinProperty, join]));
224902
- for (let i = 0;i < entities5.length; i++) {
224903
- if (i === 0) {
224904
- const relation = relationsMap.get(entities5[i]);
224905
- lastEntity = relation?.entity();
224906
- lastAlias = joinMap.get(entities5[i])?.joinAlias;
224907
- } else {
224908
- if (i + 1 === entities5.length) {
224909
- if (onlyAlias) {
224910
- return `${lastAlias}."${entities5[i]}"`;
224911
- }
224912
- return `${lastAlias}."${entities5[i]}" as ${lastAlias}_${entities5[i]}`;
224913
- }
224914
- const lastStatement = joinMap.get(entities5[i]);
224915
- lastEntity = lastStatement?.joinEntity;
224916
- lastAlias = lastStatement?.joinAlias;
224917
- }
224918
- }
224919
- return "";
224920
- }
224921
- getTableName() {
224922
- const tableName = this.entity.tableName || this.model.name.toLowerCase();
224923
- const schema = this.entity.schema || "public";
224924
- return { tableName, schema };
224925
- }
224926
- addSimpleConditionToSql(key, value, alias = null, operator = "=") {
224927
- const aliasToUse = alias || this.statements.alias;
224928
- const valueByType = typeof value === "string" ? `'${value}'` : value;
224929
- return `${aliasToUse}.${key} ${operator} ${valueByType}`;
224930
- }
224931
- addInConditionToSql(key, values, alias = null) {
224932
- const aliasToUse = alias || this.statements.alias;
224933
- return `${aliasToUse}.${key} IN (${values.map((val) => typeof val === "string" ? `'${val}'` : val).join(", ")})`;
224934
- }
224935
- addLogicalOperatorToSql(conditions, operator) {
224936
- return `(${conditions.join(` ${operator} `)})`;
224937
- }
224938
- conditionToSql(condition, alias) {
224939
- const sqlParts = [];
224940
- const operators = ["$eq", "$ne", "$in", "$nin", "$like", "$gt", "$gte", "$lt", "$lte", "$and", "$or"];
224941
- for (let [key, value] of Object.entries(condition)) {
224942
- if (this.extendsFrom(ValueObject2, value.constructor.prototype)) {
224943
- value = value.getValue();
224944
- }
224945
- if (!operators.includes(key)) {
224946
- this.lastKeyNotOperator = key;
224947
- }
224948
- const relationShip = this.entity.relations?.find((rel) => rel.propertyKey === key);
224949
- if (relationShip) {
224950
- sqlParts.push(this.applyJoin(relationShip, value, alias));
224951
- } else if (typeof value !== "object" || value === null) {
224952
- if (key === "$eq") {
224953
- sqlParts.push(this.addSimpleConditionToSql(this.lastKeyNotOperator, value, alias, "="));
224954
- continue;
224955
- }
224956
- sqlParts.push(this.addSimpleConditionToSql(key, value, alias));
224957
- } else if (!operators.includes(key) && Array.isArray(value)) {
224958
- sqlParts.push(this.addInConditionToSql(key, value, alias));
224959
- } else {
224960
- if (["$or", "$and"].includes(key)) {
224961
- sqlParts.push(this.addLogicalOperatorToSql(value.map((cond) => this.conditionToSql(cond, alias)), key.toUpperCase().replace("$", "")));
224962
- }
224963
- for (const operator of operators) {
224964
- if (operator in value) {
224965
- switch (operator) {
224966
- case "$eq":
224967
- sqlParts.push(this.addSimpleConditionToSql(key, value["$eq"], alias, "="));
224968
- break;
224969
- case "$ne":
224970
- sqlParts.push(this.addSimpleConditionToSql(key, value["$ne"], alias, "!="));
224971
- break;
224972
- case "$in":
224973
- sqlParts.push(this.addInConditionToSql(key, value["$in"], alias));
224974
- break;
224975
- case "$nin":
224976
- sqlParts.push(`${alias}.${key} NOT IN (${value["$nin"].map((val) => this.t(val)).join(", ")})`);
224977
- break;
224978
- case "$like":
224979
- sqlParts.push(`${alias}.${key} LIKE '${value["$like"]}'`);
224980
- break;
224981
- case "$gt":
224982
- sqlParts.push(`${alias}.${key} > ${value["$gt"]}`);
224983
- break;
224984
- case "$gte":
224985
- sqlParts.push(`${alias}.${key} >= ${value["$gte"]}`);
224986
- break;
224987
- case "$lt":
224988
- sqlParts.push(`${alias}.${key} < ${value["$lt"]}`);
224989
- break;
224990
- case "$lte":
224991
- sqlParts.push(`${alias}.${key} <= ${value["$lte"]}`);
224992
- break;
224993
- case "$and":
224994
- case "$or":
224995
- const parts = value[operator].map((cond) => this.conditionToSql(cond, alias));
224996
- sqlParts.push(this.addLogicalOperatorToSql(parts, operator.toUpperCase().replace("$", "")));
224997
- break;
224998
- }
224999
- }
225000
- }
225001
- }
225002
- }
225003
- return this.addLogicalOperatorToSql(sqlParts, "AND");
225004
- }
225005
- t(value) {
225006
- return typeof value === "string" ? `'${value}'` : value;
225007
- }
225008
- applyJoin(relationShip, value, alias) {
225009
- const { tableName, schema } = this.getTableName();
225010
- const { tableName: joinTableName, schema: joinSchema } = this.entityStorage.get(relationShip.entity()) || {
225011
- tableName: relationShip.entity().name.toLowerCase(),
225012
- schema: "public"
225013
- };
225014
- let originPrimaryKey = "id";
225015
- for (const prop in this.entity.showProperties) {
225016
- if (this.entity.showProperties[prop].options.isPrimary) {
225017
- originPrimaryKey = prop;
225018
- break;
225019
- }
225020
- }
225021
- const joinAlias = `${this.getAlias(joinTableName)}`;
225022
- const joinWhere = this.conditionToSql(value, joinAlias);
225023
- this.statements.join = this.statements.join || [];
225024
- let on = "";
225025
- switch (relationShip.relation) {
225026
- case "one-to-many":
225027
- on = `${joinAlias}.${this.getFkKey(relationShip)} = ${alias}.${originPrimaryKey}`;
225028
- break;
225029
- case "many-to-one":
225030
- on = `${alias}.${relationShip.propertyKey} = ${joinAlias}.${this.getFkKey(relationShip)}`;
225031
- break;
225032
- }
225033
- this.statements.join.push({
225034
- joinAlias,
225035
- joinTable: joinTableName,
225036
- joinSchema: joinSchema || "public",
225037
- joinWhere,
225038
- joinProperty: relationShip.propertyKey,
225039
- originAlias: alias,
225040
- originSchema: schema,
225041
- originTable: tableName,
225042
- propertyKey: relationShip.propertyKey,
225043
- joinEntity: relationShip.entity(),
225044
- type: "LEFT",
225045
- on,
225046
- originalEntity: relationShip.originalEntity
225047
- });
225048
- return joinWhere;
225049
- }
225050
- getFkKey(relationShip) {
225051
- if (typeof relationShip.fkKey === "undefined") {
225052
- return "id";
225053
- }
225054
- if (typeof relationShip.fkKey === "string") {
225055
- return relationShip.fkKey;
225056
- }
225057
- const match = /\.(?<propriedade>[\w]+)/.exec(relationShip.fkKey.toString());
225058
- return match ? match.groups.propriedade : "";
225059
- }
225060
- getEntity(model) {
225061
- const entity = this.entityStorage.get(model);
225062
- this.model = model;
225063
- if (!entity) {
225064
- throw new Error("Entity not found");
225065
- }
225066
- this.entity = entity;
225067
- }
225068
- transformToModel(data) {
225069
- const instance = new this.model;
225070
- instance.$_isPersisted = true;
225071
- const entitiesByAlias = {
225072
- [this.statements.alias]: instance
225073
- };
225074
- const entitiesOptions = new Map;
225075
- entitiesOptions.set(this.statements.alias, this.entityStorage.get(instance.constructor));
225076
- if (this.statements.join) {
225077
- this.statements.join.forEach((join) => {
225078
- const joinInstance = new join.joinEntity;
225079
- joinInstance.$_isPersisted = true;
225080
- entitiesByAlias[join.joinAlias] = joinInstance;
225081
- entitiesOptions.set(join.joinAlias, this.entityStorage.get(joinInstance.constructor));
225082
- });
225083
- }
225084
- Object.entries(data).forEach(([key, value]) => {
225085
- const [alias, prop] = key.split("_");
225086
- const entity = entitiesByAlias[alias];
225087
- if (!entity) {
225088
- return;
225089
- }
225090
- const entityProperty = entitiesOptions.get(alias).showProperties[prop];
225091
- if (entityProperty) {
225092
- if (this.extendsFrom(ValueObject2, entityProperty.type.prototype)) {
225093
- entity[prop] = new entityProperty.type(value);
225094
- return;
225095
- }
225096
- entity[prop] = value;
225097
- }
225098
- });
225099
- if (this.statements.join) {
225100
- this.statements.join.forEach((join) => {
225101
- const { joinAlias, originAlias, propertyKey } = join;
225102
- const originEntity = entitiesByAlias[originAlias];
225103
- const joinEntity = entitiesByAlias[joinAlias];
225104
- const property3 = entitiesOptions.get(originAlias).relations.find((rel) => rel.propertyKey === propertyKey);
225105
- if (!originEntity || !joinEntity) {
225106
- return;
225107
- }
225108
- originEntity[propertyKey] = property3.type === Array ? originEntity[propertyKey] ? [...originEntity[propertyKey], joinEntity] : [joinEntity] : joinEntity;
225109
- });
225110
- }
225111
- return instance;
225112
- }
225113
- getAlias(tableName) {
225114
- const alias = tableName.split("").shift() || "";
225115
- let counter = 1;
225116
- let uniqueAlias = `${alias}${counter}`;
225117
- while (this.aliases.has(uniqueAlias)) {
225118
- counter++;
225119
- uniqueAlias = `${alias}${counter}`;
225120
- }
225121
- this.aliases.add(uniqueAlias);
225122
- return uniqueAlias;
225123
- }
225124
- getColumnsEntity(entity, alias) {
225125
- const e = this.entityStorage.get(entity);
225126
- if (!e) {
225127
- throw new Error("Entity not found");
225128
- }
225129
- return Object.keys(e.showProperties).map((key) => `${alias}."${key}" as "${alias}_${key}"`);
225130
- }
225131
- withDefaultValues(values, entityOptions) {
225132
- const property3 = Object.entries(entityOptions.showProperties).filter(([_, value]) => value.options.onInsert);
225133
- const defaultProperties = Object.entries(entityOptions.showProperties).filter(([_, value]) => value.options.default);
225134
- for (const [key, property4] of defaultProperties) {
225135
- if (typeof values[key] === "undefined") {
225136
- if (typeof property4.options.default === "function") {
225137
- values[key] = (0, eval)(property4.options.default());
225138
- } else {
225139
- values[key] = (0, eval)(property4.options.default);
225140
- }
225141
- }
225142
- }
225143
- property3.forEach(([key, property4]) => {
225144
- values[key] = property4.options.onInsert();
225145
- this.updatedColumns.push(`${this.statements.alias}."${key}" as "${this.statements.alias}_${key}"`);
225146
- });
225147
- return values;
225148
- }
225149
- withUpdatedValues(values, entityOptions) {
225150
- const property3 = Object.entries(entityOptions.showProperties).filter(([_, value]) => value.options.onUpdate);
225151
- property3.forEach(([key, property4]) => {
225152
- values[key] = property4.options.onUpdate();
225153
- this.updatedColumns.push(`${this.statements.alias}."${key}" as "${this.statements.alias}_${key}"`);
225154
- });
225155
- return values;
225156
- }
225157
- extendsFrom(baseClass, instance) {
225158
- let proto = Object.getPrototypeOf(instance);
225159
- while (proto) {
225160
- if (proto === baseClass.prototype) {
225161
- return true;
225162
- }
225163
- proto = Object.getPrototypeOf(proto);
225164
- }
225165
- return false;
225166
- }
225167
- }
225168
-
225169
- // ../../node_
225170
- var __decorate10 = function(decorators5, target, key, desc) {
225171
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
225172
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
225173
- r = Reflect.decorate(decorators5, target, key, desc);
225174
- else
225175
- for (var i = decorators5.length - 1;i >= 0; i--)
225176
- if (d = decorators5[i])
225177
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
225178
- return c > 3 && r && Object.defineProperty(target, key, r), r;
225179
- };
225180
- var __metadata8 = function(k, v) {
225181
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
225182
- return Reflect.metadata(k, v);
225183
- };
225184
- var Orm_1;
225185
- var Orm2 = class Orm3 {
225186
- static {
225187
- Orm_1 = this;
225188
- }
225189
- logger;
225190
- driverInstance;
225191
- static instance;
225192
- connection;
225193
- constructor(logger3) {
225194
- this.logger = logger3;
225195
- Orm_1.instance = this;
225196
- }
225197
- static getInstance() {
225198
- return Orm_1.instance;
225199
- }
225200
- setConnection(connection) {
225201
- this.connection = connection;
225202
- this.driverInstance = new this.connection.driver(connection);
225203
- }
225204
- createQueryBuilder(model) {
225205
- return new SqlBuilder4(model);
225206
- }
225207
- connect() {
225208
- return this.driverInstance.connect();
225209
- }
225210
- disconnect() {
225211
- return this.driverInstance.disconnect();
225212
- }
225213
- };
225214
- Orm2 = Orm_1 = __decorate10([
225215
- Service(),
225216
- __metadata8("design:paramtypes", [LoggerService])
225217
- ], Orm2);
225218
- // ../../node_modules/
225219
- var import_ts_morph2 = __toESM(require_ts_morph(), 1);
225220
- var __decorate11 = function(decorators5, target, key, desc) {
225221
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
225222
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
225223
- r = Reflect.decorate(decorators5, target, key, desc);
225224
- else
225225
- for (var i = decorators5.length - 1;i >= 0; i--)
225226
- if (d = decorators5[i])
225227
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
225228
- return c > 3 && r && Object.defineProperty(target, key, r), r;
225229
- };
225230
- var __metadata9 = function(k, v) {
225231
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
225232
- return Reflect.metadata(k, v);
225233
- };
225234
- var OrmService2 = class OrmService3 {
225235
- orm;
225236
- storage;
225237
- allEntities = new Map;
225238
- constructor(orm5, storage2, entityFile) {
225239
- this.orm = orm5;
225240
- this.storage = storage2;
225241
- console.log("Preparing entities...");
225242
- const files = new import_ts_morph2.Project({ skipLoadingLibFiles: true }).addSourceFilesAtPaths(entityFile ?? this.getSourceFilePaths());
225243
- files.forEach((file) => {
225244
- file.getClasses().forEach((classDeclaration) => {
225245
- if (classDeclaration.getDecorator("Entity")) {
225246
- const properties = classDeclaration.getProperties();
225247
- const nullables = [];
225248
- const defaults = {};
225249
- properties.forEach((property3) => {
225250
- const propertyName = property3.getName();
225251
- const isNullable = property3.hasQuestionToken();
225252
- const initializer = property3.getInitializer();
225253
- if (isNullable) {
225254
- nullables.push(propertyName);
225255
- }
225256
- if (initializer) {
225257
- const initializerKind = initializer.getKind();
225258
- switch (initializerKind) {
225259
- case import_ts_morph2.SyntaxKind.StringLiteral:
225260
- defaults[propertyName] = initializer.getText();
225261
- break;
225262
- case import_ts_morph2.SyntaxKind.NumericLiteral:
225263
- defaults[propertyName] = parseFloat(initializer.getText());
225264
- break;
225265
- default:
225266
- defaults[propertyName] = () => initializer.getText();
225267
- break;
225268
- }
225269
- }
225270
- this.allEntities.set(classDeclaration.getName(), { nullables, defaults });
225271
- });
225272
- }
225273
- });
225274
- });
225275
- }
225276
- async onInit(customConfig = {}) {
225277
- const configFile = globbySync("cheetah.config.ts", { absolute: true });
225278
- if (configFile.length === 0) {
225279
- console.log("No config file found!");
225280
- return;
225281
- }
225282
- const config = await import(configFile[0]);
225283
- const setConfig = Object.keys(customConfig).length > 0 ? customConfig : config.default;
225284
- this.orm.setConnection(setConfig);
225285
- await this.orm.connect();
225286
- if (typeof config.default.entities === "string") {
225287
- const files = globbySync([config.default.entities, "!node_modules"], { gitignore: true, absolute: true });
225288
- for (const file of files) {
225289
- await import(file);
225290
- }
225291
- }
225292
- const entities6 = Metadata.get(ENTITIES2, Reflect);
225293
- if (!entities6) {
225294
- console.log("No entities found!");
225295
- return;
225296
- }
225297
- for (const entity of entities6) {
225298
- const nullableDefaultEntity = this.allEntities.get(entity.target.name);
225299
- const properties = Metadata.get(PROPERTIES_METADATA2, entity.target);
225300
- const relationship = Metadata.get(PROPERTIES_RELATIONS2, entity.target);
225301
- for (const property3 in properties) {
225302
- if (nullableDefaultEntity?.nullables.includes(property3)) {
225303
- properties[property3].options.nullable = true;
225304
- }
225305
- if (nullableDefaultEntity?.defaults[property3]) {
225306
- properties[property3].options.default = nullableDefaultEntity?.defaults[property3];
225307
- }
225308
- }
225309
- this.storage.add(entity, properties, relationship);
225310
- }
225311
- console.log("Entities prepared!");
225312
- }
225313
- getSourceFilePaths() {
225314
- const projectRoot = process.cwd();
225315
- const getAllFiles = (dir) => {
225316
- const patterns = [`${dir}/**/*.(ts|js)`, "!**/node_modules/**"];
225317
- try {
225318
- return globbySync(patterns, { gitignore: true });
225319
- } catch (error) {
225320
- console.error("Erro ao obter arquivos:", error);
225321
- return [];
225322
- }
225323
- };
225324
- return getAllFiles(projectRoot);
225325
- }
225326
- };
225327
- __decorate11([
225328
- OnApplicationInit(),
225329
- __metadata9("design:type", Function),
225330
- __metadata9("design:paramtypes", [Object]),
225331
- __metadata9("design:returntype", Promise)
225332
- ], OrmService2.prototype, "onInit", null);
225333
- OrmService2 = __decorate11([
225334
- Service(),
225335
- __metadata9("design:paramtypes", [Orm2, EntityStorage2, String])
225336
- ], OrmService2);
225337
- // ../../node_modules/balan
225338
- var import_pg2 = __toESM(require_lib2(), 1);
225339
- // ../../node_mo
225340
- var CheetahOrm2 = new Cheetah({ exports: [Orm2, OrmService2, EntityStorage2] });
225341
224565
  // ../../node_modules
225342
- class Uuid extends ValueObject2 {
224566
+ class Uuid extends ValueObject {
225343
224567
  constructor() {
225344
224568
  super(...arguments);
225345
224569
  }
@@ -225365,4 +224589,4 @@ export {
225365
224589
  BaseEntity
225366
224590
  };
225367
224591
 
225368
- //# debugId=8F79C72D73C5E18764756e2164756e21
224592
+ //# debugId=DF06C4EDD9AB72A464756e2164756e21