@punks/backend-entity-manager 0.0.58 → 0.0.60

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/cjs/index.js CHANGED
@@ -179,7 +179,7 @@ const WpEntity = (name, props = {}) => common.applyDecorators(common.SetMetadata
179
179
  ...props,
180
180
  }));
181
181
 
182
- const WpAppInitializer = () => common.applyDecorators(common.Injectable(), common.SetMetadata(EntityManagerSymbols.AppInitializer, true));
182
+ const WpAppInitializer = (props = {}) => common.applyDecorators(common.Injectable(), common.SetMetadata(EntityManagerSymbols.AppInitializer, props));
183
183
 
184
184
  const WpEntityRepository = (entityName, props = {}) => common.applyDecorators(common.Injectable(), common.SetMetadata(EntityManagerSymbols.EntityRepository, {
185
185
  entityName,
@@ -19551,17 +19551,19 @@ const Services = [
19551
19551
  const IoC = [exports.EntityManagerRegistry];
19552
19552
 
19553
19553
  let NestEventEmitter = class NestEventEmitter {
19554
- constructor() { }
19555
- setEmitter(eventEmitter) {
19554
+ constructor(eventEmitter) {
19556
19555
  this.eventEmitter = eventEmitter;
19557
19556
  }
19557
+ // setEmitter(eventEmitter: EventEmitter2) {
19558
+ // this.eventEmitter = eventEmitter
19559
+ // }
19558
19560
  async emit(event, ...args) {
19559
19561
  await this.eventEmitter.emitAsync(event, ...args);
19560
19562
  }
19561
19563
  };
19562
19564
  NestEventEmitter = __decorate([
19563
19565
  common.Injectable(),
19564
- __metadata("design:paramtypes", [])
19566
+ __metadata("design:paramtypes", [eventEmitter.EventEmitter2])
19565
19567
  ], NestEventEmitter);
19566
19568
 
19567
19569
  class EmailTemplatesCollection {
@@ -19654,7 +19656,8 @@ exports.EntityManagerInitializer = EntityManagerInitializer_1 = class EntityMana
19654
19656
  }
19655
19657
  async executeInitializers(app) {
19656
19658
  const initializers = await this.discoverAppInitializers();
19657
- for (const initializer of initializers) {
19659
+ const sortedInitializers = backendCore.sort(initializers, backendCore.byField((x) => x.meta.priority ?? Number.MAX_VALUE), backendCore.byField((x) => x.discoveredClass.name));
19660
+ for (const initializer of sortedInitializers) {
19658
19661
  await initializer.discoveredClass.instance.initialize(app);
19659
19662
  this.logger.log(`Entity manager app initializer ${initializer.discoveredClass.name} initialized 💪`);
19660
19663
  }
@@ -19701,7 +19704,7 @@ exports.EntityManagerInitializer = EntityManagerInitializer_1 = class EntityMana
19701
19704
  app
19702
19705
  .get(exports.ModulesContainerProvider)
19703
19706
  .setModulesContainer(staticProviders.modulesContainer);
19704
- app.get(NestEventEmitter).setEmitter(staticProviders.eventEmitter);
19707
+ // app.get(NestEventEmitter).setEmitter(staticProviders.eventEmitter)
19705
19708
  }
19706
19709
  async discoverRepositories() {
19707
19710
  return await this.discover.providersWithMetaAtKey(EntityManagerSymbols.EntityRepository);