diff --git a/packages/di/src/common/decorators/inject.ts b/packages/di/src/common/decorators/inject.ts index 6b625ffb46d..c40d44bb51a 100644 --- a/packages/di/src/common/decorators/inject.ts +++ b/packages/di/src/common/decorators/inject.ts @@ -40,11 +40,12 @@ export function Inject(token?: TokenProvider | (() => TokenProvider), onGet = (b switch (bindingType) { case DecoratorTypes.PARAM_CTOR: if (token) { - const paramTypes = getConstructorDependencies(target); + const paramTypes = getConstructorDependencies(target, propertyKey); const type = paramTypes[descriptor as number]; paramTypes[descriptor as number] = type === Array ? [token] : token; + Metadata.setParamTypes(target, propertyKey!, paramTypes); setConstructorDependencies(target, paramTypes); } break; diff --git a/packages/di/src/common/utils/getConstructorDependencies.ts b/packages/di/src/common/utils/getConstructorDependencies.ts index 3b905800dec..faef10580a1 100644 --- a/packages/di/src/common/utils/getConstructorDependencies.ts +++ b/packages/di/src/common/utils/getConstructorDependencies.ts @@ -1,7 +1,7 @@ import {Metadata} from "@tsed/core"; -export function getConstructorDependencies(target: any) { - return [...(Metadata.get("override:ctor:design:paramtypes", target, undefined) || Metadata.getParamTypes(target) || [])]; +export function getConstructorDependencies(target: any, propertyKey?: string | symbol | undefined) { + return Metadata.getOwn("override:ctor:design:paramtypes", target, propertyKey) || [...Metadata.getParamTypes(target, propertyKey)] || []; } export function setConstructorDependencies(target: any, deps: any[]) { diff --git a/packages/orm/mongoose/jest.config.js b/packages/orm/mongoose/jest.config.js index 5e9a3a6c16f..7898bf14545 100644 --- a/packages/orm/mongoose/jest.config.js +++ b/packages/orm/mongoose/jest.config.js @@ -9,10 +9,10 @@ module.exports = { }, coverageThreshold: { global: { - statements: 98.95, - branches: 95, + statements: 99.06, + branches: 95.41, functions: 99, - lines: 98.95 + lines: 99.06 } } }; diff --git a/packages/orm/prisma/test/snapshots/generate_code/repositories/PostsRepository.ts b/packages/orm/prisma/test/snapshots/generate_code/repositories/PostsRepository.ts index bafa81c2843..187c475c4ad 100644 --- a/packages/orm/prisma/test/snapshots/generate_code/repositories/PostsRepository.ts +++ b/packages/orm/prisma/test/snapshots/generate_code/repositories/PostsRepository.ts @@ -18,8 +18,8 @@ export class PostsRepository { return this.collection.groupBy.bind(this.collection); } - deleteMany(args: Prisma.PostDeleteManyArgs) { - return this.collection.deleteMany(args); + protected deserialize(obj: null | Post | Post[]): T { + return deserialize(obj, {type: PostModel, collectionType: isArray(obj) ? Array : undefined}); } async findUnique(args: Prisma.PostFindUniqueArgs): Promise { @@ -57,8 +57,8 @@ export class PostsRepository { return this.deserialize(obj); } - protected deserialize(obj: null | Post | Post[]): T { - return deserialize(obj, {type: PostModel, collectionType: isArray(obj) ? Array : undefined}); + deleteMany(args: Prisma.PostDeleteManyArgs) { + return this.collection.deleteMany(args); } updateMany(args: Prisma.PostUpdateManyArgs) { diff --git a/packages/orm/prisma/test/snapshots/generate_code/repositories/UsersRepository.ts b/packages/orm/prisma/test/snapshots/generate_code/repositories/UsersRepository.ts index a6b7ded715c..1ea9db4a9c3 100644 --- a/packages/orm/prisma/test/snapshots/generate_code/repositories/UsersRepository.ts +++ b/packages/orm/prisma/test/snapshots/generate_code/repositories/UsersRepository.ts @@ -18,8 +18,8 @@ export class UsersRepository { return this.collection.groupBy.bind(this.collection); } - deleteMany(args: Prisma.UserDeleteManyArgs) { - return this.collection.deleteMany(args); + protected deserialize(obj: null | User | User[]): T { + return deserialize(obj, {type: UserModel, collectionType: isArray(obj) ? Array : undefined}); } async findUnique(args: Prisma.UserFindUniqueArgs): Promise { @@ -57,8 +57,8 @@ export class UsersRepository { return this.deserialize(obj); } - protected deserialize(obj: null | User | User[]): T { - return deserialize(obj, {type: UserModel, collectionType: isArray(obj) ? Array : undefined}); + deleteMany(args: Prisma.UserDeleteManyArgs) { + return this.collection.deleteMany(args); } updateMany(args: Prisma.UserUpdateManyArgs) { diff --git a/packages/specs/schema/jest.config.js b/packages/specs/schema/jest.config.js index 5c7bff70c20..574aef53c33 100644 --- a/packages/specs/schema/jest.config.js +++ b/packages/specs/schema/jest.config.js @@ -6,10 +6,10 @@ module.exports = { roots: ["/src", "/test"], coverageThreshold: { global: { - statements: 99.46, - branches: 96.23, + statements: 99.45, + branches: 96.18, functions: 100, - lines: 99.46 + lines: 99.45 } }, moduleNameMapper: { diff --git a/packages/specs/schema/src/tsconfig.json b/packages/specs/schema/src/tsconfig.json deleted file mode 100644 index 5fa049fa6e5..00000000000 --- a/packages/specs/schema/src/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "@tsed/typescript/tsconfig.node.json", - "compilerOptions": { - "baseUrl": ".", - "module": "commonjs", - "rootDir": ".", - "declaration": false, - "composite": true, - "noEmit": true - }, - "include": ["**/*.ts", "**/*.json", "../**/*.ts", "../**/*.json"], - "exclude": ["node_modules", "lib"], - "references": [ - { - "path": "../" - } - ] -} diff --git a/packages/specs/schema/test/tsconfig.json b/packages/specs/schema/test/tsconfig.json deleted file mode 100644 index 5fa049fa6e5..00000000000 --- a/packages/specs/schema/test/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "@tsed/typescript/tsconfig.node.json", - "compilerOptions": { - "baseUrl": ".", - "module": "commonjs", - "rootDir": ".", - "declaration": false, - "composite": true, - "noEmit": true - }, - "include": ["**/*.ts", "**/*.json", "../**/*.ts", "../**/*.json"], - "exclude": ["node_modules", "lib"], - "references": [ - { - "path": "../" - } - ] -}