use ports package

This commit is contained in:
admin 2025-08-23 23:17:44 +02:00
parent 737d69e788
commit bdaacf5ff2
5 changed files with 15 additions and 17 deletions

11
package-lock.json generated
View File

@ -1,14 +1,15 @@
{ {
"name": "@apihub24/password-hasher", "name": "@apihub24/password-hasher",
"version": "1.0.8", "version": "1.0.9",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@apihub24/password-hasher", "name": "@apihub24/password-hasher",
"version": "1.0.8", "version": "1.0.9",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@apihub24/authentication": "^1.0.1",
"@apihub24/token-authentication": "^1.0.4", "@apihub24/token-authentication": "^1.0.4",
"@nestjs/common": "^11.1.6", "@nestjs/common": "^11.1.6",
"@nestjs/config": "^4.0.2", "@nestjs/config": "^4.0.2",
@ -37,6 +38,12 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/@apihub24/authentication": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@apihub24/authentication/-/authentication-1.0.1.tgz",
"integrity": "sha512-nWw75ofQKHxE0dI7PzvNBQNcQrX/HSrzuAJTYNu42BoCROba1NUz8QAodTn5+3dIeQEzw127gtSb6D7yW0B8Jg==",
"license": "MIT"
},
"node_modules/@apihub24/repository": { "node_modules/@apihub24/repository": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/@apihub24/repository/-/repository-1.0.3.tgz", "resolved": "https://registry.npmjs.org/@apihub24/repository/-/repository-1.0.3.tgz",

View File

@ -1,6 +1,6 @@
{ {
"name": "@apihub24/password-hasher", "name": "@apihub24/password-hasher",
"version": "1.0.8", "version": "1.0.9",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@ -14,7 +14,7 @@
"dependencies": { "dependencies": {
"@nestjs/common": "^11.1.6", "@nestjs/common": "^11.1.6",
"@nestjs/config": "^4.0.2", "@nestjs/config": "^4.0.2",
"@apihub24/token-authentication": "^1.0.4", "@apihub24/authentication": "^1.0.1",
"bcrypt": "^6.0.0" "bcrypt": "^6.0.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,4 +1,4 @@
import { IPasswordService } from "@apihub24/token-authentication"; import { IPasswordService } from "@apihub24/authentication";
import { Inject, Injectable } from "@nestjs/common"; import { Inject, Injectable } from "@nestjs/common";
import { ConfigService } from "@nestjs/config"; import { ConfigService } from "@nestjs/config";
import bcrypt from "bcrypt"; import bcrypt from "bcrypt";

View File

@ -1,8 +1,5 @@
import { Test, TestingModule } from "@nestjs/testing"; import { Test, TestingModule } from "@nestjs/testing";
import { import { PasswordHasherModule } from "./";
APIHUB24_PASSWORD_SERVICE_INJECTION_KEY,
PasswordHasherModule,
} from "./";
describe("PasswordHasherModule Tests", () => { describe("PasswordHasherModule Tests", () => {
let module: TestingModule | null = null; let module: TestingModule | null = null;
@ -13,10 +10,6 @@ describe("PasswordHasherModule Tests", () => {
}).compile(); }).compile();
}); });
it("should export injection Key", () => {
expect(APIHUB24_PASSWORD_SERVICE_INJECTION_KEY).toBeDefined();
});
it("should get PasswordHasherService by injection Key @apihub24/password_service", () => { it("should get PasswordHasherService by injection Key @apihub24/password_service", () => {
expect(module).toBeDefined(); expect(module).toBeDefined();
const service = module?.get("@apihub24/password_service"); const service = module?.get("@apihub24/password_service");

View File

@ -1,9 +1,7 @@
import { DynamicModule, Global, Module } from "@nestjs/common"; import { DynamicModule, Global, Module } from "@nestjs/common";
import { PasswordHashService } from "./password.hash.service"; import { PasswordHashService } from "./password.hash.service";
import { ConfigModule } from "@nestjs/config"; import { ConfigModule } from "@nestjs/config";
import { APIHUB24_PASSWORD_SERVICE } from "@apihub24/authentication";
export const APIHUB24_PASSWORD_SERVICE_INJECTION_KEY =
"@apihub24/password_service";
@Global() @Global()
@Module({}) @Module({})
@ -11,7 +9,7 @@ export class PasswordHasherModule {
static forRoot(): DynamicModule { static forRoot(): DynamicModule {
const providers = [ const providers = [
{ {
provide: APIHUB24_PASSWORD_SERVICE_INJECTION_KEY, provide: APIHUB24_PASSWORD_SERVICE,
useClass: PasswordHashService, useClass: PasswordHashService,
}, },
]; ];