@punks/backend-entity-manager 0.0.13 → 0.0.14
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 +3 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/index.d.ts +1 -0
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/index.d.ts +1 -0
- package/dist/index.d.ts +85 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type as Type$1, INestApplicationContext } from '@nestjs/common';
|
|
2
2
|
import { Module } from '@nestjs/core/injector/module';
|
|
3
3
|
import { ModulesContainer } from '@nestjs/core/injector/modules-container';
|
|
4
|
+
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
|
|
4
5
|
import { ObjectLiteral, FindOneOptions, FindManyOptions, Repository, ObjectId, FindOptionsWhere, FindOptionsRelations } from 'typeorm';
|
|
5
6
|
|
|
6
7
|
type EnumType = string | number | symbol;
|
|
@@ -485,15 +486,82 @@ interface DiscoveredModule<T = object> {
|
|
|
485
486
|
interface DiscoveredClass extends DiscoveredModule {
|
|
486
487
|
parentModule?: DiscoveredModule;
|
|
487
488
|
}
|
|
489
|
+
interface DiscoveredMethod {
|
|
490
|
+
handler: (...args: any[]) => any;
|
|
491
|
+
methodName: string;
|
|
492
|
+
parentClass: DiscoveredClass;
|
|
493
|
+
}
|
|
494
|
+
interface DiscoveredMethodWithMeta<T> {
|
|
495
|
+
discoveredMethod: DiscoveredMethod;
|
|
496
|
+
meta: T;
|
|
497
|
+
}
|
|
488
498
|
interface DiscoveredClassWithMeta<T> {
|
|
489
499
|
discoveredClass: DiscoveredClass;
|
|
490
500
|
meta: T;
|
|
491
501
|
}
|
|
502
|
+
type MetaKey = string | number | symbol;
|
|
503
|
+
type Filter<T> = (item: T) => boolean;
|
|
492
504
|
declare class ModulesContainerProvider {
|
|
493
505
|
private modulesContainer;
|
|
494
506
|
setModulesContainer(modulesContainer: ModulesContainer): void;
|
|
495
507
|
getModules(): [string, Module][];
|
|
496
508
|
}
|
|
509
|
+
declare class CustomDiscoveryService {
|
|
510
|
+
private readonly modulesContainer;
|
|
511
|
+
private readonly metadataScanner;
|
|
512
|
+
private discoveredControllers?;
|
|
513
|
+
private discoveredProviders?;
|
|
514
|
+
constructor(modulesContainer: ModulesContainerProvider, metadataScanner: MetadataScanner);
|
|
515
|
+
/**
|
|
516
|
+
* Discovers all providers in a Nest App that match a filter
|
|
517
|
+
* @param filter
|
|
518
|
+
*/
|
|
519
|
+
providers(filter: Filter<DiscoveredClass>): Promise<DiscoveredClass[]>;
|
|
520
|
+
/**
|
|
521
|
+
* Discovers all controller methods that either directly have a certain meta key attached to them
|
|
522
|
+
* or belong to a controller that has the same meta key attached to them
|
|
523
|
+
* @param metaKey The meta key to scan for
|
|
524
|
+
* @param metaFilter An optional filter for the contents of the meta object
|
|
525
|
+
*/
|
|
526
|
+
methodsAndControllerMethodsWithMetaAtKey<T>(metaKey: MetaKey, metaFilter?: Filter<T>): Promise<DiscoveredMethodWithMeta<T>[]>;
|
|
527
|
+
/**
|
|
528
|
+
* Discovers all providers in an App that have meta at a specific key and returns the provider(s) and associated meta
|
|
529
|
+
* @param metaKey The metakey to scan for
|
|
530
|
+
*/
|
|
531
|
+
providersWithMetaAtKey<T>(metaKey: MetaKey): Promise<DiscoveredClassWithMeta<T>[]>;
|
|
532
|
+
/**
|
|
533
|
+
* Discovers all controllers in a Nest App that match a filter
|
|
534
|
+
* @param filter
|
|
535
|
+
*/
|
|
536
|
+
controllers(filter: Filter<DiscoveredClass>): Promise<DiscoveredClass[]>;
|
|
537
|
+
/**
|
|
538
|
+
* Discovers all controllers in an App that have meta at a specific key and returns the controller(s) and associated meta
|
|
539
|
+
* @param metaKey The metakey to scan for
|
|
540
|
+
*/
|
|
541
|
+
controllersWithMetaAtKey<T>(metaKey: MetaKey): Promise<DiscoveredClassWithMeta<T>[]>;
|
|
542
|
+
/**
|
|
543
|
+
* Discovers all method handlers matching a particular metakey from a Provider or Controller
|
|
544
|
+
* @param component
|
|
545
|
+
* @param metaKey
|
|
546
|
+
*/
|
|
547
|
+
classMethodsWithMetaAtKey<T>(component: DiscoveredClass, metaKey: MetaKey): DiscoveredMethodWithMeta<T>[];
|
|
548
|
+
/**
|
|
549
|
+
* Discovers all the methods that exist on providers in a Nest App that contain metadata under a specific key
|
|
550
|
+
* @param metaKey The metakey to scan for
|
|
551
|
+
* @param providerFilter A predicate used to limit the providers being scanned. Defaults to all providers in the app module
|
|
552
|
+
*/
|
|
553
|
+
providerMethodsWithMetaAtKey<T>(metaKey: MetaKey, providerFilter?: Filter<DiscoveredClass>): Promise<DiscoveredMethodWithMeta<T>[]>;
|
|
554
|
+
/**
|
|
555
|
+
* Discovers all the methods that exist on controllers in a Nest App that contain metadata under a specific key
|
|
556
|
+
* @param metaKey The metakey to scan for
|
|
557
|
+
* @param controllerFilter A predicate used to limit the controllers being scanned. Defaults to all providers in the app module
|
|
558
|
+
*/
|
|
559
|
+
controllerMethodsWithMetaAtKey<T>(metaKey: MetaKey, controllerFilter?: Filter<DiscoveredClass>): Promise<DiscoveredMethodWithMeta<T>[]>;
|
|
560
|
+
private toDiscoveredClass;
|
|
561
|
+
private extractMethodMetaAtKey;
|
|
562
|
+
private discover;
|
|
563
|
+
private getModuleEntries;
|
|
564
|
+
}
|
|
497
565
|
|
|
498
566
|
interface EntityAdapterProps {
|
|
499
567
|
entityName: string;
|
|
@@ -582,7 +650,23 @@ declare class NestTypeOrmRepository<TEntity extends ObjectLiteral, TEntityId> ex
|
|
|
582
650
|
constructor(repository: Repository<TEntity>);
|
|
583
651
|
}
|
|
584
652
|
|
|
653
|
+
declare class EntityManagerInitializer {
|
|
654
|
+
private readonly discover;
|
|
655
|
+
private readonly registry;
|
|
656
|
+
private readonly logger;
|
|
657
|
+
constructor(discover: CustomDiscoveryService, registry: EntityManagerRegistry);
|
|
658
|
+
initialize(app: INestApplicationContext): Promise<void>;
|
|
659
|
+
private discoverEntities;
|
|
660
|
+
private discoverRepositories;
|
|
661
|
+
private discoverQueryBuilders;
|
|
662
|
+
private discoverConverters;
|
|
663
|
+
private discoverAdapters;
|
|
664
|
+
private discoverAuthMiddlewares;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
declare const Processors: (typeof EntityManagerInitializer)[];
|
|
668
|
+
|
|
585
669
|
declare class EntityManagerModule {
|
|
586
670
|
}
|
|
587
671
|
|
|
588
|
-
export { EntityActionsProps, EntityAuthMiddlewareProps, EntityConnectorProps, EntityConverterProps, EntityManagerException, EntityManagerModule, EntityManagerProps, EntityManagerRegistry, EntityManagerSymbols, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntityProps, EntityQueryBuilderProps, EntityRepositoryProps, FilterExpression, IAuthorizationResult, IEntitiesQueryBuilder, IEntitiesSearchAction, IEntitiesSearchQuery, IEntityActions, IEntityAdapter, IEntityAuthorizationMiddleware, IEntityConverter, IEntityCreateAction, IEntityCreateCommand, IEntityDeleteAction, IEntityDeleteCommand, IEntityEventsManager, IEntityGetAction, IEntityGetQuery, IEntityManager, IEntityManagerServiceCollection, IEntityManagerServiceRoot, IEntityMapper, IEntityReplicaDeleteManager, IEntityReplicaSyncManager, IEntityRepository, IEntitySearchParameters, IEntitySearchResults, IEntityUpdateAction, IEntityUpdateCommand, IEntityUpsertAction, IEntityUpsertCommand, IReplicasConfiguration, ISearchFilters, ISearchOptions, ISearchRequestPaging, ISearchResultsPaging, ISearchSorting, ISearchSortingField, ModulesContainerProvider, MultipleEntitiesFoundException, NestEntityActions, NestEntityManager, NestTypeOrmQueryBuilder, NestTypeOrmRepository, QueryBuilderBase, ReplicaConfiguration, ReplicaOptions, ReplicationMode, SortDirection, SortingType, WpEntity, WpEntityActions, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository };
|
|
672
|
+
export { EntityActionsProps, EntityAuthMiddlewareProps, EntityConnectorProps, EntityConverterProps, EntityManagerException, EntityManagerModule, EntityManagerProps, EntityManagerRegistry, EntityManagerSymbols, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntityProps, EntityQueryBuilderProps, EntityRepositoryProps, FilterExpression, IAuthorizationResult, IEntitiesQueryBuilder, IEntitiesSearchAction, IEntitiesSearchQuery, IEntityActions, IEntityAdapter, IEntityAuthorizationMiddleware, IEntityConverter, IEntityCreateAction, IEntityCreateCommand, IEntityDeleteAction, IEntityDeleteCommand, IEntityEventsManager, IEntityGetAction, IEntityGetQuery, IEntityManager, IEntityManagerServiceCollection, IEntityManagerServiceRoot, IEntityMapper, IEntityReplicaDeleteManager, IEntityReplicaSyncManager, IEntityRepository, IEntitySearchParameters, IEntitySearchResults, IEntityUpdateAction, IEntityUpdateCommand, IEntityUpsertAction, IEntityUpsertCommand, IReplicasConfiguration, ISearchFilters, ISearchOptions, ISearchRequestPaging, ISearchResultsPaging, ISearchSorting, ISearchSortingField, ModulesContainerProvider, MultipleEntitiesFoundException, NestEntityActions, NestEntityManager, NestTypeOrmQueryBuilder, NestTypeOrmRepository, Processors, QueryBuilderBase, ReplicaConfiguration, ReplicaOptions, ReplicationMode, SortDirection, SortingType, WpEntity, WpEntityActions, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository };
|