@punks/backend-entity-manager 0.0.78 → 0.0.80

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.
@@ -12,7 +12,7 @@ export interface FooEntity {
12
12
  id: string;
13
13
  name: string;
14
14
  age: number;
15
- updatedAt: Date;
15
+ updatedOn: Date;
16
16
  }
17
17
  export type FooEntityManager = IEntityManager<FooEntity, string, Partial<FooEntity>, Partial<FooEntity>, FooDeleteParameters, FooSearchParameters, FooSorting, FooCursor, FooFacets>;
18
18
  export declare class FooRepository extends InMemoryRepository<FooEntity> {
@@ -45,7 +45,7 @@ export interface FooDto {
45
45
  name: string;
46
46
  age: number;
47
47
  };
48
- updatedAt: Date;
48
+ updatedOn: Date;
49
49
  }
50
50
  export interface FooListItemDto {
51
51
  id: string;
@@ -8,7 +8,7 @@ export declare class FooEntity {
8
8
  id: string;
9
9
  name: string;
10
10
  age: number;
11
- updatedAt: Date;
11
+ updatedOn: Date;
12
12
  }
13
13
  export type FooEntityManager = IEntityManager<FooEntity, string, Partial<FooEntity>, Partial<FooEntity>, FooDeleteParameters, FooSearchParameters, FooSorting, FooCursor, FooFacets>;
14
14
  export declare class FooTypeOrmRepo extends TypeOrmRepository<FooEntity, string> {
@@ -52,7 +52,7 @@ export interface FooDto {
52
52
  name: string;
53
53
  age: number;
54
54
  };
55
- updatedAt: Date;
55
+ updatedOn: Date;
56
56
  }
57
57
  export interface FooListItemDto {
58
58
  id: string;
@@ -30,3 +30,6 @@ export declare class MultipleEntitiesFoundException extends EntityManagerExcepti
30
30
  export declare class EntityManagerConfigurationError extends EntityManagerException {
31
31
  constructor(message: string);
32
32
  }
33
+ export declare class MissingEntityIdError extends EntityManagerException {
34
+ constructor();
35
+ }
@@ -2,5 +2,5 @@ export declare class FooEntity {
2
2
  id: string;
3
3
  name: string;
4
4
  age: number;
5
- updatedAt: Date;
5
+ updatedOn: Date;
6
6
  }
@@ -6,7 +6,7 @@ export declare class FooProfile {
6
6
  export declare class FooDto {
7
7
  id: string;
8
8
  profile: FooProfile;
9
- updatedAt: Date;
9
+ updatedOn: Date;
10
10
  }
11
11
  export declare class FooListItemDto {
12
12
  id: string;
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Log, sort, byField, toDict, newUuid as newUuid$1, removeUndefinedProps } from '@punks/backend-core';
1
+ import { Log, isNullOrUndefined, sort, byField, toDict, newUuid as newUuid$1, removeUndefinedProps } from '@punks/backend-core';
2
2
  import { applyDecorators, Injectable, SetMetadata, Global, Module, Scope, Logger, HttpException, HttpStatus } from '@nestjs/common';
3
3
  import { ApiProperty } from '@nestjs/swagger';
4
4
  import { Reflector } from '@nestjs/core';
@@ -67,6 +67,12 @@ class EntityManagerConfigurationError extends EntityManagerException {
67
67
  this.name = "EntityManagerConfigurationError";
68
68
  }
69
69
  }
70
+ class MissingEntityIdError extends EntityManagerException {
71
+ constructor() {
72
+ super("Missing entity id");
73
+ this.name = "MissingEntityIdError";
74
+ }
75
+ }
70
76
 
71
77
  var ReplicationMode;
72
78
  (function (ReplicationMode) {
@@ -261,11 +267,11 @@ __decorate([
261
267
  __metadata("design:type", Number)
262
268
  ], NumericFacetItem.prototype, "value", void 0);
263
269
  __decorate([
264
- ApiProperty({ nullable: true }),
270
+ ApiProperty({ required: false }),
265
271
  __metadata("design:type", String)
266
272
  ], NumericFacetItem.prototype, "name", void 0);
267
273
  __decorate([
268
- ApiProperty({ nullable: true }),
274
+ ApiProperty({ required: false }),
269
275
  __metadata("design:type", Number)
270
276
  ], NumericFacetItem.prototype, "count", void 0);
271
277
  class NumericFacet {
@@ -281,11 +287,11 @@ __decorate([
281
287
  __metadata("design:type", Boolean)
282
288
  ], BooleanFacetItem.prototype, "value", void 0);
283
289
  __decorate([
284
- ApiProperty({ nullable: true }),
290
+ ApiProperty({ required: false }),
285
291
  __metadata("design:type", String)
286
292
  ], BooleanFacetItem.prototype, "name", void 0);
287
293
  __decorate([
288
- ApiProperty({ nullable: true }),
294
+ ApiProperty({ required: false }),
289
295
  __metadata("design:type", Number)
290
296
  ], BooleanFacetItem.prototype, "count", void 0);
291
297
  class BooleanFacet {
@@ -301,11 +307,11 @@ __decorate([
301
307
  __metadata("design:type", String)
302
308
  ], StringFacetItem.prototype, "value", void 0);
303
309
  __decorate([
304
- ApiProperty({ nullable: true }),
310
+ ApiProperty({ required: false }),
305
311
  __metadata("design:type", String)
306
312
  ], StringFacetItem.prototype, "name", void 0);
307
313
  __decorate([
308
- ApiProperty({ nullable: true }),
314
+ ApiProperty({ required: false }),
309
315
  __metadata("design:type", Number)
310
316
  ], StringFacetItem.prototype, "count", void 0);
311
317
  class StringFacet {
@@ -625,6 +631,9 @@ class EntityDeleteCommand {
625
631
  this.services = services;
626
632
  }
627
633
  async execute(id) {
634
+ if (isNullOrUndefined(id)) {
635
+ throw new MissingEntityIdError();
636
+ }
628
637
  await this.authorize(id);
629
638
  await this.services.resolveRepository().delete(id);
630
639
  await this.services.resolveEventsManager().processEntityDeletedEvent(id);
@@ -20396,7 +20405,9 @@ let EntityManagerInitializer = EntityManagerInitializer_1 = class EntityManagerI
20396
20405
  const converterDict = toDict(converters, (c) => c.meta.entityName);
20397
20406
  const adapterDict = toDict(adapters, (a) => a.meta.entityName);
20398
20407
  const authDict = toDict(auth, (a) => a.meta.entityName);
20399
- for (const repository of repositories) {
20408
+ const sortedRepositories = lodash.exports.orderBy(repositories, (x) => x.meta.entityName);
20409
+ this.logger.log(`Discovered repositories: \n${sortedRepositories.join(" \n")}`);
20410
+ for (const repository of sortedRepositories) {
20400
20411
  const entityName = repository.meta.entityName;
20401
20412
  const queryBuilder = queryBuilderDict[entityName];
20402
20413
  if (!queryBuilder) {
@@ -26544,5 +26555,5 @@ InMemoryEmailProvider = __decorate([
26544
26555
  WpEmailProvider("in-memory")
26545
26556
  ], InMemoryEmailProvider);
26546
26557
 
26547
- export { AUTHENTICATION_EVENTS_NAMESPACE, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsEmailModule, AwsSesEmailTemplate, BooleanFacet, BooleanFacetItem, EmailService, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntitySeeder, EventsService, InMemoryEmailProvider, InvalidCredentialsError, MemberOf, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestPipelineTemplate, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, NumericFacet, NumericFacetItem, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, PipelineController, PipelineErrorType, PipelineStatus, PipelineStepErrorType, PipelinesBuilder, PipelinesRunner, PlatformEvents, Public, QueryBuilderBase, ReplicationMode, Roles, SendgridEmailModule, SendgridEmailTemplate, SortDirection, StringFacet, StringFacetItem, TrackingService, UserCreationError, UserRegistrationError, WpAppInitializer, WpAwsSesEmailTemplate, WpEmailTemplate, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEventsTracker, WpPipeline, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, buildRolesGuard, getLocalizedText, newUuid, renderHandlebarsTemplate };
26558
+ export { AUTHENTICATION_EVENTS_NAMESPACE, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsEmailModule, AwsSesEmailTemplate, BooleanFacet, BooleanFacetItem, EmailService, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntitySeeder, EventsService, InMemoryEmailProvider, InvalidCredentialsError, MemberOf, MissingEntityIdError, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestPipelineTemplate, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, NumericFacet, NumericFacetItem, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, PipelineController, PipelineErrorType, PipelineStatus, PipelineStepErrorType, PipelinesBuilder, PipelinesRunner, PlatformEvents, Public, QueryBuilderBase, ReplicationMode, Roles, SendgridEmailModule, SendgridEmailTemplate, SortDirection, StringFacet, StringFacetItem, TrackingService, UserCreationError, UserRegistrationError, WpAppInitializer, WpAwsSesEmailTemplate, WpEmailTemplate, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEventsTracker, WpPipeline, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, buildRolesGuard, getLocalizedText, newUuid, renderHandlebarsTemplate };
26548
26559
  //# sourceMappingURL=index.js.map