@punks/backend-entity-manager 0.0.14 → 0.0.16
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 +12382 -559
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/events.d.ts +3 -0
- package/dist/cjs/types/platforms/nest/ioc/registry/index.d.ts +4 -0
- package/dist/cjs/types/platforms/nest/processors/index.d.ts +1 -2
- package/dist/cjs/types/platforms/nest/processors/initializer/index.d.ts +3 -1
- package/dist/cjs/types/platforms/nest/processors/providers.d.ts +2 -0
- package/dist/cjs/types/platforms/nest/providers/events/index.d.ts +7 -0
- package/dist/cjs/types/platforms/nest/providers/index.d.ts +2 -0
- package/dist/cjs/types/providers/services.d.ts +4 -1
- package/dist/cjs/types/services/events.d.ts +3 -1
- package/dist/cjs/types/services/types.d.ts +9 -0
- package/dist/cjs/types/symbols/ioc.d.ts +6 -1
- package/dist/esm/index.js +12375 -560
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/events.d.ts +3 -0
- package/dist/esm/types/platforms/nest/ioc/registry/index.d.ts +4 -0
- package/dist/esm/types/platforms/nest/processors/index.d.ts +1 -2
- package/dist/esm/types/platforms/nest/processors/initializer/index.d.ts +3 -1
- package/dist/esm/types/platforms/nest/processors/providers.d.ts +2 -0
- package/dist/esm/types/platforms/nest/providers/events/index.d.ts +7 -0
- package/dist/esm/types/platforms/nest/providers/index.d.ts +2 -0
- package/dist/esm/types/providers/services.d.ts +4 -1
- package/dist/esm/types/services/events.d.ts +3 -1
- package/dist/esm/types/services/types.d.ts +9 -0
- package/dist/esm/types/symbols/ioc.d.ts +6 -1
- package/dist/index.d.ts +19 -4
- package/package.json +2 -1
- package/readme.md +1 -1
|
@@ -3,3 +3,6 @@ export interface IEntityEventsManager<TEntity, TEntityId> {
|
|
|
3
3
|
processEntityUpdatedEvent(entity: TEntity): Promise<void>;
|
|
4
4
|
processEntityDeletedEvent(id: TEntityId): Promise<void>;
|
|
5
5
|
}
|
|
6
|
+
export interface IEventEmitter {
|
|
7
|
+
emit(event: string, ...args: any[]): Promise<void>;
|
|
8
|
+
}
|
|
@@ -3,9 +3,13 @@ import { EntityAuthMiddlewareProps, EntityConverterProps, EntityQueryBuilderProp
|
|
|
3
3
|
import { EntityServiceLocator } from "../../../../providers/services";
|
|
4
4
|
import { DiscoveredClassWithMeta } from "../discovery";
|
|
5
5
|
import { EntityAdapterProps } from "../../decorators/adapter";
|
|
6
|
+
import { IEventEmitter } from "../../../../abstractions/events";
|
|
6
7
|
export declare class EntityManagerRegistry {
|
|
7
8
|
private readonly container;
|
|
8
9
|
getContainer(): import("../../../../abstractions").IEntityManagerServiceRoot;
|
|
10
|
+
resisterGlobalServices({ eventEmitter, }: {
|
|
11
|
+
eventEmitter?: IEventEmitter;
|
|
12
|
+
}): Promise<void>;
|
|
9
13
|
registerDiscoveredEntity(app: INestApplicationContext, { adapter, entityName, converter, queryBuilder, repository, authMiddleware, }: {
|
|
10
14
|
entityName: string;
|
|
11
15
|
repository: DiscoveredClassWithMeta<EntityRepositoryProps>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const Processors: (typeof EntityManagerInitializer)[];
|
|
1
|
+
export { EntityManagerInitializer } from "./initializer";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { INestApplicationContext } from "@nestjs/common";
|
|
2
2
|
import { EntityManagerRegistry } from "../../ioc/registry";
|
|
3
3
|
import { CustomDiscoveryService } from "../../ioc/discovery";
|
|
4
|
+
import { NestEventEmitter } from "../../providers/events";
|
|
4
5
|
export declare class EntityManagerInitializer {
|
|
5
6
|
private readonly discover;
|
|
6
7
|
private readonly registry;
|
|
8
|
+
private readonly eventEmitter;
|
|
7
9
|
private readonly logger;
|
|
8
|
-
constructor(discover: CustomDiscoveryService, registry: EntityManagerRegistry);
|
|
10
|
+
constructor(discover: CustomDiscoveryService, registry: EntityManagerRegistry, eventEmitter: NestEventEmitter);
|
|
9
11
|
initialize(app: INestApplicationContext): Promise<void>;
|
|
10
12
|
private discoverEntities;
|
|
11
13
|
private discoverRepositories;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EventEmitter2 } from "@nestjs/event-emitter";
|
|
2
|
+
import { IEventEmitter } from "../../../../abstractions/events";
|
|
3
|
+
export declare class NestEventEmitter implements IEventEmitter {
|
|
4
|
+
private readonly eventEmitter;
|
|
5
|
+
constructor(eventEmitter: EventEmitter2);
|
|
6
|
+
emit(event: string, ...args: any[]): Promise<void>;
|
|
7
|
+
}
|
|
@@ -5,7 +5,7 @@ import { IEntityCreateCommand, IEntityDeleteCommand, IEntityUpdateCommand, IEnti
|
|
|
5
5
|
import { SortingType } from "../abstractions/common";
|
|
6
6
|
import { IConnectorsConfiguration, IEntityConnectorDeleteManager, IEntityConnectorSyncManager } from "../abstractions/connectors";
|
|
7
7
|
import { IEntityConverter } from "../abstractions/converters";
|
|
8
|
-
import { IEntityEventsManager } from "../abstractions/events";
|
|
8
|
+
import { IEntityEventsManager, IEventEmitter } from "../abstractions/events";
|
|
9
9
|
import { IEntityManager } from "../abstractions/manager";
|
|
10
10
|
import { IEntitiesQueryBuilder, IEntitiesSearchQuery, IEntityGetQuery } from "../abstractions/queries";
|
|
11
11
|
import { IEntityReplicaDeleteManager, IEntityReplicaSyncManager, IReplicasConfiguration } from "../abstractions/replication";
|
|
@@ -16,6 +16,7 @@ export declare class EntityServiceLocator<TEntity, TEntityId> {
|
|
|
16
16
|
private readonly services;
|
|
17
17
|
private readonly entityName;
|
|
18
18
|
constructor(services: EntitiesServiceLocator, entityName: string);
|
|
19
|
+
getRootServices(): EntitiesServiceLocator;
|
|
19
20
|
resolveEntityManager(): IEntityManager<TEntity, unknown, unknown, unknown, any, any, unknown, unknown>;
|
|
20
21
|
resolveEntityActions(): IEntityActions<TEntity, TEntityId, unknown, unknown, unknown, unknown, any, any, unknown, unknown>;
|
|
21
22
|
resolveRepository<TGetConditions, TFindCondition, TUpdateCondition, TDeleteCondition>(): IEntityRepository<TEntity, TEntityId, TGetConditions, TFindCondition, TUpdateCondition, TDeleteCondition>;
|
|
@@ -48,6 +49,8 @@ export declare class EntitiesServiceLocator {
|
|
|
48
49
|
private readonly provider;
|
|
49
50
|
constructor(provider: ServiceLocator);
|
|
50
51
|
getProvider(): ServiceLocator;
|
|
52
|
+
resolveEventEmitter<TEventEmitter extends IEventEmitter>(): TEventEmitter;
|
|
53
|
+
registerEventEmitter<TEventEmitter extends IEventEmitter>(instance: TEventEmitter): void;
|
|
51
54
|
resolveEntityManager<TEntity>(entityName: string): IEntityManager<TEntity, unknown, unknown, unknown, any, any, unknown, unknown>;
|
|
52
55
|
registerEntityManager<TEntity>(entityName: string, instance: IEntityManager<TEntity, unknown, unknown, unknown, any, any, unknown, unknown>): void;
|
|
53
56
|
resolveEntityActions<TEntity>(entityName: string): IEntityActions<TEntity, unknown, unknown, unknown, unknown, unknown, any, any, unknown, unknown>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { IEntityEventsManager } from "../abstractions/events";
|
|
2
2
|
import { EntityServiceLocator } from "../providers/services";
|
|
3
3
|
export declare class EntityEventsManager<TEntity, TEntityId> implements IEntityEventsManager<TEntity, TEntityId> {
|
|
4
|
+
private readonly entityName;
|
|
4
5
|
private readonly services;
|
|
5
|
-
constructor(services: EntityServiceLocator<TEntity, TEntityId>);
|
|
6
|
+
constructor(entityName: string, services: EntityServiceLocator<TEntity, TEntityId>);
|
|
6
7
|
processEntityCreatedEvent(entity: TEntity): Promise<void>;
|
|
7
8
|
processEntityUpdatedEvent(entity: TEntity): Promise<void>;
|
|
8
9
|
processEntityDeletedEvent(id: TEntityId): Promise<void>;
|
|
10
|
+
private emitEntityEvent;
|
|
9
11
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const EntityServices: {
|
|
2
2
|
Actions: {
|
|
3
3
|
IEntityGetAction: string;
|
|
4
4
|
IEntitiesSearchAction: string;
|
|
@@ -48,3 +48,8 @@ export declare const Services: {
|
|
|
48
48
|
IEntityRepository: string;
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
+
export declare const GlobalServices: {
|
|
52
|
+
Events: {
|
|
53
|
+
IEventEmitter: string;
|
|
54
|
+
};
|
|
55
|
+
};
|