@punks/backend-entity-manager 0.0.147 → 0.0.149

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.
@@ -18,6 +18,12 @@ export type StringFilter = {
18
18
  notIn?: string[];
19
19
  notLike?: string;
20
20
  };
21
+ export type EnumFilter<T> = {
22
+ in?: T[];
23
+ eq?: T;
24
+ ne?: T;
25
+ notIn?: T[];
26
+ };
21
27
  export type BooleanFilter = {
22
28
  eq?: boolean;
23
29
  ne?: boolean;
@@ -1,6 +1,7 @@
1
1
  import { FindOperator } from "typeorm";
2
- import { BooleanFilter, DateFilter, NumericFilter, StringFilter } from "./clause";
2
+ import { BooleanFilter, DateFilter, EnumFilter, NumericFilter, StringFilter } from "./clause";
3
3
  export declare class QueryClauseBuilder {
4
+ enumFilter<T>(filter: EnumFilter<T>): FindOperator<T>;
4
5
  stringFilter(filter: StringFilter): FindOperator<string>;
5
6
  numericFilter(filter: NumericFilter): FindOperator<number>;
6
7
  dateFilter(filter: DateFilter): FindOperator<Date>;
@@ -10,7 +10,7 @@ export interface UserRegistrationInput<TUserRegistrationInfo, TUserContext exten
10
10
  password: string;
11
11
  registrationInfo: TUserRegistrationInfo;
12
12
  callback: UserRegisterCallbackTemplate;
13
- languageId: string;
13
+ languageCode: string;
14
14
  context?: TUserContext;
15
15
  }
16
16
  export interface UserRegistrationResult {
package/dist/esm/index.js CHANGED
@@ -8,7 +8,7 @@ import { STATIC_CONTEXT } from '@nestjs/core/injector/constants';
8
8
  import { MetadataScanner } from '@nestjs/core/metadata-scanner';
9
9
  import { JwtService, JwtModule } from '@nestjs/jwt';
10
10
  import { EventEmitter2, EventEmitterModule } from '@nestjs/event-emitter';
11
- import { MoreThanOrEqual, MoreThan, LessThanOrEqual, LessThan, In, Equal, Like, Not, And } from 'typeorm';
11
+ import { In, Equal, Not, And, MoreThanOrEqual, MoreThan, LessThanOrEqual, LessThan, Like } from 'typeorm';
12
12
  import { ListObjectsCommand, PutObjectCommand, GetObjectCommand, DeleteObjectCommand, S3Client } from '@aws-sdk/client-s3';
13
13
  import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
14
14
  import { SendEmailCommand, SESClient } from '@aws-sdk/client-ses';
@@ -2313,7 +2313,6 @@ class NestEntityManager {
2313
2313
  class NestEntitySerializer extends EntitySerializer {
2314
2314
  constructor(entityName, registry) {
2315
2315
  super(entityName);
2316
- // this.services = registry.resolveEntityServicesCollection(entityName)
2317
2316
  }
2318
2317
  }
2319
2318
 
@@ -20517,7 +20516,7 @@ let UserRegistrationHandler = class UserRegistrationHandler {
20517
20516
  passwordHash,
20518
20517
  passwordUpdateTimestamp: new Date(),
20519
20518
  });
20520
- await this.sendRegistrationEmail(user, input.callback, input.languageId);
20519
+ await this.sendRegistrationEmail(user, input.callback, input.languageCode);
20521
20520
  this.logger.debug(`User already exists but not verified. Sending new verification email: ${input.email} - ${input.userName}`, { user });
20522
20521
  return {
20523
20522
  success: true,
@@ -20530,7 +20529,7 @@ let UserRegistrationHandler = class UserRegistrationHandler {
20530
20529
  passwordHash,
20531
20530
  passwordUpdateTimestamp: new Date(),
20532
20531
  });
20533
- await this.sendRegistrationEmail(newUser, input.callback, input.languageId);
20532
+ await this.sendRegistrationEmail(newUser, input.callback, input.languageCode);
20534
20533
  this.logger.debug(`New user created: ${input.email} - ${input.userName}`, {
20535
20534
  user: newUser,
20536
20535
  });
@@ -21588,7 +21587,7 @@ let EntityManagerInitializer = EntityManagerInitializer_1 = class EntityManagerI
21588
21587
  const collection = new EmailTemplatesCollection();
21589
21588
  for (const emailTemplate of emailTemplates) {
21590
21589
  collection.registerTemplate(emailTemplate.meta.templateId, emailTemplate.discoveredClass.instance);
21591
- this.logger.log(`Entity manager email template ${emailTemplate.discoveredClass.name} registered 📧`);
21590
+ this.logger.log(`Entity manager email template ${emailTemplate.meta.templateId}: ${emailTemplate.discoveredClass.name} registered 📧`);
21592
21591
  }
21593
21592
  this.registry
21594
21593
  .getContainer()
@@ -22071,6 +22070,22 @@ class QueryBuilderBase {
22071
22070
  }
22072
22071
 
22073
22072
  class QueryClauseBuilder {
22073
+ enumFilter(filter) {
22074
+ const clauses = [];
22075
+ if (!!filter?.in) {
22076
+ clauses.push(In(filter.in));
22077
+ }
22078
+ if (!!filter?.eq) {
22079
+ clauses.push(Equal(filter.eq));
22080
+ }
22081
+ if (!!filter?.ne) {
22082
+ clauses.push(Not(Equal(filter.ne)));
22083
+ }
22084
+ if (!!filter?.notIn) {
22085
+ clauses.push(Not(In(filter.notIn)));
22086
+ }
22087
+ return And(...clauses);
22088
+ }
22074
22089
  stringFilter(filter) {
22075
22090
  const clauses = [];
22076
22091
  if (!!filter?.gte) {