raiton 1.0.0-alpha.2 → 1.0.0-alpha.4
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 +37 -0
- package/README.md +3 -4
- package/build/bin/index.mjs +3798 -3644
- package/build/raiton-1.0.0-alpha.4.tgz +0 -0
- package/deno.json +9 -0
- package/package.json +2 -1
- package/source/bin/cli-tools.ts +1 -6
- package/source/bin/constants.ts +5 -0
- package/source/bin/index.ts +1 -1
- package/source/commands/develop.command.ts +3 -3
- package/source/commands/start.command.ts +1 -1
- package/source/core/application.ts +66 -18
- package/source/core/builder.ts +27 -21
- package/source/core/controller/builder.ts +8 -5
- package/source/core/controller/metadata.ts +1 -1
- package/source/core/directories.ts +1 -1
- package/source/core/index.ts +0 -1
- package/source/core/injection/injection.ts +67 -5
- package/source/core/injection/metadata.ts +22 -0
- package/source/core/middleware/compose.ts +1 -1
- package/source/core/raiton.ts +2 -3
- package/source/core/router/handler.ts +100 -44
- package/source/core/thread.ts +18 -8
- package/source/sdk/artifacts.ts +65 -41
- package/source/sdk/constants/decorators.constant.ts +1 -0
- package/source/sdk/data-transfer-object.ts +11 -3
- package/source/sdk/decorators/parametrable.ts +19 -15
- package/source/sdk/decorators/routable.decorator.ts +0 -3
- package/source/sdk/decorators/routable.ts +25 -0
- package/source/sdk/encryption.ts +5 -6
- package/source/sdk/enums/encrypted.enum.ts +10 -0
- package/source/sdk/enums/http-method.enum.ts +10 -0
- package/source/sdk/enums/http-status.enum.ts +73 -0
- package/source/sdk/enums/index.ts +2 -1
- package/source/sdk/exceptions/http-exception.ts +28 -0
- package/source/sdk/exceptions/index.ts +2 -0
- package/source/sdk/exceptions/throwable.ts +101 -0
- package/source/sdk/fastify.ts +5 -0
- package/source/sdk/index.ts +7 -0
- package/source/sdk/json.ts +5 -5
- package/source/sdk/parameter-bag.ts +55 -0
- package/source/sdk/repositories.ts +1 -1
- package/source/sdk/responses/error.ts +52 -0
- package/source/sdk/responses/helpers.ts +28 -0
- package/source/sdk/responses/http-throwable.ts +28 -0
- package/source/sdk/responses/http.ts +48 -0
- package/source/sdk/responses/index.ts +4 -0
- package/source/sdk/responses.ts +4 -18
- package/source/sdk/routes.ts +21 -0
- package/source/sdk/runtime/bun/server.ts +2 -1
- package/source/sdk/runtime/deno/server.ts +2 -2
- package/source/sdk/runtime/node/server.ts +2 -2
- package/source/sdk/schemes.ts +1 -1
- package/source/sdk/utilities/artifact.util.ts +18 -0
- package/source/sdk/utilities/index.ts +1 -3
- package/source/sdk/utilities/parameters-arguments.util.ts +61 -0
- package/source/types/application.ts +3 -3
- package/source/types/artifact.ts +36 -32
- package/source/types/builder.ts +0 -4
- package/source/types/config.ts +2 -2
- package/source/types/controller.ts +1 -2
- package/source/types/index.ts +2 -3
- package/source/types/lifecycle.ts +11 -0
- package/source/types/parameters.ts +21 -0
- package/source/types/payload.ts +5 -0
- package/source/types/responses.ts +17 -7
- package/source/types/runtime.ts +1 -1
- package/build/raiton-1.0.0-alpha.2.tgz +0 -0
package/source/types/artifact.ts
CHANGED
|
@@ -4,37 +4,41 @@ export interface ArtifactEntry {
|
|
|
4
4
|
size: number;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
export interface ArtifactDecorator {
|
|
10
|
-
syntax: RegExp;
|
|
11
|
-
handler: ArtifactDecoratorHandler;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ArtifactOptions {
|
|
15
|
-
readonly artifact: string;
|
|
16
|
-
readonly provider: string;
|
|
17
|
-
readonly decorator: ArtifactDecorator;
|
|
18
|
-
verbose?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface ArtifactInterface {
|
|
22
|
-
readonly options: ArtifactOptions;
|
|
23
|
-
readonly directory: string;
|
|
24
|
-
readonly file: string;
|
|
25
|
-
readonly workdir: string;
|
|
26
|
-
|
|
27
|
-
get files(): string[];
|
|
28
|
-
|
|
29
|
-
get extensions(): string[];
|
|
30
|
-
|
|
31
|
-
scan(): string[];
|
|
32
|
-
|
|
33
|
-
generate(): boolean;
|
|
7
|
+
export interface ArtifactsConfig {
|
|
8
|
+
types: string[]
|
|
34
9
|
}
|
|
35
10
|
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
11
|
+
// export type ArtifactDecoratorHandler = () => void;
|
|
12
|
+
|
|
13
|
+
// export interface ArtifactDecorator {
|
|
14
|
+
// syntax: RegExp;
|
|
15
|
+
// handler: ArtifactDecoratorHandler;
|
|
16
|
+
// }
|
|
17
|
+
|
|
18
|
+
// export interface ArtifactOptions {
|
|
19
|
+
// readonly artifact: string;
|
|
20
|
+
// readonly provider: string;
|
|
21
|
+
// readonly decorator: ArtifactDecorator;
|
|
22
|
+
// verbose?: boolean;
|
|
23
|
+
// }
|
|
24
|
+
|
|
25
|
+
// export interface ArtifactInterface {
|
|
26
|
+
// readonly options: ArtifactOptions;
|
|
27
|
+
// readonly directory: string;
|
|
28
|
+
// readonly file: string;
|
|
29
|
+
// readonly workdir: string;
|
|
30
|
+
//
|
|
31
|
+
// get files(): string[];
|
|
32
|
+
//
|
|
33
|
+
// get extensions(): string[];
|
|
34
|
+
//
|
|
35
|
+
// scan(): string[];
|
|
36
|
+
//
|
|
37
|
+
// generate(): boolean;
|
|
38
|
+
// }
|
|
39
|
+
|
|
40
|
+
// export interface ArtifactEntry {
|
|
41
|
+
// vendor: string;
|
|
42
|
+
// decorator: string;
|
|
43
|
+
// pattern: string;
|
|
44
|
+
// }
|
package/source/types/builder.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type {BuildContext, BuildOptions, Metafile} from "esbuild";
|
|
2
|
-
import {HmrInterface} from "@/types/hmr";
|
|
3
|
-
import {ISignalStack} from "@protorians/core";
|
|
4
1
|
import {WatchEventType} from "node:fs";
|
|
5
2
|
|
|
6
3
|
export interface BuildCommandOptions {
|
|
@@ -17,7 +14,6 @@ export type BuilderBootCallable = (builder: BuilderInterface) => Promise<void>
|
|
|
17
14
|
export interface BuilderInterface {
|
|
18
15
|
readonly workdir: string;
|
|
19
16
|
readonly options: BuilderConfig;
|
|
20
|
-
readonly hmr: HmrInterface;
|
|
21
17
|
// readonly signal: ISignalStack<BuilderSignalMap>;
|
|
22
18
|
|
|
23
19
|
// get context(): BuildContext<BuildOptions> | null;
|
package/source/types/config.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {MiddlewareCallable, MiddlewareType} from "@/types/middleware";
|
|
|
5
5
|
export interface ControllerMetaInterface {
|
|
6
6
|
prefix?: string;
|
|
7
7
|
routes: RouteMetaInterface[];
|
|
8
|
-
params: Record<string, ParamMetaInterface[]>;
|
|
9
8
|
middlewares: Record<string, MiddlewareCallable[]>;
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -15,7 +14,6 @@ export interface RouteMetaInterface {
|
|
|
15
14
|
method: HttpMethod;
|
|
16
15
|
path: string;
|
|
17
16
|
propertyKey: string;
|
|
18
|
-
params: ParamMetaInterface[];
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
export interface ParamMetaInterface {
|
|
@@ -23,6 +21,7 @@ export interface ParamMetaInterface {
|
|
|
23
21
|
type: Parametrable;
|
|
24
22
|
key?: string;
|
|
25
23
|
callable?: (ctx: Context) => any;
|
|
24
|
+
metatype?: any;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
export interface RouteDecoratorParameters {
|
package/source/types/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ export type * from "./builder"
|
|
|
3
3
|
export type * from "./thread"
|
|
4
4
|
export type * from "./access-guards"
|
|
5
5
|
export type * from "./contruct"
|
|
6
|
-
export type * from "./data-transfer-object"
|
|
7
6
|
export type * from "./directory"
|
|
8
7
|
export type * from "./encryption"
|
|
9
8
|
export type * from "./generic"
|
|
@@ -13,7 +12,6 @@ export type * from "./scheme"
|
|
|
13
12
|
export type * from "./values"
|
|
14
13
|
export type * from "./utilities"
|
|
15
14
|
export type * from "./artifact"
|
|
16
|
-
export type * from "./hmr"
|
|
17
15
|
export type * from "./middleware"
|
|
18
16
|
export type * from "./core"
|
|
19
17
|
export type * from "./plugin"
|
|
@@ -23,4 +21,5 @@ export type * from "./controller"
|
|
|
23
21
|
export type * from "./injection"
|
|
24
22
|
export type * from "./responses"
|
|
25
23
|
export type * from "./server"
|
|
26
|
-
export type * from "./raiton"
|
|
24
|
+
export type * from "./raiton"
|
|
25
|
+
export type * from "./lifecycle"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {Parametrable} from "@/sdk/enums/http-parameters.enum";
|
|
2
|
+
import {FastifyReply, FastifyRequest} from "fastify";
|
|
3
|
+
// import {MultipartFile} from "@fastify/multipart";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export interface RouteParametersMetadataPayload {
|
|
7
|
+
request: FastifyRequest;
|
|
8
|
+
reply: FastifyReply;
|
|
9
|
+
files: AsyncIterableIterator<any> | any[]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type RouteParametersMetadataCallable = (payload: RouteParametersMetadataPayload) => any[];
|
|
13
|
+
|
|
14
|
+
export interface RouteParametersMetadataInterface {
|
|
15
|
+
index: number;
|
|
16
|
+
type: Parametrable;
|
|
17
|
+
key: string;
|
|
18
|
+
multiple: boolean;
|
|
19
|
+
optional: boolean;
|
|
20
|
+
callable?: RouteParametersMetadataCallable;
|
|
21
|
+
}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {HttpStatus} from "@/sdk/enums/http-status.enum";
|
|
2
2
|
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly statusCode?: number;
|
|
7
|
-
readonly errorStack?: Error;
|
|
8
|
-
readonly data?: ParseableEntriesType
|
|
3
|
+
export interface HttpResponseBaseInterface {
|
|
4
|
+
message: string;
|
|
5
|
+
statusCode?: HttpStatus;
|
|
9
6
|
}
|
|
10
7
|
|
|
8
|
+
export interface HttpResponseInterface<T = any> extends HttpResponseBaseInterface{
|
|
9
|
+
error?: boolean;
|
|
10
|
+
errorStack?: Error | ErrorResponseInterface[];
|
|
11
|
+
data?: T
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ErrorResponseInterface {
|
|
15
|
+
id: string;
|
|
16
|
+
message?: string;
|
|
17
|
+
code?: string;
|
|
18
|
+
statusCode?: HttpStatus;
|
|
19
|
+
error?: Error
|
|
20
|
+
}
|
package/source/types/runtime.ts
CHANGED
|
Binary file
|