diff --git a/bin/test.ts b/bin/test.ts index e8f13cd..65faa7f 100644 --- a/bin/test.ts +++ b/bin/test.ts @@ -16,5 +16,5 @@ await Runner.setTsEnv() .addReporter(specReporter()) .addPath('tests/unit/**/*.ts') .setCliArgs(process.argv.slice(2)) - .setGlobalTimeout(15000) + .setGlobalTimeout(30000) .run() diff --git a/package-lock.json b/package-lock.json index e518fab..c6263a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,26 +1,26 @@ { "name": "@athenna/core", - "version": "4.0.0", + "version": "4.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@athenna/core", - "version": "4.0.0", + "version": "4.1.0", "license": "MIT", "dependencies": { "pretty-repl": "^3.1.2", "semver": "^7.5.3" }, "devDependencies": { - "@athenna/artisan": "^4.1.0", - "@athenna/common": "^4.3.0", - "@athenna/config": "^4.2.0", - "@athenna/http": "^4.2.0", - "@athenna/ioc": "^4.0.0", - "@athenna/logger": "^4.1.0", - "@athenna/test": "^4.2.0", - "@athenna/view": "^4.0.0", + "@athenna/artisan": "^4.2.0", + "@athenna/common": "^4.4.0", + "@athenna/config": "^4.3.0", + "@athenna/http": "^4.3.0", + "@athenna/ioc": "^4.1.0", + "@athenna/logger": "^4.2.0", + "@athenna/test": "^4.3.0", + "@athenna/view": "^4.1.0", "@typescript-eslint/eslint-plugin": "^5.56.0", "@typescript-eslint/parser": "^5.56.0", "c8": "^7.12.0", @@ -70,9 +70,9 @@ "dev": true }, "node_modules/@athenna/artisan": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@athenna/artisan/-/artisan-4.1.0.tgz", - "integrity": "sha512-UUpbikbHx+pQKz+E6HfItXgSUSIOxzebDgHZHCWB0dd+x1OdklyT72zZSYwS3gjhryLgBmrMzdce+FhrDOuniw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@athenna/artisan/-/artisan-4.2.0.tgz", + "integrity": "sha512-shko3RVj71VtW/TUo4GxeSjS3aRn0D8NE/aJu52wyhsvKSMzelmbvozpZbDfgk2FuRE7uK60JqxH8LePoZPcOg==", "dev": true, "dependencies": { "chalk-rainbow": "^1.0.0", @@ -554,9 +554,9 @@ } }, "node_modules/@athenna/common": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/@athenna/common/-/common-4.3.0.tgz", - "integrity": "sha512-qAiR5OCMuS4rwhlf/JIpOtz/i3UKUNjYm9bL5qk52m5hPTHDFa+EqAZ8iqdYh5jWirHbVVp86RFpcMFRlkHI3g==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@athenna/common/-/common-4.5.0.tgz", + "integrity": "sha512-/Va3PtDRAR/FdfRuGYmuUXPGuOikqmXtGOENWVVbcHVu0PaXkZ8P9bqWngbyfBV+R2O0g2UVyzEXS7M6NP0JMg==", "dev": true, "dependencies": { "@fastify/formbody": "^7.4.0", @@ -584,9 +584,9 @@ } }, "node_modules/@athenna/config": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@athenna/config/-/config-4.2.0.tgz", - "integrity": "sha512-hUeoIZp7NnigATnhgNqDUjf73TbIKo5+mLQdN0WIUZWmtBMFy7c8NiNDEgxp4ZQNCCt2N3jgtqOE2BsiRaNPPw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@athenna/config/-/config-4.3.0.tgz", + "integrity": "sha512-UHSze3yy1avM4cC9TEmzdZ6s/ZAscWR/koThTnk6MOlaDApGGNrlbLZ1umOl21zxxfNm4+DZHzAhJxeuMkpdwg==", "dev": true, "dependencies": { "dotenv": "^16.3.1", @@ -595,27 +595,27 @@ } }, "node_modules/@athenna/http": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@athenna/http/-/http-4.2.0.tgz", - "integrity": "sha512-bJ1mv9GTFNY915vUiYY5iotWgrz3IVkP+QeUzdhTdGs9gOwixQLky9AKNtZUxKcbf5uhboJprYMidzjqmKLvjQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@athenna/http/-/http-4.3.0.tgz", + "integrity": "sha512-R843Pk1tFjqxffnncFSm8qQDTZGkpq8js7zl4yKqCugIkozI9uDXZcH4Ymk1ks/84LSNCVEaN0FD9SBZ/ULpoA==", "dev": true, "dependencies": { "fastify": "^4.21.0" } }, "node_modules/@athenna/ioc": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@athenna/ioc/-/ioc-4.0.0.tgz", - "integrity": "sha512-/akqOOOa++OE8fwESt113IcdWjauoWI0w7kv+COnk0zijSHsNkIxtBqJPOBo/8JJhj5iBHnzM67ZM4af9ae4TQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@athenna/ioc/-/ioc-4.1.0.tgz", + "integrity": "sha512-NSKi2QYSiQ2d+WxqdJf9reivIkCGQ0UQcsPZvaSi/kBOdqEXgxYbsx+9h7aJ8wWFVPbksQhRkIvW1rJYS4mfQw==", "dev": true, "dependencies": { "awilix": "^7.0.3" } }, "node_modules/@athenna/logger": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@athenna/logger/-/logger-4.1.0.tgz", - "integrity": "sha512-lpMUUSYvUZzY5BsfDWU5VPZQgvqQoJrAEBbMOFQifn21RXhbi3ir/8KHC37sG+Jr9OiCFvqDzNDNSuCmleO8OA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@athenna/logger/-/logger-4.2.0.tgz", + "integrity": "sha512-jDSYb6GRWRPLaUdyxbw9I/1mNR+OORIdkc0z0lf5gvEDKUJJ+CPbn0QKc7Yb8uW02DIuyHL15tAIVmuxRbLmHQ==", "dev": true, "dependencies": { "cls-rtracer": "^2.6.3", @@ -623,9 +623,9 @@ } }, "node_modules/@athenna/test": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@athenna/test/-/test-4.2.0.tgz", - "integrity": "sha512-PgyXCK+sQ1ZwsgfzEGuQmuMmfN1GpLuHguSTUE/MbkiHgZFkbl30I+E1lheIJ7KwWMTwtG3/4k+1T7U9UFuOnA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@athenna/test/-/test-4.4.0.tgz", + "integrity": "sha512-cMWz2ws9YbHD0EUGgeQpivaOnQOUQa2vglNPHNPkWNaBJimPm1dpX2tq/af2hYybD2FGmEqND5BP21YSRjBxdw==", "dev": true, "dependencies": { "@japa/assert": "^1.4.1", @@ -637,9 +637,9 @@ } }, "node_modules/@athenna/view": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@athenna/view/-/view-4.0.0.tgz", - "integrity": "sha512-V9fQbF4tbWmbXRwHYZ7bcBUY6pdoVQMjquseAhvK1mR7hfJsBomrIJoC5Ammxmzj4wm0za5VEtHDwrk+7xISpw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@athenna/view/-/view-4.1.0.tgz", + "integrity": "sha512-09zFsOCMoSGfxUzNXdfi1mYcMT6HTZ6MywXu1gCpfT0+gbom4YVrFLNCic/Vbu1oX4hjKxftldtC/fFwJHZpcg==", "dev": true, "dependencies": { "edge.js": "^5.5.1" diff --git a/package.json b/package.json index 29556de..9c267e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/core", - "version": "4.0.0", + "version": "4.1.0", "description": "The plug and play Node.js framework.", "license": "MIT", "author": "João Lenon ", @@ -67,14 +67,14 @@ "semver": "^7.5.3" }, "devDependencies": { - "@athenna/artisan": "^4.1.0", - "@athenna/common": "^4.3.0", - "@athenna/config": "^4.2.0", - "@athenna/http": "^4.2.0", - "@athenna/ioc": "^4.0.0", - "@athenna/logger": "^4.1.0", - "@athenna/test": "^4.2.0", - "@athenna/view": "^4.0.0", + "@athenna/artisan": "^4.2.0", + "@athenna/common": "^4.4.0", + "@athenna/config": "^4.3.0", + "@athenna/http": "^4.3.0", + "@athenna/ioc": "^4.1.0", + "@athenna/logger": "^4.2.0", + "@athenna/test": "^4.3.0", + "@athenna/view": "^4.1.0", "@typescript-eslint/eslint-plugin": "^5.56.0", "@typescript-eslint/parser": "^5.56.0", "c8": "^7.12.0", diff --git a/src/annotations/Service.ts b/src/annotations/Service.ts deleted file mode 100644 index a73335e..0000000 --- a/src/annotations/Service.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @athenna/http - * - * (c) João Lenon - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -import 'reflect-metadata' - -import { Options } from '@athenna/common' -import type { ServiceOptions } from '#src/types/ServiceOptions' - -/** - * Create a service inside the service provider. - */ -export function Service(options?: ServiceOptions): ClassDecorator { - return (target: any) => { - options = Options.create(options, { - alias: `App/Services/${target.name}`, - type: 'transient', - }) - - const alias = options.alias - const createCamelAlias = true - - if (ioc.hasDependency(alias)) { - return - } - - ioc[options.type](alias, target, createCamelAlias) - - Reflect.defineMetadata('provider:registered', true, target) - } -} diff --git a/src/commands/ReplCommand.ts b/src/commands/ReplCommand.ts index 3bed86f..e4dab5a 100644 --- a/src/commands/ReplCommand.ts +++ b/src/commands/ReplCommand.ts @@ -13,7 +13,7 @@ import { BaseCommand, Option } from '@athenna/artisan' export class ReplCommand extends BaseCommand { @Option({ signature: '-e, --env ', - description: 'Change the evironment where the application will run.', + description: 'Change the environment where the application will run.', default: '', }) public env: string diff --git a/src/commands/ServeCommand.ts b/src/commands/ServeCommand.ts index 995b915..73f47b6 100644 --- a/src/commands/ServeCommand.ts +++ b/src/commands/ServeCommand.ts @@ -13,7 +13,7 @@ import { BaseCommand, Option } from '@athenna/artisan' export class ServeCommand extends BaseCommand { @Option({ signature: '-e, --env ', - description: 'Change the evironment where the application will run.', + description: 'Change the environment where the application will run.', default: '', }) public env: string diff --git a/src/commands/TestCommand.ts b/src/commands/TestCommand.ts index 6be987c..abd78f4 100644 --- a/src/commands/TestCommand.ts +++ b/src/commands/TestCommand.ts @@ -13,7 +13,7 @@ import { BaseCommand, Option } from '@athenna/artisan' export class TestCommand extends BaseCommand { @Option({ signature: '-e, --env ', - description: 'Change the evironment where your tests wil run.', + description: 'Change the environment where your tests wil run.', default: 'test', }) public env: string diff --git a/src/index.ts b/src/index.ts index deadd59..905bceb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,8 +7,9 @@ * file that was distributed with this source code. */ +export * from './types/index.js' + export * from '#src/ignite/Ignite' export * from '#src/helpers/LoadHelper' -export * from '#src/annotations/Service' export * from '#src/providers/CoreProvider' diff --git a/src/providers/CoreProvider.ts b/src/providers/CoreProvider.ts index 69b9691..c047ce9 100644 --- a/src/providers/CoreProvider.ts +++ b/src/providers/CoreProvider.ts @@ -22,7 +22,7 @@ export class CoreProvider extends ServiceProvider { Config.get('rc.meta'), ) - if (Reflect.hasMetadata('provider:registered', Service)) { + if (Reflect.hasMetadata('ioc:registered', Service)) { return } diff --git a/templates/service.edge b/templates/service.edge index edb08a1..845ed35 100644 --- a/templates/service.edge +++ b/templates/service.edge @@ -1,4 +1,4 @@ -import { Service } from '@athenna/core' +import { Service } from '@athenna/ioc' @Service() export class {{ namePascal }} { diff --git a/tests/stubs/services/DecoratedWelcomeService.ts b/tests/stubs/services/DecoratedWelcomeService.ts index 7723d08..d9727c0 100644 --- a/tests/stubs/services/DecoratedWelcomeService.ts +++ b/tests/stubs/services/DecoratedWelcomeService.ts @@ -1,4 +1,4 @@ -import { Service } from '#src' +import { Service } from '@athenna/ioc' @Service() export class DecoratedWelcomeService { diff --git a/tests/unit/applications/ArtisanTest.ts b/tests/unit/applications/ArtisanTest.ts index 6ff9bbf..44c66fd 100644 --- a/tests/unit/applications/ArtisanTest.ts +++ b/tests/unit/applications/ArtisanTest.ts @@ -12,12 +12,11 @@ import { Log } from '@athenna/logger' import { Config } from '@athenna/config' import { File, Path } from '@athenna/common' import { ViewProvider } from '@athenna/view' -import { ExitFaker, Test } from '@athenna/test' -import type { Context } from '@athenna/test/types' import { ArtisanProvider } from '@athenna/artisan' import { BaseTest } from '#tests/helpers/BaseTest' import { Artisan } from '#src/applications/Artisan' import { CALLED_MAP } from '#tests/helpers/CalledMap' +import { Test, ExitFaker, type Context } from '@athenna/test' import { ConsoleKernel } from '#tests/stubs/kernels/ConsoleKernel' import { ConsoleExceptionHandler } from '#tests/stubs/handlers/ConsoleExceptionHandler' diff --git a/tests/unit/applications/HttpTest.ts b/tests/unit/applications/HttpTest.ts index a39988f..c3e3de1 100644 --- a/tests/unit/applications/HttpTest.ts +++ b/tests/unit/applications/HttpTest.ts @@ -8,13 +8,12 @@ */ import { fake } from 'sinon' -import { Test } from '@athenna/test' import { Log } from '@athenna/logger' import { Path } from '@athenna/common' import { Server } from '@athenna/http' import { Config } from '@athenna/config' import { Http } from '#src/applications/Http' -import type { Context } from '@athenna/test/types' +import { Test, type Context } from '@athenna/test' import { BaseTest } from '#tests/helpers/BaseTest' import { LoadHelper } from '#src/helpers/LoadHelper' import { CALLED_MAP } from '#tests/helpers/CalledMap' diff --git a/tests/unit/commands/MakeExceptionCommandTest.ts b/tests/unit/commands/MakeExceptionCommandTest.ts index e17d730..ed7be0b 100644 --- a/tests/unit/commands/MakeExceptionCommandTest.ts +++ b/tests/unit/commands/MakeExceptionCommandTest.ts @@ -9,8 +9,7 @@ import { File } from '@athenna/common' import { Artisan } from '@athenna/artisan' -import { ExitFaker, Test } from '@athenna/test' -import type { Context } from '@athenna/test/types' +import { Test, ExitFaker, type Context } from '@athenna/test' import { BaseCommandTest } from '#tests/helpers/BaseCommandTest' export default class MakeExceptionCommandTest extends BaseCommandTest { diff --git a/tests/unit/commands/MakeFacadeCommandTest.ts b/tests/unit/commands/MakeFacadeCommandTest.ts index cc361a0..0c64097 100644 --- a/tests/unit/commands/MakeFacadeCommandTest.ts +++ b/tests/unit/commands/MakeFacadeCommandTest.ts @@ -9,8 +9,7 @@ import { File } from '@athenna/common' import { Artisan } from '@athenna/artisan' -import { ExitFaker, Test } from '@athenna/test' -import type { Context } from '@athenna/test/types' +import { Test, ExitFaker, type Context } from '@athenna/test' import { BaseCommandTest } from '#tests/helpers/BaseCommandTest' export default class MakeFacadeCommandTest extends BaseCommandTest { diff --git a/tests/unit/commands/MakeProviderCommandTest.ts b/tests/unit/commands/MakeProviderCommandTest.ts index af265b3..f34d628 100644 --- a/tests/unit/commands/MakeProviderCommandTest.ts +++ b/tests/unit/commands/MakeProviderCommandTest.ts @@ -10,8 +10,7 @@ import { File } from '@athenna/common' import { Config } from '@athenna/config' import { Artisan } from '@athenna/artisan' -import { ExitFaker, Test } from '@athenna/test' -import type { Context } from '@athenna/test/types' +import { Test, ExitFaker, type Context } from '@athenna/test' import { BaseCommandTest } from '#tests/helpers/BaseCommandTest' export default class MakeProviderCommandTest extends BaseCommandTest { diff --git a/tests/unit/commands/MakeServiceCommandTest.ts b/tests/unit/commands/MakeServiceCommandTest.ts index 0a752e5..7d20e57 100644 --- a/tests/unit/commands/MakeServiceCommandTest.ts +++ b/tests/unit/commands/MakeServiceCommandTest.ts @@ -10,8 +10,7 @@ import { File } from '@athenna/common' import { Config } from '@athenna/config' import { Artisan } from '@athenna/artisan' -import { ExitFaker, Test } from '@athenna/test' -import type { Context } from '@athenna/test/types' +import { Test, ExitFaker, type Context } from '@athenna/test' import { BaseCommandTest } from '#tests/helpers/BaseCommandTest' export default class MakeServiceCommandTest extends BaseCommandTest { diff --git a/tests/unit/commands/MakeTestCommandTest.ts b/tests/unit/commands/MakeTestCommandTest.ts index d5bbe7f..5468f30 100644 --- a/tests/unit/commands/MakeTestCommandTest.ts +++ b/tests/unit/commands/MakeTestCommandTest.ts @@ -9,8 +9,7 @@ import { File } from '@athenna/common' import { Artisan } from '@athenna/artisan' -import { ExitFaker, Test } from '@athenna/test' -import type { Context } from '@athenna/test/types' +import { Test, ExitFaker, type Context } from '@athenna/test' import { BaseCommandTest } from '#tests/helpers/BaseCommandTest' export default class MakeTestCommandTest extends BaseCommandTest { diff --git a/tests/unit/commands/ReplCommandTest.ts b/tests/unit/commands/ReplCommandTest.ts index 2a3819e..bc92d7b 100644 --- a/tests/unit/commands/ReplCommandTest.ts +++ b/tests/unit/commands/ReplCommandTest.ts @@ -7,9 +7,8 @@ * file that was distributed with this source code. */ -import { Test } from '@athenna/test' import { Artisan } from '@athenna/artisan' -import type { Context } from '@athenna/test/types' +import { Test, type Context } from '@athenna/test' import { BaseCommandTest } from '#tests/helpers/BaseCommandTest' export default class ReplCommandTest extends BaseCommandTest { diff --git a/tests/unit/commands/ServeCommandTest.ts b/tests/unit/commands/ServeCommandTest.ts index 06a770c..b442df3 100644 --- a/tests/unit/commands/ServeCommandTest.ts +++ b/tests/unit/commands/ServeCommandTest.ts @@ -7,9 +7,8 @@ * file that was distributed with this source code. */ -import { Test } from '@athenna/test' import { Artisan } from '@athenna/artisan' -import type { Context } from '@athenna/test/types' +import { Test, type Context } from '@athenna/test' import { BaseCommandTest } from '#tests/helpers/BaseCommandTest' export default class ServeCommandTest extends BaseCommandTest { diff --git a/tests/unit/commands/TestCommandTest.ts b/tests/unit/commands/TestCommandTest.ts index b6ff4e5..aa0f055 100644 --- a/tests/unit/commands/TestCommandTest.ts +++ b/tests/unit/commands/TestCommandTest.ts @@ -7,9 +7,8 @@ * file that was distributed with this source code. */ -import { Test } from '@athenna/test' import { Artisan } from '@athenna/artisan' -import type { Context } from '@athenna/test/types' +import { Test, type Context } from '@athenna/test' import { BaseCommandTest } from '#tests/helpers/BaseCommandTest' export default class TestCommandTest extends BaseCommandTest { diff --git a/tests/unit/helpers/LoadHelperTest.ts b/tests/unit/helpers/LoadHelperTest.ts index b3c3fa5..c6f9935 100644 --- a/tests/unit/helpers/LoadHelperTest.ts +++ b/tests/unit/helpers/LoadHelperTest.ts @@ -10,10 +10,9 @@ import { fake } from 'sinon' import { LoadHelper } from '#src' import { Log } from '@athenna/logger' -import { BeforeEach, Test } from '@athenna/test' -import type { Context } from '@athenna/test/types' import { BaseTest } from '#tests/helpers/BaseTest' import { CALLED_MAP } from '#tests/helpers/CalledMap' +import { Test, BeforeEach, type Context } from '@athenna/test' export default class LoadHelperTest extends BaseTest { @BeforeEach() diff --git a/tests/unit/ignite/IgniteTest.ts b/tests/unit/ignite/IgniteTest.ts index fc340d4..03e8c59 100644 --- a/tests/unit/ignite/IgniteTest.ts +++ b/tests/unit/ignite/IgniteTest.ts @@ -11,10 +11,9 @@ import { fake } from 'sinon' import { Ignite } from '#src' import { Server } from '@athenna/http' import { pathToFileURL } from 'node:url' -import { ExitFaker, Test } from '@athenna/test' import { BaseTest } from '#tests/helpers/BaseTest' import { Exec, File, Json } from '@athenna/common' -import type { Context } from '@athenna/test/types' +import { Test, ExitFaker, type Context } from '@athenna/test' export default class IgniteTest extends BaseTest { @Test()