@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.
- package/dist/cjs/index.js +19 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/__test__/entity/foo.d.ts +2 -2
- package/dist/cjs/types/__test__/providers/typeorm/entity/foo.d.ts +2 -2
- package/dist/cjs/types/abstractions/errors.d.ts +3 -0
- package/dist/cjs/types/platforms/nest/__test__/server/database/core/entities/foo.entity.d.ts +1 -1
- package/dist/cjs/types/platforms/nest/__test__/server/entities/foo/dto.d.ts +1 -1
- package/dist/esm/index.js +20 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/__test__/entity/foo.d.ts +2 -2
- package/dist/esm/types/__test__/providers/typeorm/entity/foo.d.ts +2 -2
- package/dist/esm/types/abstractions/errors.d.ts +3 -0
- package/dist/esm/types/platforms/nest/__test__/server/database/core/entities/foo.entity.d.ts +1 -1
- package/dist/esm/types/platforms/nest/__test__/server/entities/foo/dto.d.ts +1 -1
- package/dist/index.d.ts +4 -1
- package/package.json +5 -4
|
@@ -12,7 +12,7 @@ export interface FooEntity {
|
|
|
12
12
|
id: string;
|
|
13
13
|
name: string;
|
|
14
14
|
age: number;
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
+
}
|
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({
|
|
270
|
+
ApiProperty({ required: false }),
|
|
265
271
|
__metadata("design:type", String)
|
|
266
272
|
], NumericFacetItem.prototype, "name", void 0);
|
|
267
273
|
__decorate([
|
|
268
|
-
ApiProperty({
|
|
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({
|
|
290
|
+
ApiProperty({ required: false }),
|
|
285
291
|
__metadata("design:type", String)
|
|
286
292
|
], BooleanFacetItem.prototype, "name", void 0);
|
|
287
293
|
__decorate([
|
|
288
|
-
ApiProperty({
|
|
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({
|
|
310
|
+
ApiProperty({ required: false }),
|
|
305
311
|
__metadata("design:type", String)
|
|
306
312
|
], StringFacetItem.prototype, "name", void 0);
|
|
307
313
|
__decorate([
|
|
308
|
-
ApiProperty({
|
|
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
|
-
|
|
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
|