@punks/backend-entity-manager 0.0.4 → 0.0.6
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 +32 -30
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/__test__/server/entities/foo/manager.d.ts +2 -2
- package/dist/cjs/types/platforms/nest/__test__/server/entities/foo/repository.d.ts +2 -1
- package/dist/cjs/types/platforms/nest/base/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/ioc/discovery/index.d.ts +2 -3
- package/dist/esm/index.js +32 -31
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/__test__/server/entities/foo/manager.d.ts +2 -2
- package/dist/esm/types/platforms/nest/__test__/server/entities/foo/repository.d.ts +2 -1
- package/dist/esm/types/platforms/nest/base/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/ioc/discovery/index.d.ts +2 -3
- package/dist/index.d.ts +8 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NestEntityManager } from "../../../../base";
|
|
2
2
|
import { EntityManagerRegistry } from "../../../../ioc/registry";
|
|
3
3
|
import { FooEntity } from "./entity";
|
|
4
|
-
import { FooCreateData, FooCursor, FooFacets, FooSearchParameters, FooSorting, FooUpdateData } from "./models";
|
|
5
|
-
export declare class FooEntityManager extends NestEntityManager<FooEntity,
|
|
4
|
+
import { FooCreateData, FooCursor, FooEntityId, FooFacets, FooSearchParameters, FooSorting, FooUpdateData } from "./models";
|
|
5
|
+
export declare class FooEntityManager extends NestEntityManager<FooEntity, FooEntityId, FooCreateData, FooUpdateData, FooSearchParameters, FooSorting, FooCursor, FooFacets> {
|
|
6
6
|
constructor(registry: EntityManagerRegistry);
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Repository } from "typeorm";
|
|
2
2
|
import { FooEntity } from "./entity";
|
|
3
3
|
import { NestTypeOrmRepository } from "../../../../integrations";
|
|
4
|
-
|
|
4
|
+
import { FooEntityId } from "./models";
|
|
5
|
+
export declare class FooRepository extends NestTypeOrmRepository<FooEntity, FooEntityId> {
|
|
5
6
|
constructor(repository: Repository<FooEntity>);
|
|
6
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Type } from "@nestjs/common";
|
|
2
|
-
import { ModulesContainer } from "@nestjs/core/injector/modules-container";
|
|
3
2
|
import { MetadataScanner } from "@nestjs/core/metadata-scanner";
|
|
4
3
|
export interface DiscoveredModule<T = object> {
|
|
5
4
|
name: string;
|
|
@@ -38,11 +37,10 @@ export declare function getComponentMetaAtKey<T>(key: MetaKey, component: Discov
|
|
|
38
37
|
*/
|
|
39
38
|
export declare const withMetaAtKey: (key: MetaKey) => Filter<DiscoveredClass>;
|
|
40
39
|
export declare class DiscoveryService {
|
|
41
|
-
private readonly modulesContainer;
|
|
42
40
|
private readonly metadataScanner;
|
|
43
41
|
private discoveredControllers?;
|
|
44
42
|
private discoveredProviders?;
|
|
45
|
-
constructor(
|
|
43
|
+
constructor(metadataScanner: MetadataScanner);
|
|
46
44
|
/**
|
|
47
45
|
* Discovers all providers in a Nest App that match a filter
|
|
48
46
|
* @param filter
|
|
@@ -91,6 +89,7 @@ export declare class DiscoveryService {
|
|
|
91
89
|
private toDiscoveredClass;
|
|
92
90
|
private extractMethodMetaAtKey;
|
|
93
91
|
private discover;
|
|
92
|
+
private getModuleEntries;
|
|
94
93
|
}
|
|
95
94
|
/**
|
|
96
95
|
* Exposes a query API over top of the NestJS Module container
|
package/dist/esm/index.js
CHANGED
|
@@ -57,6 +57,21 @@ var SortDirection;
|
|
|
57
57
|
SortDirection[SortDirection["Desc"] = 1] = "Desc";
|
|
58
58
|
})(SortDirection || (SortDirection = {}));
|
|
59
59
|
|
|
60
|
+
class NestEntityActions {
|
|
61
|
+
// todo: resolve entity name from decorator
|
|
62
|
+
constructor(entityName, registry) {
|
|
63
|
+
this.services = registry.resolveEntityServicesCollection(entityName);
|
|
64
|
+
}
|
|
65
|
+
get provider() {
|
|
66
|
+
if (!this.actionsInstance) {
|
|
67
|
+
this.actionsInstance =
|
|
68
|
+
this.services.resolveEntityActions();
|
|
69
|
+
}
|
|
70
|
+
this.services.resolveEntityActions;
|
|
71
|
+
return this.actionsInstance;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
60
75
|
class NestEntityManager {
|
|
61
76
|
// todo: resolve entity name from decorator
|
|
62
77
|
constructor(entityName, registry) {
|
|
@@ -2041,7 +2056,7 @@ dist.uid = uid;
|
|
|
2041
2056
|
|
|
2042
2057
|
Object.defineProperty(injectable_decorator, "__esModule", { value: true });
|
|
2043
2058
|
injectable_decorator.mixin = injectable_decorator.Injectable = void 0;
|
|
2044
|
-
const uid_1$
|
|
2059
|
+
const uid_1$2 = dist;
|
|
2045
2060
|
const constants_1$e = constants$2;
|
|
2046
2061
|
/**
|
|
2047
2062
|
* Decorator that marks a class as a [provider](https://docs.nestjs.com/providers).
|
|
@@ -2083,7 +2098,7 @@ injectable_decorator.Injectable = Injectable;
|
|
|
2083
2098
|
*/
|
|
2084
2099
|
function mixin(mixinClass) {
|
|
2085
2100
|
Object.defineProperty(mixinClass, 'name', {
|
|
2086
|
-
value: (0, uid_1$
|
|
2101
|
+
value: (0, uid_1$2.uid)(21),
|
|
2087
2102
|
});
|
|
2088
2103
|
Injectable()(mixinClass);
|
|
2089
2104
|
return mixinClass;
|
|
@@ -2880,7 +2895,7 @@ assignCustomMetadata_util.assignCustomParameterMetadata = assignCustomParameterM
|
|
|
2880
2895
|
|
|
2881
2896
|
Object.defineProperty(createRouteParamMetadata_decorator, "__esModule", { value: true });
|
|
2882
2897
|
createRouteParamMetadata_decorator.createParamDecorator = void 0;
|
|
2883
|
-
const uid_1$
|
|
2898
|
+
const uid_1$1 = dist;
|
|
2884
2899
|
const constants_1$5 = constants$2;
|
|
2885
2900
|
const assign_custom_metadata_util_1 = assignCustomMetadata_util;
|
|
2886
2901
|
const shared_utils_1$f = shared_utils;
|
|
@@ -2892,7 +2907,7 @@ const shared_utils_1$f = shared_utils;
|
|
|
2892
2907
|
* @publicApi
|
|
2893
2908
|
*/
|
|
2894
2909
|
function createParamDecorator(factory, enhancers = []) {
|
|
2895
|
-
const paramtype = (0, uid_1$
|
|
2910
|
+
const paramtype = (0, uid_1$1.uid)(21);
|
|
2896
2911
|
return (data, ...pipes) => (target, key, index) => {
|
|
2897
2912
|
const args = Reflect.getMetadata(constants_1$5.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
|
2898
2913
|
const isPipe = (pipe) => pipe &&
|
|
@@ -5126,8 +5141,8 @@ var randomStringGenerator_util = {};
|
|
|
5126
5141
|
|
|
5127
5142
|
Object.defineProperty(randomStringGenerator_util, "__esModule", { value: true });
|
|
5128
5143
|
randomStringGenerator_util.randomStringGenerator = void 0;
|
|
5129
|
-
const uid_1
|
|
5130
|
-
const randomStringGenerator = () => (0, uid_1
|
|
5144
|
+
const uid_1 = dist;
|
|
5145
|
+
const randomStringGenerator = () => (0, uid_1.uid)(21);
|
|
5131
5146
|
randomStringGenerator_util.randomStringGenerator = randomStringGenerator;
|
|
5132
5147
|
|
|
5133
5148
|
var constants$1 = {};
|
|
@@ -31202,25 +31217,6 @@ STATIC_CONTEXT = constants.STATIC_CONTEXT = Object.freeze({
|
|
|
31202
31217
|
id: STATIC_CONTEXT_ID,
|
|
31203
31218
|
});
|
|
31204
31219
|
|
|
31205
|
-
var modulesContainer = {};
|
|
31206
|
-
|
|
31207
|
-
Object.defineProperty(modulesContainer, "__esModule", { value: true });
|
|
31208
|
-
var ModulesContainer_1 = modulesContainer.ModulesContainer = void 0;
|
|
31209
|
-
const uid_1 = dist;
|
|
31210
|
-
class ModulesContainer extends Map {
|
|
31211
|
-
constructor() {
|
|
31212
|
-
super(...arguments);
|
|
31213
|
-
this._applicationId = (0, uid_1.uid)(21);
|
|
31214
|
-
}
|
|
31215
|
-
get applicationId() {
|
|
31216
|
-
return this._applicationId;
|
|
31217
|
-
}
|
|
31218
|
-
getById(id) {
|
|
31219
|
-
return Array.from(this.values()).find(moduleRef => moduleRef.id === id);
|
|
31220
|
-
}
|
|
31221
|
-
}
|
|
31222
|
-
ModulesContainer_1 = modulesContainer.ModulesContainer = ModulesContainer;
|
|
31223
|
-
|
|
31224
31220
|
var metadataScanner = {};
|
|
31225
31221
|
|
|
31226
31222
|
Object.defineProperty(metadataScanner, "__esModule", { value: true });
|
|
@@ -48536,8 +48532,9 @@ const withMetaAtKey = (key) => (component) => {
|
|
|
48536
48532
|
return lodash.exports.some(metaTargets, (x) => Reflect.getMetadata(key, x));
|
|
48537
48533
|
};
|
|
48538
48534
|
let DiscoveryService = class DiscoveryService {
|
|
48539
|
-
constructor(
|
|
48540
|
-
|
|
48535
|
+
constructor(
|
|
48536
|
+
// private readonly modulesContainer: ModulesContainer,
|
|
48537
|
+
metadataScanner) {
|
|
48541
48538
|
this.metadataScanner = metadataScanner;
|
|
48542
48539
|
}
|
|
48543
48540
|
/**
|
|
@@ -48660,7 +48657,7 @@ let DiscoveryService = class DiscoveryService {
|
|
|
48660
48657
|
};
|
|
48661
48658
|
}
|
|
48662
48659
|
async discover(component) {
|
|
48663
|
-
const modulesMap =
|
|
48660
|
+
const modulesMap = this.getModuleEntries();
|
|
48664
48661
|
return Promise.all(
|
|
48665
48662
|
// @ts-ignore
|
|
48666
48663
|
lodash.exports.flatMap(modulesMap, ([key, nestModule]) => {
|
|
@@ -48670,11 +48667,15 @@ let DiscoveryService = class DiscoveryService {
|
|
|
48670
48667
|
.map((component) => this.toDiscoveredClass(nestModule, component));
|
|
48671
48668
|
}));
|
|
48672
48669
|
}
|
|
48670
|
+
getModuleEntries() {
|
|
48671
|
+
// todo: restore
|
|
48672
|
+
// return [...this.modulesContainer.entries()]
|
|
48673
|
+
return new Map();
|
|
48674
|
+
}
|
|
48673
48675
|
};
|
|
48674
48676
|
DiscoveryService = __decorate([
|
|
48675
48677
|
common.Injectable(),
|
|
48676
|
-
__metadata("design:paramtypes", [
|
|
48677
|
-
MetadataScanner_1])
|
|
48678
|
+
__metadata("design:paramtypes", [MetadataScanner_1])
|
|
48678
48679
|
], DiscoveryService);
|
|
48679
48680
|
/**
|
|
48680
48681
|
* Exposes a query API over top of the NestJS Module container
|
|
@@ -48780,5 +48781,5 @@ EntityManagerModule = __decorate([
|
|
|
48780
48781
|
})
|
|
48781
48782
|
], EntityManagerModule);
|
|
48782
48783
|
|
|
48783
|
-
export { EntityManagerException, EntityManagerModule, EntityManagerRegistry, EntityManagerSymbols, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, MultipleEntitiesFoundException, NestEntityManager, NestTypeOrmQueryBuilder, NestTypeOrmRepository, QueryBuilderBase, ReplicationMode, SortDirection, WpEntity, WpEntityActions, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository };
|
|
48784
|
+
export { EntityManagerException, EntityManagerModule, EntityManagerRegistry, EntityManagerSymbols, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, MultipleEntitiesFoundException, NestEntityActions, NestEntityManager, NestTypeOrmQueryBuilder, NestTypeOrmRepository, QueryBuilderBase, ReplicationMode, SortDirection, WpEntity, WpEntityActions, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository };
|
|
48784
48785
|
//# sourceMappingURL=index.js.map
|