@athenna/http 3.11.0 → 4.0.0
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/package.json +238 -234
- package/src/{Decorators → annotations}/Controller.d.ts +1 -1
- package/src/{Decorators → annotations}/Controller.js +2 -0
- package/src/{Decorators → annotations}/Interceptor.d.ts +2 -2
- package/src/{Decorators → annotations}/Interceptor.js +5 -2
- package/src/{Decorators → annotations}/Middleware.d.ts +1 -1
- package/src/{Decorators → annotations}/Middleware.js +4 -1
- package/src/{Decorators → annotations}/Terminator.d.ts +2 -2
- package/src/{Decorators → annotations}/Terminator.js +5 -2
- package/src/{Commands → commands}/MakeControllerCommand.js +0 -1
- package/src/{Commands → commands}/MakeInterceptorCommand.js +0 -1
- package/src/{Commands → commands}/MakeMiddlewareCommand.js +0 -1
- package/src/{Commands → commands}/MakeTerminatorCommand.js +0 -1
- package/src/{Context → context}/Request.d.ts +1 -1
- package/src/{Context → context}/Request.js +0 -4
- package/src/{Context → context}/Response.d.ts +2 -2
- package/src/{Context → context}/Response.js +0 -4
- package/src/debug/index.d.ts +10 -0
- package/src/debug/index.js +10 -0
- package/src/{Exceptions → exceptions}/BadGatewayException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/BadGatewayException.js +1 -1
- package/src/{Exceptions → exceptions}/BadRequestException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/BadRequestException.js +1 -1
- package/src/{Exceptions → exceptions}/ForbiddenException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/ForbiddenException.js +1 -1
- package/src/{Exceptions → exceptions}/HttpException.d.ts +3 -2
- package/src/{Exceptions → exceptions}/InternalServerException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/InternalServerException.js +1 -1
- package/src/{Exceptions → exceptions}/MethodNotAllowedException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/MethodNotAllowedException.js +1 -1
- package/src/{Exceptions → exceptions}/NotAcceptableException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/NotAcceptableException.js +1 -1
- package/src/{Exceptions → exceptions}/NotFoundException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/NotFoundException.js +1 -1
- package/src/{Exceptions → exceptions}/NotImplementedException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/NotImplementedException.js +1 -1
- package/src/{Exceptions → exceptions}/PayloadTooLargeException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/PayloadTooLargeException.js +1 -1
- package/src/{Exceptions → exceptions}/RequestTimeoutException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/RequestTimeoutException.js +1 -1
- package/src/{Exceptions → exceptions}/ServiceUnavailableException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/ServiceUnavailableException.js +1 -1
- package/src/{Exceptions → exceptions}/UnauthorizedException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/UnauthorizedException.js +1 -1
- package/src/{Exceptions → exceptions}/UnprocessableEntityException.d.ts +1 -1
- package/src/{Exceptions → exceptions}/UnprocessableEntityException.js +1 -1
- package/src/{Facades → facades}/Route.d.ts +2 -2
- package/src/{Facades → facades}/Server.d.ts +2 -2
- package/src/{Handlers → handlers}/FastifyHandler.d.ts +4 -4
- package/src/{Handlers → handlers}/FastifyHandler.js +2 -2
- package/src/{Handlers → handlers}/HttpExceptionHandler.d.ts +1 -1
- package/src/{Handlers → handlers}/HttpExceptionHandler.js +6 -6
- package/src/index.d.ts +32 -40
- package/src/index.js +32 -40
- package/src/{Kernels → kernels}/HttpKernel.js +14 -1
- package/src/{Providers → providers}/HttpRouteProvider.js +1 -1
- package/src/{Providers → providers}/HttpServerProvider.js +1 -1
- package/src/{Router → router}/Route.d.ts +3 -9
- package/src/{Router → router}/Route.js +1 -5
- package/src/{Router → router}/RouteGroup.d.ts +3 -5
- package/src/{Router → router}/RouteGroup.js +2 -6
- package/src/{Router → router}/RouteResource.d.ts +2 -5
- package/src/{Router → router}/RouteResource.js +5 -13
- package/src/{Router → router}/Router.d.ts +7 -9
- package/src/{Router → router}/Router.js +15 -17
- package/src/{Server → server}/ServerImpl.d.ts +11 -14
- package/src/{Server → server}/ServerImpl.js +1 -9
- package/src/{Testing/Plugins → testing/plugins}/index.d.ts +5 -5
- package/src/{Testing/Plugins → testing/plugins}/index.js +5 -5
- package/src/{Testing/Plugins/Request → testing/plugins/request}/TestRequest.d.ts +2 -2
- package/src/{Testing/Plugins/Request → testing/plugins/request}/TestRequest.js +7 -5
- package/src/{Testing/Plugins/Request → testing/plugins/request}/TestResponse.d.ts +1 -1
- package/src/{Testing/Plugins/Request → testing/plugins/request}/TestResponse.js +1 -8
- package/src/{Types/Contexts → types/contexts}/Context.d.ts +2 -2
- package/src/types/contexts/Context.js +10 -0
- package/src/{Types/Contexts → types/contexts}/ErrorContext.d.ts +2 -2
- package/src/{Types/Contexts → types/contexts}/ErrorContext.js +2 -1
- package/src/{Types/Contexts → types/contexts}/InterceptContext.d.ts +2 -2
- package/src/{Types/Contexts → types/contexts}/InterceptContext.js +2 -1
- package/src/{Types/Contexts → types/contexts}/TerminateContext.d.ts +2 -2
- package/src/{Types/Contexts → types/contexts}/TerminateContext.js +2 -1
- package/src/{Contracts → types/contracts}/InterceptorContract.d.ts +1 -1
- package/src/{Contracts → types/contracts}/MiddlewareContract.d.ts +1 -1
- package/src/{Contracts → types/contracts}/TerminatorContract.d.ts +1 -1
- package/src/types/index.d.ts +24 -0
- package/src/types/index.js +24 -0
- package/src/{Types/Middlewares → types/middlewares}/InterceptorRouteType.d.ts +2 -2
- package/src/{Types/Middlewares → types/middlewares}/MiddlewareHandler.d.ts +3 -3
- package/src/{Types/Middlewares → types/middlewares}/MiddlewareRouteType.d.ts +2 -2
- package/src/{Types/Middlewares → types/middlewares}/TerminatorRouteType.d.ts +2 -2
- package/src/{Types/Router → types/router}/RouteHandler.d.ts +1 -1
- package/src/{Types/Router/RouteJSON.d.ts → types/router/RouteJson.d.ts} +3 -4
- package/src/Types/Router/RouteJSON.js +0 -9
- package/templates/controller.edge +0 -24
- package/templates/interceptor.edge +0 -8
- package/templates/middleware.edge +0 -6
- package/templates/terminator.edge +0 -6
- /package/src/{Commands → commands}/MakeControllerCommand.d.ts +0 -0
- /package/src/{Commands → commands}/MakeInterceptorCommand.d.ts +0 -0
- /package/src/{Commands → commands}/MakeMiddlewareCommand.d.ts +0 -0
- /package/src/{Commands → commands}/MakeTerminatorCommand.d.ts +0 -0
- /package/src/{Commands → commands}/RouteListCommand.d.ts +0 -0
- /package/src/{Commands → commands}/RouteListCommand.js +0 -0
- /package/src/{Exceptions → exceptions}/HttpException.js +0 -0
- /package/src/{Exceptions → exceptions}/UndefinedMethodException.d.ts +0 -0
- /package/src/{Exceptions → exceptions}/UndefinedMethodException.js +0 -0
- /package/src/{Facades → facades}/Route.js +0 -0
- /package/src/{Facades → facades}/Server.js +0 -0
- /package/src/{Kernels → kernels}/HttpKernel.d.ts +0 -0
- /package/src/{Providers → providers}/HttpRouteProvider.d.ts +0 -0
- /package/src/{Providers → providers}/HttpServerProvider.d.ts +0 -0
- /package/src/{Contracts → types/contracts}/InterceptorContract.js +0 -0
- /package/src/{Contracts → types/contracts}/MiddlewareContract.js +0 -0
- /package/src/{Contracts → types/contracts}/TerminatorContract.js +0 -0
- /package/src/{Types/Controllers → types/controllers}/ControllerOptions.d.ts +0 -0
- /package/src/{Types/Controllers → types/controllers}/ControllerOptions.js +0 -0
- /package/src/{Types/Middlewares → types/middlewares}/InterceptorRouteType.js +0 -0
- /package/src/{Types/Middlewares → types/middlewares}/MiddlewareHandler.js +0 -0
- /package/src/{Types/Middlewares → types/middlewares}/MiddlewareOptions.d.ts +0 -0
- /package/src/{Types/Middlewares → types/middlewares}/MiddlewareOptions.js +0 -0
- /package/src/{Types/Middlewares → types/middlewares}/MiddlewareRouteType.js +0 -0
- /package/src/{Types/Middlewares → types/middlewares}/TerminatorRouteType.js +0 -0
- /package/src/{Types/Router → types/router}/RouteHandler.js +0 -0
- /package/src/{Types/Contexts/Context.js → types/router/RouteJson.js} +0 -0
- /package/src/{Types/Router → types/router}/RouteResourceTypes.d.ts +0 -0
- /package/src/{Types/Router → types/router}/RouteResourceTypes.js +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @athenna/http
|
|
3
|
+
*
|
|
4
|
+
* (c) João Lenon <lenon@athenna.io>
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
export * from '#src/types/contexts/Context';
|
|
10
|
+
export * from '#src/types/contexts/ErrorContext';
|
|
11
|
+
export * from '#src/types/contexts/InterceptContext';
|
|
12
|
+
export * from '#src/types/contexts/TerminateContext';
|
|
13
|
+
export * from '#src/types/controllers/ControllerOptions';
|
|
14
|
+
export * from '#src/types/contracts/InterceptorContract';
|
|
15
|
+
export * from '#src/types/contracts/MiddlewareContract';
|
|
16
|
+
export * from '#src/types/contracts/TerminatorContract';
|
|
17
|
+
export * from '#src/types/middlewares/InterceptorRouteType';
|
|
18
|
+
export * from '#src/types/middlewares/MiddlewareHandler';
|
|
19
|
+
export * from '#src/types/middlewares/MiddlewareOptions';
|
|
20
|
+
export * from '#src/types/middlewares/MiddlewareRouteType';
|
|
21
|
+
export * from '#src/types/middlewares/TerminatorRouteType';
|
|
22
|
+
export * from '#src/types/router/RouteHandler';
|
|
23
|
+
export * from '#src/types/router/RouteJson';
|
|
24
|
+
export * from '#src/types/router/RouteResourceTypes';
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import type { InterceptorContract } from '#src/types/contracts/InterceptorContract';
|
|
10
|
+
import type { InterceptHandler } from '#src/types/middlewares/MiddlewareHandler';
|
|
11
11
|
export type InterceptorRouteType = string | InterceptHandler | InterceptorContract;
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import { Context } from '#src/
|
|
10
|
-
import { InterceptContext } from '#src/
|
|
11
|
-
import { TerminateContext } from '#src/
|
|
9
|
+
import type { Context } from '#src/types/contexts/Context';
|
|
10
|
+
import type { InterceptContext } from '#src/types/contexts/InterceptContext';
|
|
11
|
+
import type { TerminateContext } from '#src/types/contexts/TerminateContext';
|
|
12
12
|
export type HandleHandler = (ctx: Context) => any | Promise<any>;
|
|
13
13
|
export type InterceptHandler = (ctx: InterceptContext) => string | Record<string, any> | Record<string, any>[] | Promise<string> | Promise<Record<string, any>> | Promise<Record<string, any>[]>;
|
|
14
14
|
export type TerminateHandler = (ctx: TerminateContext) => any | Promise<any>;
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import type { MiddlewareContract } from '#src/types/contracts/MiddlewareContract';
|
|
10
|
+
import type { HandleHandler } from '#src/types/middlewares/MiddlewareHandler';
|
|
11
11
|
export type MiddlewareRouteType = string | HandleHandler | MiddlewareContract;
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import type { TerminatorContract } from '#src/types/contracts/TerminatorContract';
|
|
10
|
+
import type { TerminateHandler } from '#src/types/middlewares/MiddlewareHandler';
|
|
11
11
|
export type TerminatorRouteType = string | TerminateHandler | TerminatorContract;
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import { RequestHandler } from '#src/
|
|
9
|
+
import type { RequestHandler } from '#src/types/contexts/Context';
|
|
10
10
|
export type RouteHandler = string | RequestHandler;
|
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import { HTTPMethods, RouteOptions } from 'fastify';
|
|
10
|
-
import { RequestHandler } from '#src/
|
|
11
|
-
|
|
12
|
-
export type RouteJSON = {
|
|
9
|
+
import type { HTTPMethods, RouteOptions } from 'fastify';
|
|
10
|
+
import type { RequestHandler, MiddlewareRecord } from '#src/types';
|
|
11
|
+
export type RouteJson = {
|
|
13
12
|
url: string;
|
|
14
13
|
methods?: HTTPMethods[];
|
|
15
14
|
name?: string;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Context, Controller } from '@athenna/http'
|
|
2
|
-
|
|
3
|
-
@Controller()
|
|
4
|
-
export class {{ namePascal }} {
|
|
5
|
-
public async index({ response }: Context): Promise<void> {
|
|
6
|
-
return response.status(200).send([{}])
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
public async store({ response }: Context): Promise<void> {
|
|
10
|
-
return response.status(201).send({})
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public async show({ response }: Context): Promise<void> {
|
|
14
|
-
return response.status(200).send({})
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public async update({ response, params }: Context): Promise<void> {
|
|
18
|
-
return response.status(200).send({ id: params.id })
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public async delete({ response }: Context): Promise<void> {
|
|
22
|
-
return response.status(204)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|