raiton 6.6.0-beta.14 → 6.7.0-beta.15
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/CHANGELOG.md +10 -0
- package/README.md +16 -9
- package/build/bin/index.mjs +8170 -3997
- package/deno.json +4 -1
- package/docs/contributors/framework/README.md +2 -0
- package/docs/contributors/framework/cache/README.md +55 -0
- package/docs/contributors/framework/cache/cache.md +86 -0
- package/docs/contributors/framework/cache/etag.md +82 -0
- package/docs/contributors/framework/decorators/README.md +1 -0
- package/docs/contributors/framework/runtime.md +13 -3
- package/docs/user-guide/README.md +1 -0
- package/docs/user-guide/cache.md +79 -0
- package/docs/user-guide/cli.md +35 -3
- package/docs/user-guide/decorators/README.md +1 -0
- package/docs/user-guide/decorators/cache.md +79 -0
- package/docs/user-guide/runtime.md +2 -1
- package/package.json +8 -3
- package/source/bin/bootstrapper.ts +4 -4
- package/source/bin/cli-tools.ts +27 -3
- package/source/bin/cli.ts +2 -2
- package/source/bin/commands.registry.ts +17 -0
- package/source/bin/constants.ts +1 -0
- package/source/bin/index.ts +2 -2
- package/source/commands/artifact.command.ts +2 -2
- package/source/commands/build.command.ts +2 -2
- package/source/commands/develop.command.ts +4 -5
- package/source/commands/grafts.command.ts +1 -1
- package/source/commands/start.command.ts +2 -2
- package/source/core/application.ts +10 -10
- package/source/core/artifacts/artifact.ts +1 -1
- package/source/core/artifacts/index.ts +1 -1
- package/source/core/builder.ts +69 -15
- package/source/core/bytes.util.ts +1 -1
- package/source/core/commands.ts +24 -14
- package/source/core/config/config.ts +2 -2
- package/source/core/config/define.ts +2 -2
- package/source/core/config/index.ts +2 -2
- package/source/core/context.ts +1 -1
- package/source/core/controller/builder.ts +9 -9
- package/source/core/controller/compiler.ts +6 -6
- package/source/core/controller/index.ts +4 -4
- package/source/core/controller/metadata.ts +2 -2
- package/source/core/controller/tracker.ts +1 -1
- package/source/core/directories.ts +3 -2
- package/source/core/guards.ts +1 -1
- package/source/core/helpers/index.ts +1 -1
- package/source/core/hooks.ts +1 -1
- package/source/core/index.ts +16 -16
- package/source/core/injection/index.ts +1 -1
- package/source/core/injection/injection.ts +3 -3
- package/source/core/mcp/builder.ts +8 -8
- package/source/core/mcp/index.ts +3 -3
- package/source/core/mcp/metadata.ts +2 -2
- package/source/core/mcp/tracker.ts +1 -1
- package/source/core/middleware/compose.ts +2 -2
- package/source/core/middleware/index.ts +2 -2
- package/source/core/middleware/pipeline.ts +2 -2
- package/source/core/plugins/index.ts +2 -2
- package/source/core/plugins/plugin.ts +1 -1
- package/source/core/plugins/scope.ts +4 -4
- package/source/core/raiton.ts +1 -1
- package/source/core/router/handler.ts +30 -6
- package/source/core/router/handler.utils.ts +3 -3
- package/source/core/router/index.ts +4 -4
- package/source/core/router/matcher.ts +1 -1
- package/source/core/router/route.ts +1 -1
- package/source/core/router/router.ts +4 -4
- package/source/core/server.ts +1 -1
- package/source/core/socket/builder.ts +2 -2
- package/source/core/socket/index.ts +2 -2
- package/source/core/socket/metadata.ts +2 -2
- package/source/core/thread.ts +51 -22
- package/source/framework/artifacts.ts +5 -5
- package/source/framework/cache/cache.decorator.ts +35 -0
- package/source/framework/cache/cache.ts +197 -0
- package/source/framework/cache/etag.ts +174 -0
- package/source/framework/cache/index.ts +4 -0
- package/source/framework/cache/types.ts +111 -0
- package/source/framework/constants/decorators.constant.ts +2 -0
- package/source/framework/constants/index.ts +2 -2
- package/source/framework/decorators/access-guard.decorator.ts +2 -2
- package/source/framework/decorators/api-response.decorator.ts +1 -1
- package/source/framework/decorators/api.decorator.ts +1 -1
- package/source/framework/decorators/controllable.decorator.ts +3 -3
- package/source/framework/decorators/csrf-guard.decorator.ts +4 -4
- package/source/framework/decorators/csrf-token.decorator.ts +1 -1
- package/source/framework/decorators/guard.decorator.ts +4 -4
- package/source/framework/decorators/health-check.decorator.ts +3 -3
- package/source/framework/decorators/index.ts +14 -14
- package/source/framework/decorators/injection.decorator.ts +3 -3
- package/source/framework/decorators/mcp.decorator.ts +4 -4
- package/source/framework/decorators/middleware.decorator.ts +2 -2
- package/source/framework/decorators/parametrable.decorator.ts +2 -2
- package/source/framework/decorators/routable.decorator.ts +3 -3
- package/source/framework/decorators/route-interaction.decorator.ts +4 -4
- package/source/framework/decorators/socket.decorator.ts +3 -3
- package/source/framework/encryption.ts +2 -2
- package/source/framework/enums/index.ts +8 -8
- package/source/framework/enums/runtime.enum.ts +1 -2
- package/source/framework/env.ts +2 -2
- package/source/framework/exceptions/http-exception.ts +3 -3
- package/source/framework/exceptions/index.ts +2 -2
- package/source/framework/health-check.ts +4 -4
- package/source/framework/index.ts +18 -17
- package/source/framework/mcp/handler.ts +3 -3
- package/source/framework/mcp/index.ts +3 -3
- package/source/framework/mcp/protocol.ts +1 -1
- package/source/framework/mcp/streamable-http.ts +3 -3
- package/source/framework/parameter-bag.ts +2 -2
- package/source/framework/plugins/body-parser.plugin.ts +3 -3
- package/source/framework/plugins/index.ts +4 -4
- package/source/framework/plugins/mcp.plugin.ts +5 -5
- package/source/framework/plugins/openapi.plugin.ts +4 -4
- package/source/framework/plugins/security/body-limit.ts +3 -3
- package/source/framework/plugins/security/cors.ts +2 -2
- package/source/framework/plugins/security/csrf.ts +6 -6
- package/source/framework/plugins/security/headers.ts +2 -2
- package/source/framework/plugins/security/index.ts +6 -6
- package/source/framework/plugins/security/method-guard.ts +3 -3
- package/source/framework/plugins/security/rate-limit.ts +3 -3
- package/source/framework/repositories.ts +1 -1
- package/source/framework/responses/error.ts +2 -2
- package/source/framework/responses/helpers.ts +3 -3
- package/source/framework/responses/http-throwable.ts +3 -3
- package/source/framework/responses/http.ts +3 -3
- package/source/framework/responses/index.ts +4 -4
- package/source/framework/runtime/bun/server.ts +5 -5
- package/source/framework/runtime/deno/server.ts +156 -96
- package/source/framework/runtime/index.ts +11 -17
- package/source/framework/runtime/node/reply.ts +1 -1
- package/source/framework/runtime/node/request.ts +2 -2
- package/source/framework/runtime/node/server.ts +3 -3
- package/source/framework/runtime/web/server.ts +2 -2
- package/source/framework/services.ts +1 -1
- package/source/framework/utilities/csrf.util.ts +1 -1
- package/source/framework/utilities/index.ts +10 -10
- package/source/framework/utilities/openapi.utils.ts +7 -7
- package/source/framework/utilities/utilities.util.ts +1 -1
- package/source/types/application.ts +2 -2
- package/source/types/builder.ts +1 -1
- package/source/types/config.ts +1 -1
- package/source/types/controller.ts +3 -3
- package/source/types/core.ts +1 -1
- package/source/types/csrf.ts +1 -1
- package/source/types/guard.ts +1 -1
- package/source/types/http-responses.ts +1 -1
- package/source/types/index.ts +26 -26
- package/source/types/injection.ts +1 -1
- package/source/types/middleware.ts +1 -1
- package/source/types/plugin.ts +1 -1
- package/source/types/raiton.ts +1 -1
- package/source/types/responses.ts +2 -2
- package/source/types/router.ts +2 -2
- package/source/types/runtime.ts +3 -5
- package/source/types/thread.ts +4 -4
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type {RequestContext} from "../../core/context.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options de configuration du système de cache de routes et des ETag.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type CacheKeyCallable = (context: RequestContext, route?: string) => string | Promise<string>;
|
|
8
|
+
|
|
9
|
+
export interface ETagOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Active ou désactive la génération d'ETag. (défaut: `true`)
|
|
12
|
+
*/
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Marqueur d'ETag faible (`W/"..."`). Les ETag faibles permettent les réponses
|
|
17
|
+
* équivalentes mais pas identiques octet pour octet. (défaut: `false`)
|
|
18
|
+
*/
|
|
19
|
+
weak?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Fonction de hachage personnalisée. Reçoit le corps sérialisé et renvoie
|
|
23
|
+
* une chaîne qui servira de valeur d'ETag. (défaut: hachage FNV-1a interne)
|
|
24
|
+
*/
|
|
25
|
+
algorithm?: (body: string) => string | Promise<string>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Ajoute automatiquement un en-tête `Cache-Control` adapté aux ETag.
|
|
29
|
+
* Peut être un booléen ou un objet de contrôle fin. (défaut: `false`)
|
|
30
|
+
*/
|
|
31
|
+
cacheControl?: boolean | {
|
|
32
|
+
maxAge?: number;
|
|
33
|
+
public?: boolean;
|
|
34
|
+
noCache?: boolean;
|
|
35
|
+
noStore?: boolean;
|
|
36
|
+
mustRevalidate?: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Nom de l'en-tête de réponse qui portera la valeur d'ETag. (défaut: `ETag`)
|
|
41
|
+
*/
|
|
42
|
+
headerName?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Prédicat permettant d'exclure certaines réponses ou requêtes de la
|
|
46
|
+
* génération d'ETag. Renvoie `true` pour sauter la génération.
|
|
47
|
+
*/
|
|
48
|
+
skip?: (context: RequestContext, body: any) => boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ETagResult {
|
|
52
|
+
tag: string;
|
|
53
|
+
body: any;
|
|
54
|
+
notModified: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface CacheOptions {
|
|
58
|
+
/**
|
|
59
|
+
* Durée de validité en millisecondes. (défaut: `60_000`)
|
|
60
|
+
*/
|
|
61
|
+
ttl?: number;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Active ou désactive la mise en cache de la route. (défaut: `true`)
|
|
65
|
+
*/
|
|
66
|
+
enabled?: boolean;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Nombre maximum d'entrées du cache en mémoire. (défaut: `1000`)
|
|
70
|
+
*/
|
|
71
|
+
maxEntries?: number;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Fonction de calcul de la clé de cache. Reçoit le contexte de requête.
|
|
75
|
+
* (défaut: méthode + URL sans query)
|
|
76
|
+
*/
|
|
77
|
+
key?: CacheKeyCallable;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* En-têtes de requête dont la valeur doit participer à la construction de
|
|
81
|
+
* la clé de cache (segmentation du cache par acceptation de contenu…).
|
|
82
|
+
*/
|
|
83
|
+
vary?: string[];
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Ne met en cache que pour certaines méthodes HTTP. (défaut: `['GET', 'HEAD']`)
|
|
87
|
+
*/
|
|
88
|
+
methods?: string[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface CacheEntry<T = any> {
|
|
92
|
+
body: T;
|
|
93
|
+
status: number;
|
|
94
|
+
headers: Record<string, string>;
|
|
95
|
+
expiresAt: number;
|
|
96
|
+
createdAt: number;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface CacheStore {
|
|
100
|
+
get<T = any>(key: string): CacheEntry<T> | undefined;
|
|
101
|
+
|
|
102
|
+
set<T = any>(key: string, entry: CacheEntry<T>, ttl?: number): void;
|
|
103
|
+
|
|
104
|
+
has(key: string): boolean;
|
|
105
|
+
|
|
106
|
+
delete(key: string): boolean;
|
|
107
|
+
|
|
108
|
+
clear(): void;
|
|
109
|
+
|
|
110
|
+
size(): number;
|
|
111
|
+
}
|
|
@@ -18,6 +18,8 @@ export const METADATA_KEYS = {
|
|
|
18
18
|
API_PROPERTY: Symbol('api:property'),
|
|
19
19
|
// Route interaction metadata key
|
|
20
20
|
ROUTE_INTERACTION: Symbol('route:interaction'),
|
|
21
|
+
// Route cache metadata key
|
|
22
|
+
CACHE: Symbol('route:cache'),
|
|
21
23
|
// Health check metadata key
|
|
22
24
|
HEALTH_CHECK: Symbol('health:check'),
|
|
23
25
|
// MCP metadata keys
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./decorators.constant"
|
|
2
|
-
export * from "./microservices.constant"
|
|
1
|
+
export * from "./decorators.constant.ts"
|
|
2
|
+
export * from "./microservices.constant.ts"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// import {IAccessGuardDeclaration} from "../../types";
|
|
2
|
-
// import {SYSTEM_DECORATORS_KEYS} from "../constants";
|
|
1
|
+
// import {IAccessGuardDeclaration} from "../../types/index.ts";
|
|
2
|
+
// import {SYSTEM_DECORATORS_KEYS} from "../constants/index.ts";
|
|
3
3
|
//
|
|
4
4
|
// export function AccessGuard(declaration: IAccessGuardDeclaration){
|
|
5
5
|
// return (target: any, methodKey: any)=> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {getControllerMetadata} from "../../core/controller";
|
|
2
|
-
import {Injectable} from "
|
|
1
|
+
import {getControllerMetadata} from "../../core/controller/index.ts";
|
|
2
|
+
import {Injectable} from "../index.ts";
|
|
3
3
|
import {LifetimeEnum} from "@protorians/core";
|
|
4
|
-
import {ControllerDecoratorCallable} from "../../types";
|
|
4
|
+
import {ControllerDecoratorCallable} from "../../types/index.ts";
|
|
5
5
|
|
|
6
6
|
export function Controllable(prefix = '') {
|
|
7
7
|
return (target: any) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {MiddlewareParametersInterface, CsrfGuardOptions} from "../../types";
|
|
2
|
-
import {Middleware} from "./middleware.decorator";
|
|
3
|
-
import {HttpStatus, RaitonResponses} from "
|
|
4
|
-
import {CsrfUtil} from "../utilities/csrf.util";
|
|
1
|
+
import {MiddlewareParametersInterface, CsrfGuardOptions} from "../../types/index.ts";
|
|
2
|
+
import {Middleware} from "./middleware.decorator.ts";
|
|
3
|
+
import {HttpStatus, RaitonResponses} from "../index.ts";
|
|
4
|
+
import {CsrfUtil} from "../utilities/csrf.util.ts";
|
|
5
5
|
|
|
6
6
|
const DEFAULT_METHODS = ['POST', 'PUT', 'PATCH', 'DELETE']
|
|
7
7
|
const DEFAULT_HEADER_NAME = 'X-CSRF-Token'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {GuardOptions} from "../../types";
|
|
2
|
-
import {Middleware} from "./middleware.decorator";
|
|
3
|
-
import {RaitonGuards} from "../../core/guards";
|
|
4
|
-
import {HttpStatus, RaitonResponses} from "
|
|
1
|
+
import {GuardOptions} from "../../types/index.ts";
|
|
2
|
+
import {Middleware} from "./middleware.decorator.ts";
|
|
3
|
+
import {RaitonGuards} from "../../core/guards.ts";
|
|
4
|
+
import {HttpStatus, RaitonResponses} from "../index.ts";
|
|
5
5
|
|
|
6
6
|
export function createGuardDecoration({name, handler}: GuardOptions) {
|
|
7
7
|
return Middleware(async ({next, context}) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import {METADATA_KEYS} from "../constants/decorators.constant";
|
|
3
|
-
import {getControllerMetadata} from "../../core/controller";
|
|
4
|
-
import {RouteMetaInterface} from "../../types";
|
|
2
|
+
import {METADATA_KEYS} from "../constants/decorators.constant.ts";
|
|
3
|
+
import {getControllerMetadata} from "../../core/controller/index.ts";
|
|
4
|
+
import {RouteMetaInterface} from "../../types/index.ts";
|
|
5
5
|
|
|
6
6
|
export interface HealthCheckOptions {
|
|
7
7
|
path?: string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * from "./controllable.decorator"
|
|
2
|
-
export * from "./socket.decorator"
|
|
3
|
-
export * from "./middleware.decorator"
|
|
4
|
-
export * from "./routable.decorator"
|
|
5
|
-
export * from "./parametrable.decorator"
|
|
6
|
-
export * from "./injection.decorator"
|
|
7
|
-
export * from "./guard.decorator"
|
|
8
|
-
export * from "./csrf-guard.decorator"
|
|
9
|
-
export * from "./csrf-token.decorator"
|
|
10
|
-
export * from "./api-response.decorator"
|
|
11
|
-
export * from "./api.decorator"
|
|
12
|
-
export * from "./route-interaction.decorator"
|
|
13
|
-
export * from "./health-check.decorator"
|
|
14
|
-
export * from "./mcp.decorator"
|
|
1
|
+
export * from "./controllable.decorator.ts"
|
|
2
|
+
export * from "./socket.decorator.ts"
|
|
3
|
+
export * from "./middleware.decorator.ts"
|
|
4
|
+
export * from "./routable.decorator.ts"
|
|
5
|
+
export * from "./parametrable.decorator.ts"
|
|
6
|
+
export * from "./injection.decorator.ts"
|
|
7
|
+
export * from "./guard.decorator.ts"
|
|
8
|
+
export * from "./csrf-guard.decorator.ts"
|
|
9
|
+
export * from "./csrf-token.decorator.ts"
|
|
10
|
+
export * from "./api-response.decorator.ts"
|
|
11
|
+
export * from "./api.decorator.ts"
|
|
12
|
+
export * from "./route-interaction.decorator.ts"
|
|
13
|
+
export * from "./health-check.decorator.ts"
|
|
14
|
+
export * from "./mcp.decorator.ts"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import type {ConstructorType} from "../../types/contruct";
|
|
3
|
-
import {Injection} from "../../core/injection";
|
|
2
|
+
import type {ConstructorType} from "../../types/contruct.ts";
|
|
3
|
+
import {Injection} from "../../core/injection/index.ts";
|
|
4
4
|
import {LifetimeEnum} from "@protorians/core";
|
|
5
5
|
import {Logger} from "@protorians/logger";
|
|
6
|
-
import {METADATA_KEYS} from "../constants";
|
|
6
|
+
import {METADATA_KEYS} from "../constants/index.ts";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
export function Injectable(lifetime?: LifetimeEnum, name?: string, scope?: any) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import {registerMcpServer, unregisterMcpServer, getMcpServerMetadata} from "../../core/mcp";
|
|
3
|
-
import {Injectable} from ".";
|
|
2
|
+
import {registerMcpServer, unregisterMcpServer, getMcpServerMetadata} from "../../core/mcp/index.ts";
|
|
3
|
+
import {Injectable} from "./index.ts";
|
|
4
4
|
import {LifetimeEnum} from "@protorians/core";
|
|
5
|
-
import {METADATA_KEYS} from "../constants";
|
|
5
|
+
import {METADATA_KEYS} from "../constants/index.ts";
|
|
6
6
|
import type {
|
|
7
7
|
McpArgumentMetaInterface,
|
|
8
8
|
McpArgumentSchema,
|
|
9
9
|
McpElementMetaInterface,
|
|
10
10
|
McpElementType,
|
|
11
11
|
McpServerOptionsInterface,
|
|
12
|
-
} from "../../types";
|
|
12
|
+
} from "../../types/index.ts";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Decorate a class as an MCP server. The class methods decorated with
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {MiddlewareCallable} from "../../types";
|
|
2
|
-
import {getControllerMetadata} from "../../core";
|
|
1
|
+
import {MiddlewareCallable} from "../../types/index.ts";
|
|
2
|
+
import {getControllerMetadata} from "../../core/index.ts";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export function Middleware(middleware: MiddlewareCallable) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import type {ContextInterface, ParamMetaInterface} from "../../types";
|
|
3
|
-
import {METADATA_KEYS, Parametrable} from "
|
|
2
|
+
import type {ContextInterface, ParamMetaInterface} from "../../types/index.ts";
|
|
3
|
+
import {METADATA_KEYS, Parametrable} from "../index.ts";
|
|
4
4
|
|
|
5
5
|
function createRouteParametrableDecorator(type: ParamMetaInterface['type'], callable?: (context: ContextInterface) => any) {
|
|
6
6
|
return (key?: string) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {getControllerMetadata} from "../../core";
|
|
2
|
-
import {HttpMethod} from "
|
|
3
|
-
import {ControllerMetaInterface, RouteDecoratorCallable, RouteMetaInterface} from "../../types";
|
|
1
|
+
import {getControllerMetadata} from "../../core/index.ts";
|
|
2
|
+
import {HttpMethod} from "../index.ts";
|
|
3
|
+
import {ControllerMetaInterface, RouteDecoratorCallable, RouteMetaInterface} from "../../types/index.ts";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
function stabilizeRoute(meta: ControllerMetaInterface, {path, method, propertyKey}: Partial<RouteMetaInterface>) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import {METADATA_KEYS} from "../constants/decorators.constant";
|
|
3
|
-
import {getControllerMetadata} from "../../core/controller";
|
|
4
|
-
import {RouteInteractionsSubscriber} from "../../types/router";
|
|
5
|
-
import { Raiton } from "../../core/raiton";
|
|
2
|
+
import {METADATA_KEYS} from "../constants/decorators.constant.ts";
|
|
3
|
+
import {getControllerMetadata} from "../../core/controller/index.ts";
|
|
4
|
+
import {RouteInteractionsSubscriber} from "../../types/router.ts";
|
|
5
|
+
import { Raiton } from "../../core/raiton.ts";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Represents a route interaction that can be rendered with context data
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {getSocketMetadata, registerSocket} from "../../core/socket";
|
|
2
|
-
import {Injectable} from "
|
|
1
|
+
import {getSocketMetadata, registerSocket} from "../../core/socket/index.ts";
|
|
2
|
+
import {Injectable} from "../index.ts";
|
|
3
3
|
import {LifetimeEnum} from "@protorians/core";
|
|
4
|
-
import {SocketEventType} from "../../types";
|
|
4
|
+
import {SocketEventType} from "../../types/index.ts";
|
|
5
5
|
|
|
6
6
|
export function Socket(namespace = '/') {
|
|
7
7
|
return (target: any) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import argon2, {Options} from "argon2";
|
|
3
|
-
import {HashAlgoEnum, PasswordAlgoEnum} from "./enums";
|
|
3
|
+
import {HashAlgoEnum, PasswordAlgoEnum} from "./enums/index.ts";
|
|
4
4
|
import bcrypt from "bcrypt";
|
|
5
|
-
import {DerivationOptionsInterface, EncryptionResultType, ScryptOptionsInterface} from "../types";
|
|
5
|
+
import {DerivationOptionsInterface, EncryptionResultType, ScryptOptionsInterface} from "../types/index.ts";
|
|
6
6
|
|
|
7
7
|
export class Encryption {
|
|
8
8
|
static get algos() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./http-method.enum"
|
|
2
|
-
export * from "./http-parameters.enum"
|
|
3
|
-
export * from "./http-status.enum"
|
|
4
|
-
export * from "./encrypted.enum"
|
|
5
|
-
export * from "./event.message.enum"
|
|
6
|
-
export * from "./timestamp.enum"
|
|
7
|
-
export * from "./runtime.enum"
|
|
8
|
-
export * from "./csrf.enum"
|
|
1
|
+
export * from "./http-method.enum.ts"
|
|
2
|
+
export * from "./http-parameters.enum.ts"
|
|
3
|
+
export * from "./http-status.enum.ts"
|
|
4
|
+
export * from "./encrypted.enum.ts"
|
|
5
|
+
export * from "./event.message.enum.ts"
|
|
6
|
+
export * from "./timestamp.enum.ts"
|
|
7
|
+
export * from "./runtime.enum.ts"
|
|
8
|
+
export * from "./csrf.enum.ts"
|
package/source/framework/env.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {GenericValueType} from "../types/generic";
|
|
2
|
-
import {getType} from "./utilities";
|
|
1
|
+
import {GenericValueType} from "../types/generic.ts";
|
|
2
|
+
import {getType} from "./utilities/index.ts";
|
|
3
3
|
|
|
4
4
|
export function env<T>(key: string, defaultValue?: T, type?: GenericValueType): T | undefined {
|
|
5
5
|
const value = process.env[key] || defaultValue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {HttpStatus} from "../enums/http-status.enum";
|
|
2
|
-
import {Raiton} from "../../core";
|
|
3
|
-
import {HttpResponseBaseInterface} from "../../types";
|
|
1
|
+
import {HttpStatus} from "../enums/http-status.enum.ts";
|
|
2
|
+
import {Raiton} from "../../core/index.ts";
|
|
3
|
+
import {HttpResponseBaseInterface} from "../../types/index.ts";
|
|
4
4
|
|
|
5
5
|
export class HttpException extends Error {
|
|
6
6
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./http-exception"
|
|
2
|
-
export * from "./throwable"
|
|
1
|
+
export * from "./http-exception.ts"
|
|
2
|
+
export * from "./throwable.ts"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {HttpStatus, HttpMethod} from "./enums";
|
|
2
|
-
import {RaitonResponses} from "./responses/helpers";
|
|
3
|
-
import {ApplicationInterface} from "../types/application";
|
|
4
|
-
import {RequestContext} from "../core/context";
|
|
1
|
+
import {HttpStatus, HttpMethod} from "./enums/index.ts";
|
|
2
|
+
import {RaitonResponses} from "./responses/helpers.ts";
|
|
3
|
+
import {ApplicationInterface} from "../types/application.ts";
|
|
4
|
+
import {RequestContext} from "../core/context.ts";
|
|
5
5
|
|
|
6
6
|
export interface HealthCheckConfig {
|
|
7
7
|
enabled: boolean;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
export * from "./enums/index"
|
|
2
|
-
export * from "./constants/index"
|
|
3
|
-
export * from "./utilities/index"
|
|
4
|
-
export * from "./responses/index"
|
|
5
|
-
export * from "./decorators/index"
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
1
|
+
export * from "./enums/index.ts"
|
|
2
|
+
export * from "./constants/index.ts"
|
|
3
|
+
export * from "./utilities/index.ts"
|
|
4
|
+
export * from "./responses/index.ts"
|
|
5
|
+
export * from "./decorators/index.ts"
|
|
6
|
+
export * from "./cache/index.ts"
|
|
7
|
+
export * from "./plugins/index.ts"
|
|
8
|
+
export * from "./runtime/index.ts"
|
|
9
|
+
export * from "./mcp/index.ts"
|
|
10
|
+
export * from "./exceptions/index.ts"
|
|
11
|
+
export * from "./health-check.ts"
|
|
12
|
+
export * from "./controllers.ts"
|
|
13
|
+
export * from "./data-transfer-object.ts"
|
|
14
|
+
export * from "./view-model.ts"
|
|
15
|
+
export * from "./encryption.ts"
|
|
16
|
+
export * from "./parameter-bag.ts"
|
|
17
|
+
export * from "./repositories.ts"
|
|
18
|
+
export * from "./services.ts"
|
|
@@ -4,15 +4,15 @@ import type {
|
|
|
4
4
|
McpElementMetaInterface,
|
|
5
5
|
McpServerRegistrationInterface,
|
|
6
6
|
McpToolResultContent,
|
|
7
|
-
} from "../../types";
|
|
7
|
+
} from "../../types/index.ts";
|
|
8
8
|
import {
|
|
9
9
|
JsonRpcErrorCode,
|
|
10
10
|
LatestProtocolVersion,
|
|
11
11
|
rpcError,
|
|
12
12
|
rpcFailure,
|
|
13
13
|
rpcSuccess,
|
|
14
|
-
} from "./protocol";
|
|
15
|
-
import {Injection} from "../../core/injection";
|
|
14
|
+
} from "./protocol.ts";
|
|
15
|
+
import {Injection} from "../../core/injection/index.ts";
|
|
16
16
|
|
|
17
17
|
export interface McpHandleResult {
|
|
18
18
|
kind: 'response' | 'notification';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./protocol"
|
|
2
|
-
export * from "./handler"
|
|
3
|
-
export * from "./streamable-http"
|
|
1
|
+
export * from "./protocol.ts"
|
|
2
|
+
export * from "./handler.ts"
|
|
3
|
+
export * from "./streamable-http.ts"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
McpServerRegistrationInterface,
|
|
3
|
-
} from "../../types";
|
|
4
|
-
import {McpVersion} from "./protocol";
|
|
5
|
-
import {handleMcpRequest} from "./handler";
|
|
3
|
+
} from "../../types/index.ts";
|
|
4
|
+
import {McpVersion} from "./protocol.ts";
|
|
5
|
+
import {handleMcpRequest} from "./handler.ts";
|
|
6
6
|
|
|
7
7
|
export const SESSION_HEADER = 'mcp-session-id'
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ParseableEntriesType, ParseablePrimitiveType} from "../types";
|
|
2
|
-
import {stabilizeJson} from "./utilities";
|
|
1
|
+
import {ParseableEntriesType, ParseablePrimitiveType} from "../types/index.ts";
|
|
2
|
+
import {stabilizeJson} from "./utilities/index.ts";
|
|
3
3
|
import {DynamicParameter, IDynamicParameters, IDynamicProps, IParameter,} from "@protorians/parameters";
|
|
4
4
|
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {MiddlewareParametersInterface, PluginInterface} from "../../types";
|
|
2
|
-
import {RequestContext} from "../../core/context";
|
|
1
|
+
import type {MiddlewareParametersInterface, PluginInterface} from "../../types/index.ts";
|
|
2
|
+
import {RequestContext} from "../../core/context.ts";
|
|
3
3
|
import {Logger} from "@protorians/logger";
|
|
4
|
-
import {tryParseJson} from "../utilities/json.util";
|
|
4
|
+
import {tryParseJson} from "../utilities/json.util.ts";
|
|
5
5
|
|
|
6
6
|
export function bodyParserPlugin(): PluginInterface {
|
|
7
7
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./body-parser.plugin";
|
|
2
|
-
export * from "./security/index";
|
|
3
|
-
export * from "./openapi.plugin";
|
|
4
|
-
export * from "./mcp.plugin";
|
|
1
|
+
export * from "./body-parser.plugin.ts";
|
|
2
|
+
export * from "./security/index.ts";
|
|
3
|
+
export * from "./openapi.plugin.ts";
|
|
4
|
+
export * from "./mcp.plugin.ts";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {PluginInterface} from "../../types";
|
|
2
|
-
import type {ContextInterface} from "../../types/core";
|
|
3
|
-
import {PluginScope} from "../../core";
|
|
4
|
-
import {findMcpServerForPath} from "../../core/mcp/metadata";
|
|
5
|
-
import {isMcpJsonRpc, mcpHandleGet, mcpHandlePost, SESSION_HEADER} from "../mcp/streamable-http";
|
|
1
|
+
import type {PluginInterface} from "../../types/index.ts";
|
|
2
|
+
import type {ContextInterface} from "../../types/core.ts";
|
|
3
|
+
import {PluginScope} from "../../core/index.ts";
|
|
4
|
+
import {findMcpServerForPath} from "../../core/mcp/metadata.ts";
|
|
5
|
+
import {isMcpJsonRpc, mcpHandleGet, mcpHandlePost, SESSION_HEADER} from "../mcp/streamable-http.ts";
|
|
6
6
|
|
|
7
7
|
export interface McpPluginOptions {
|
|
8
8
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {PluginInterface} from "../../types";
|
|
2
|
-
import type {ContextInterface} from "../../types/core";
|
|
3
|
-
import {PluginScope} from "../../core";
|
|
1
|
+
import type {PluginInterface} from "../../types/index.ts";
|
|
2
|
+
import type {ContextInterface} from "../../types/core.ts";
|
|
3
|
+
import {PluginScope} from "../../core/index.ts";
|
|
4
4
|
import {Logger} from "@protorians/logger";
|
|
5
|
-
import {generateOpenApiSpec} from "../utilities/openapi.utils";
|
|
5
|
+
import {generateOpenApiSpec} from "../utilities/openapi.utils.ts";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* OpenAPI plugin options
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {definePlugin} from "../../../core/plugins";
|
|
2
|
-
import {MiddlewareParametersInterface} from "../../../types";
|
|
3
|
-
import {RaitonResponses, HttpStatus} from "
|
|
1
|
+
import {definePlugin} from "../../../core/plugins/index.ts";
|
|
2
|
+
import {MiddlewareParametersInterface} from "../../../types/index.ts";
|
|
3
|
+
import {RaitonResponses, HttpStatus} from "../../index.ts";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export const secureBodyLimit = (maxBytes = 1_000_000) =>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {definePlugin} from "../../../core/plugins";
|
|
2
|
-
import {MiddlewareParametersInterface} from "../../../types";
|
|
1
|
+
import {definePlugin} from "../../../core/plugins/index.ts";
|
|
2
|
+
import {MiddlewareParametersInterface} from "../../../types/index.ts";
|
|
3
3
|
import {Logger} from "@protorians/logger";
|
|
4
4
|
|
|
5
5
|
export interface CorsOptions {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
|
-
import {definePlugin} from "../../../core/plugins";
|
|
3
|
-
import {MiddlewareParametersInterface} from "../../../types";
|
|
4
|
-
import {RaitonResponses, HttpStatus} from "
|
|
5
|
-
import {CsrfUtil} from "../../utilities/csrf.util";
|
|
6
|
-
import {CSRFModeEnum} from "../../enums";
|
|
7
|
-
import type {CsrfOptions, CsrfCookieOptions} from "../../../types";
|
|
2
|
+
import {definePlugin} from "../../../core/plugins/index.ts";
|
|
3
|
+
import {MiddlewareParametersInterface} from "../../../types/index.ts";
|
|
4
|
+
import {RaitonResponses, HttpStatus} from "../../index.ts";
|
|
5
|
+
import {CsrfUtil} from "../../utilities/csrf.util.ts";
|
|
6
|
+
import {CSRFModeEnum} from "../../enums/index.ts";
|
|
7
|
+
import type {CsrfOptions, CsrfCookieOptions} from "../../../types/index.ts";
|
|
8
8
|
|
|
9
9
|
const DEFAULT_METHODS = ['POST', 'PUT', 'PATCH', 'DELETE']
|
|
10
10
|
const DEFAULT_COOKIE_NAME = '_csrf'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {definePlugin} from "../../../core/plugins";
|
|
2
|
-
import {ContextInterface, MiddlewareParametersInterface, MiddlewareNextCallable} from "../../../types";
|
|
1
|
+
import {definePlugin} from "../../../core/plugins/index.ts";
|
|
2
|
+
import {ContextInterface, MiddlewareParametersInterface, MiddlewareNextCallable} from "../../../types/index.ts";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export const secureHeaders = definePlugin((scope) => {
|