raiton 3.0.1 → 3.1.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.
Files changed (93) hide show
  1. package/CHANGELOG.md +15 -15
  2. package/README.md +1 -1
  3. package/build/bin/index.mjs +240 -2
  4. package/package.json +3 -4
  5. package/scripts/update-version.ts +5 -5
  6. package/source/bin/bootstrapper.ts +3 -3
  7. package/source/bin/cli-tools.ts +1 -1
  8. package/source/bin/cli.ts +1 -1
  9. package/source/commands/artifact.command.ts +3 -3
  10. package/source/commands/build.command.ts +3 -3
  11. package/source/commands/develop.command.ts +3 -3
  12. package/source/commands/grafts.command.ts +1 -1
  13. package/source/commands/start.command.ts +3 -3
  14. package/source/core/application.ts +23 -18
  15. package/source/core/builder.ts +8 -8
  16. package/source/core/bytes.util.ts +2 -2
  17. package/source/core/config/config.ts +8 -8
  18. package/source/core/config/define.ts +4 -4
  19. package/source/core/context.ts +1 -1
  20. package/source/core/controller/builder.ts +6 -6
  21. package/source/core/controller/compiler.ts +5 -5
  22. package/source/core/controller/metadata.ts +2 -2
  23. package/source/core/directories.ts +1 -1
  24. package/source/core/guards.ts +43 -0
  25. package/source/core/hooks.ts +4 -4
  26. package/source/core/injection/injection.ts +8 -7
  27. package/source/core/middleware/compose.ts +2 -2
  28. package/source/core/middleware/pipeline.ts +2 -2
  29. package/source/core/plugins/plugin.ts +3 -3
  30. package/source/core/plugins/scope.ts +3 -3
  31. package/source/core/raiton.ts +2 -2
  32. package/source/core/router/handler.ts +7 -7
  33. package/source/core/router/matcher.ts +1 -1
  34. package/source/core/router/route.ts +3 -3
  35. package/source/core/router/router.ts +5 -5
  36. package/source/core/server.ts +3 -3
  37. package/source/core/thread.ts +14 -13
  38. package/source/sdk/artifacts.ts +5 -5
  39. package/source/sdk/decorators/controllable.decorator.ts +3 -3
  40. package/source/sdk/decorators/guard.decorator.ts +23 -0
  41. package/source/sdk/decorators/index.ts +2 -1
  42. package/source/sdk/decorators/injection.decorator.ts +4 -4
  43. package/source/sdk/decorators/middleware.decorator.ts +2 -2
  44. package/source/sdk/decorators/parametrable.ts +3 -3
  45. package/source/sdk/decorators/routable.decorator.ts +3 -3
  46. package/source/sdk/encryption.ts +15 -15
  47. package/source/sdk/env.ts +5 -5
  48. package/source/sdk/exceptions/http-exception.ts +3 -3
  49. package/source/sdk/parameter-bag.ts +1 -1
  50. package/source/sdk/plugins/body-parser.plugin.ts +5 -5
  51. package/source/sdk/plugins/security/body-limit.ts +3 -3
  52. package/source/sdk/plugins/security/cors.ts +3 -3
  53. package/source/sdk/plugins/security/headers.ts +3 -3
  54. package/source/sdk/plugins/security/method-guard.ts +3 -3
  55. package/source/sdk/plugins/security/rate-limit.ts +3 -3
  56. package/source/sdk/repositories.ts +1 -1
  57. package/source/sdk/responses/error.ts +2 -2
  58. package/source/sdk/responses/helpers.ts +3 -3
  59. package/source/sdk/responses/http-throwable.ts +3 -3
  60. package/source/sdk/responses/http.ts +3 -3
  61. package/source/sdk/runtime/bun/server.ts +1 -1
  62. package/source/sdk/runtime/deno/server.ts +1 -1
  63. package/source/sdk/runtime/index.ts +6 -6
  64. package/source/sdk/runtime/node/server.ts +1 -1
  65. package/source/sdk/runtime/web/server.ts +1 -1
  66. package/source/sdk/utilities/utilities.util.ts +2 -2
  67. package/source/types/application.ts +5 -5
  68. package/source/types/artifact.ts +2 -43
  69. package/source/types/builder.ts +5 -5
  70. package/source/types/config.ts +3 -3
  71. package/source/types/controller.ts +6 -6
  72. package/source/types/contruct.ts +1 -1
  73. package/source/types/core.ts +3 -5
  74. package/source/types/directory.ts +1 -1
  75. package/source/types/encryption.ts +21 -12
  76. package/source/types/generic.ts +2 -2
  77. package/source/types/guard.ts +12 -0
  78. package/source/types/index.ts +1 -3
  79. package/source/types/injection.ts +2 -2
  80. package/source/types/lifecycle.ts +3 -3
  81. package/source/types/middleware.ts +5 -5
  82. package/source/types/plugin.ts +4 -6
  83. package/source/types/raiton.ts +3 -3
  84. package/source/types/responses.ts +10 -7
  85. package/source/types/router.ts +5 -5
  86. package/source/types/runtime.ts +1 -1
  87. package/source/types/server.ts +3 -3
  88. package/source/types/thread.ts +7 -7
  89. package/source/types/utilities.ts +1 -1
  90. package/source/types/values.ts +2 -2
  91. package/source/types/access-guards.ts +0 -4
  92. package/source/types/http-responses.ts +0 -8
  93. package/source/types/scheme.ts +0 -153
@@ -2,7 +2,7 @@ import crypto from "node:crypto";
2
2
  import argon2, {Options} from "argon2";
3
3
  import {HashAlgoEnum, PasswordAlgoEnum} from "./enums";
4
4
  import bcrypt from "bcrypt";
5
- import {IDerivationOptions, IEncryptionResult, IScryptOptions} from "@/types";
5
+ import {DerivationOptionsInterface, EncryptionResultType, ScryptOptionsInterface} from "../types";
6
6
 
7
7
  export class Encryption {
8
8
  static get algos() {
@@ -24,7 +24,7 @@ export class Encryption {
24
24
  return this.make(value).then(result => result === hash);
25
25
  }
26
26
 
27
- async make(value: string, options?: IDerivationOptions | IScryptOptions): Promise<IEncryptionResult> {
27
+ async make(value: string, options?: DerivationOptionsInterface | ScryptOptionsInterface): Promise<EncryptionResultType> {
28
28
  if (!value) {
29
29
  throw new Error('Value cannot be empty');
30
30
  }
@@ -45,9 +45,9 @@ export class Encryption {
45
45
  case HashAlgoEnum.SHA3_512:
46
46
  return this.sha3_512(value);
47
47
  case HashAlgoEnum.PBKDF2:
48
- return this.pbkdf2(value, options as IDerivationOptions | undefined);
48
+ return this.pbkdf2(value, options as DerivationOptionsInterface | undefined);
49
49
  case HashAlgoEnum.SCRYPT:
50
- return this.scrypt(value, options as IScryptOptions | undefined);
50
+ return this.scrypt(value, options as ScryptOptionsInterface | undefined);
51
51
  case HashAlgoEnum.ARGON2ID:
52
52
  case HashAlgoEnum.BCRYPT:
53
53
  return this.password(value);
@@ -56,35 +56,35 @@ export class Encryption {
56
56
  }
57
57
  }
58
58
 
59
- protected sha256(value: string): IEncryptionResult {
59
+ protected sha256(value: string): EncryptionResultType {
60
60
  return crypto.createHash("sha256").update(value).digest("hex");
61
61
  }
62
62
 
63
- protected sha512(value: string): IEncryptionResult {
63
+ protected sha512(value: string): EncryptionResultType {
64
64
  return crypto.createHash("sha512").update(value).digest("hex");
65
65
  }
66
66
 
67
- protected md5(value: string): IEncryptionResult {
67
+ protected md5(value: string): EncryptionResultType {
68
68
  return crypto.createHash("md5").update(value).digest("hex");
69
69
  }
70
70
 
71
- protected ripemd160(value: string): IEncryptionResult {
71
+ protected ripemd160(value: string): EncryptionResultType {
72
72
  return crypto.createHash("ripemd160").update(value).digest("hex");
73
73
  }
74
74
 
75
- protected blake2b(value: string): IEncryptionResult {
75
+ protected blake2b(value: string): EncryptionResultType {
76
76
  return crypto.createHash("blake2b512").update(value).digest("hex");
77
77
  }
78
78
 
79
- protected sha3_256(value: string): IEncryptionResult {
79
+ protected sha3_256(value: string): EncryptionResultType {
80
80
  return crypto.createHash("sha3-256").update(value).digest("hex");
81
81
  }
82
82
 
83
- protected sha3_512(value: string): IEncryptionResult {
83
+ protected sha3_512(value: string): EncryptionResultType {
84
84
  return crypto.createHash("sha3-512").update(value).digest("hex");
85
85
  }
86
86
 
87
- protected pbkdf2(value: string, options?: IDerivationOptions): IEncryptionResult {
87
+ protected pbkdf2(value: string, options?: DerivationOptionsInterface): EncryptionResultType {
88
88
  const {salt, iterations, keylen, digest} = options || {};
89
89
  const usedSalt = salt ?? crypto.randomBytes(16).toString("hex");
90
90
  const usedIterations = iterations ?? 100_000;
@@ -96,8 +96,8 @@ export class Encryption {
96
96
  return `pbkdf2$${usedDigest}$${usedIterations}$${usedSalt}$${derived}`;
97
97
  }
98
98
 
99
- protected scrypt(value: string, options?: IScryptOptions): IEncryptionResult {
100
- const {salt, keylen, cost, blockSize, parallelization} = options || {} as IScryptOptions;
99
+ protected scrypt(value: string, options?: ScryptOptionsInterface): EncryptionResultType {
100
+ const {salt, keylen, cost, blockSize, parallelization} = options || {} as ScryptOptionsInterface;
101
101
  const usedSalt = salt ?? crypto.randomBytes(16).toString("hex");
102
102
  const usedKeylen = keylen ?? 64;
103
103
  const usedCost = cost ?? 16384; // N
@@ -120,7 +120,7 @@ export class Encryption {
120
120
 
121
121
  async password(value: string, options?: (Options & {
122
122
  raw?: boolean
123
- }) | (string | number) | undefined): Promise<IEncryptionResult> {
123
+ }) | (string | number) | undefined): Promise<EncryptionResultType> {
124
124
  switch (this.algo) {
125
125
  case HashAlgoEnum.ARGON2ID: {
126
126
  return await argon2.hash(value, {
package/source/sdk/env.ts CHANGED
@@ -1,9 +1,9 @@
1
- import {IGenericValue} from "../types/generic";
1
+ import {GenericValueType} from "../types/generic";
2
2
  import {getType} from "./utilities";
3
3
 
4
- export function env<T>(key: string, type?: IGenericValue): T | undefined {
4
+ export function env<T>(key: string, type?: GenericValueType): T | undefined {
5
5
  const value = process.env[key];
6
- type = type || getType(value) as IGenericValue;
6
+ type = type || getType(value) as GenericValueType;
7
7
 
8
8
  if (value) {
9
9
  switch (type) {
@@ -28,10 +28,10 @@ export function env<T>(key: string, type?: IGenericValue): T | undefined {
28
28
  return undefined;
29
29
  }
30
30
 
31
- export function envGroup(key: string): Record<string, IGenericValue | undefined> {
31
+ export function envGroup(key: string): Record<string, GenericValueType | undefined> {
32
32
  const filtered = Object.entries(process.env)
33
33
  .filter(([index]) => key.startsWith(index))
34
- const gen: Record<string, IGenericValue | undefined> = {}
34
+ const gen: Record<string, GenericValueType | undefined> = {}
35
35
 
36
36
  for (const [index, value] of filtered)
37
37
  gen[index] = env(value as any, undefined)
@@ -1,6 +1,6 @@
1
- import {HttpStatus} from "@/sdk/enums/http-status.enum";
2
- import {Raiton} from "@/core";
3
- import {HttpResponseBaseInterface} from "@/types";
1
+ import {HttpStatus} from "../enums/http-status.enum";
2
+ import {Raiton} from "../../core";
3
+ import {HttpResponseBaseInterface} from "../../types";
4
4
 
5
5
  export class HttpException extends Error {
6
6
 
@@ -1,4 +1,4 @@
1
- import {ParseableEntriesType, ParseablePrimitiveType} from "@/types";
1
+ import {ParseableEntriesType, ParseablePrimitiveType} from "../types";
2
2
  import {stabilizeJson} from "./utilities";
3
3
  import {DynamicParameter, IDynamicParameters, IDynamicProps, IParameter,} from "@protorians/parameters";
4
4
 
@@ -1,13 +1,13 @@
1
- import type {MiddlewareParameters, Plugin} from "@/types";
2
- import {RequestContext} from "@/core/context";
1
+ import type {MiddlewareParametersInterface, PluginInterface} from "../../types";
2
+ import {RequestContext} from "../../core/context";
3
3
  import {Logger} from "@protorians/logger";
4
- import {tryParseJson} from "@/sdk/utilities/json.util";
4
+ import {tryParseJson} from "../utilities/json.util";
5
5
 
6
- export function bodyParserPlugin(): Plugin {
6
+ export function bodyParserPlugin(): PluginInterface {
7
7
  return {
8
8
  name: 'body-parser-plugin',
9
9
  setup: (scope) => {
10
- scope.use(async ({context, next}: MiddlewareParameters) => {
10
+ scope.use(async ({context, next}: MiddlewareParametersInterface) => {
11
11
  const contentType = context.req.headers.get('content-type') || '';
12
12
 
13
13
  if (context.req.body && !context.state.bodyParsed) {
@@ -1,10 +1,10 @@
1
- import {definePlugin} from "@/core/plugins";
2
- import {MiddlewareParameters} from "@/types";
1
+ import {definePlugin} from "../../../core/plugins";
2
+ import {MiddlewareParametersInterface} from "../../../types";
3
3
 
4
4
 
5
5
  export const secureBodyLimit = (maxBytes = 1_000_000) =>
6
6
  definePlugin((scope) => {
7
- scope.use(async ({context, next}: MiddlewareParameters) => {
7
+ scope.use(async ({context, next}: MiddlewareParametersInterface) => {
8
8
  const len = Number(
9
9
  context.req.headers.get('content-length') ?? 0
10
10
  )
@@ -1,5 +1,5 @@
1
- import {definePlugin} from "@/core/plugins";
2
- import {Context, MiddlewareParameters, NextCallable} from "@/types";
1
+ import {definePlugin} from "../../../core/plugins";
2
+ import {ContextInterface, MiddlewareParametersInterface, MiddlewareNextCallable} from "../../../types";
3
3
 
4
4
  export interface CorsOptions {
5
5
  origin?: string | string[]
@@ -9,7 +9,7 @@ export interface CorsOptions {
9
9
 
10
10
  export const secureCors = (opts: CorsOptions = {}) =>
11
11
  definePlugin((scope) => {
12
- scope.use(async ({context, next}: MiddlewareParameters) => {
12
+ scope.use(async ({context, next}: MiddlewareParametersInterface) => {
13
13
  const origin = context.req.headers.get('origin')
14
14
 
15
15
  if (opts.origin) {
@@ -1,9 +1,9 @@
1
- import {definePlugin} from "@/core/plugins";
2
- import {Context, MiddlewareParameters, NextCallable} from "@/types";
1
+ import {definePlugin} from "../../../core/plugins";
2
+ import {ContextInterface, MiddlewareParametersInterface, MiddlewareNextCallable} from "../../../types";
3
3
 
4
4
 
5
5
  export const secureHeaders = definePlugin((scope) => {
6
- scope.use(async ({context, next}: MiddlewareParameters) => {
6
+ scope.use(async ({context, next}: MiddlewareParametersInterface) => {
7
7
  context.reply.header('X-Content-Type-Options', 'nosniff')
8
8
  context.reply.header('X-Frame-Options', 'DENY')
9
9
  context.reply.header('Referrer-Policy', 'no-referrer')
@@ -1,10 +1,10 @@
1
- import {definePlugin} from "@/core/plugins";
2
- import {Context, MiddlewareParameters, NextCallable} from "@/types";
1
+ import {definePlugin} from "../../../core/plugins";
2
+ import {ContextInterface, MiddlewareParametersInterface, MiddlewareNextCallable} from "../../../types";
3
3
 
4
4
 
5
5
  export const secureMethodGuard = (allowed: string[]) =>
6
6
  definePlugin((scope) => {
7
- scope.use(async ({context, next}: MiddlewareParameters) => {
7
+ scope.use(async ({context, next}: MiddlewareParametersInterface) => {
8
8
  if (!allowed.includes(context.req.method)) {
9
9
  context.reply.status(405)
10
10
  return context.send({ error: 'Method not allowed' })
@@ -1,5 +1,5 @@
1
- import {definePlugin} from "@/core/plugins";
2
- import {Context, MiddlewareParameters, NextCallable} from "@/types";
1
+ import {definePlugin} from "../../../core/plugins";
2
+ import {ContextInterface, MiddlewareParametersInterface, MiddlewareNextCallable} from "../../../types";
3
3
 
4
4
 
5
5
  export interface RateLimitOptions {
@@ -16,7 +16,7 @@ export const secureRateLimit = (
16
16
  const windowMs = opts.windowMs ?? 60_000
17
17
  const max = opts.max ?? 100
18
18
 
19
- scope.use(async ({context, next}: MiddlewareParameters) => {
19
+ scope.use(async ({context, next}: MiddlewareParametersInterface) => {
20
20
  const ip =
21
21
  context.req.remoteAddress ?? 'unknown'
22
22
  const now = Date.now()
@@ -1,4 +1,4 @@
1
- import {Throwable} from "@/sdk/exceptions";
1
+ import {Throwable} from "./exceptions";
2
2
 
3
3
 
4
4
  export class DelegateRepository {
@@ -1,5 +1,5 @@
1
- import type {ErrorResponseInterface} from "@/types";
2
- import {HttpResponse} from "@/sdk/responses/http";
1
+ import type {ErrorResponseInterface} from "../../types";
2
+ import {HttpResponse} from "./http";
3
3
 
4
4
 
5
5
  export class HttpErrorResponse {
@@ -1,6 +1,6 @@
1
- import {HttpResponse, HttpStatus} from "@/sdk";
2
- import {HttpResponseInterface} from "@/types";
3
- import {Raiton} from "@/core";
1
+ import {HttpResponse, HttpStatus} from "..";
2
+ import {HttpResponseInterface} from "../../types";
3
+ import {Raiton} from "../../core";
4
4
 
5
5
 
6
6
  export function RaitonResponses(
@@ -1,6 +1,6 @@
1
- import {HttpResponseInterface} from "@/types";
2
- import {HttpStatus} from "@/sdk/enums";
3
- import {Raiton} from "@/core";
1
+ import {HttpResponseInterface} from "../../types";
2
+ import {HttpStatus} from "../enums";
3
+ import {Raiton} from "../../core";
4
4
 
5
5
 
6
6
  export class ThrowableResponse extends Error {
@@ -1,6 +1,6 @@
1
- import {HttpResponseInterface} from "@/types";
2
- import {HttpStatus} from "@/sdk/enums";
3
- import {ThrowableResponse} from "@/sdk/responses";
1
+ import {HttpResponseInterface} from "../../types";
2
+ import {HttpStatus} from "../enums";
3
+ import {ThrowableResponse} from ".";
4
4
 
5
5
 
6
6
  export class HttpResponse {
@@ -1,4 +1,4 @@
1
- import {RuntimeAdapterInterface} from '@/types'
1
+ import {RuntimeAdapterInterface} from '../../../types'
2
2
 
3
3
  export const bunRuntime: RuntimeAdapterInterface = {
4
4
  createServer(handler) {
@@ -1,4 +1,4 @@
1
- import {RuntimeAdapterInterface} from '@/types'
1
+ import {RuntimeAdapterInterface} from '../../../types'
2
2
 
3
3
  export const denoRuntime: RuntimeAdapterInterface = {
4
4
  createServer(handler) {
@@ -1,9 +1,9 @@
1
- import type {RuntimeAdapterInterface, RuntimeHandlerCallable, RuntimeInterface, RuntimeServerInterface} from "@/types";
2
- import {RuntimeType} from "@/sdk/enums/runtime.enum";
3
- import {nodeRuntime} from "@/sdk/runtime/node/server";
4
- import {bunRuntime} from "@/sdk/runtime/bun/server";
5
- import {denoRuntime} from "@/sdk/runtime/deno/server";
6
- import {webRuntime} from "@/sdk/runtime/web/server";
1
+ import type {RuntimeAdapterInterface, RuntimeHandlerCallable, RuntimeInterface, RuntimeServerInterface} from "../../types";
2
+ import {RuntimeType} from "../enums/runtime.enum";
3
+ import {nodeRuntime} from "./node/server";
4
+ import {bunRuntime} from "./bun/server";
5
+ import {denoRuntime} from "./deno/server";
6
+ import {webRuntime} from "./web/server";
7
7
 
8
8
 
9
9
  export class Runtime implements RuntimeInterface {
@@ -3,7 +3,7 @@ import {
3
3
  RuntimeAdapterInterface,
4
4
  RuntimeRequestInterface,
5
5
  RuntimeReplyInterface
6
- } from '@/types'
6
+ } from '../../../types'
7
7
 
8
8
  export const nodeRuntime: RuntimeAdapterInterface = {
9
9
  createServer(handler) {
@@ -1,4 +1,4 @@
1
- import {RuntimeAdapterInterface, RuntimeReplyInterface, RuntimeRequestInterface} from '@/types'
1
+ import {RuntimeAdapterInterface, RuntimeReplyInterface, RuntimeRequestInterface} from '../../../types'
2
2
 
3
3
  export const webRuntime: RuntimeAdapterInterface = {
4
4
  createServer(handler) {
@@ -1,6 +1,6 @@
1
- import {IGenericValueType} from "../../types";
1
+ import {GenericValuesType} from "../../types";
2
2
 
3
- export function getType(value: any): IGenericValueType {
3
+ export function getType(value: any): GenericValuesType {
4
4
  if (typeof value === "string") return "string";
5
5
  if (typeof value === "boolean") return "boolean";
6
6
  if (typeof value === "bigint") return "bigInt";
@@ -1,6 +1,6 @@
1
- import {HttpMethod} from "@/sdk";
1
+ import {HttpMethod} from "../sdk";
2
2
 
3
- export interface ApplicationConfig {
3
+ export interface ApplicationConfigInterface {
4
4
  workdir?: string;
5
5
  hostname?: string;
6
6
  port?: number;
@@ -12,13 +12,13 @@ export interface ApplicationConfig {
12
12
  }
13
13
 
14
14
  export interface ApplicationInterface {
15
- readonly config: ApplicationConfig;
15
+ readonly config: ApplicationConfigInterface;
16
16
 
17
17
  get hostname(): string;
18
18
 
19
- setOption<K extends keyof ApplicationConfig>(key: K, value: ApplicationConfig[K]): this;
19
+ setOption<K extends keyof ApplicationConfigInterface>(key: K, value: ApplicationConfigInterface[K]): this;
20
20
 
21
- setOptions(options: ApplicationConfig): this;
21
+ setOptions(options: ApplicationConfigInterface): this;
22
22
 
23
23
  register(plugin: any): this;
24
24
 
@@ -1,44 +1,3 @@
1
- export interface ArtifactEntry {
2
- id: string;
3
- timestamp: Date;
4
- size: number;
5
- }
6
-
7
- export interface ArtifactsConfig {
1
+ export interface ArtifactsConfigInterface {
8
2
  types: string[]
9
- }
10
-
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
- // }
3
+ }
@@ -1,19 +1,19 @@
1
1
  import {WatchEventType} from "node:fs";
2
2
 
3
- export interface BuildCommandOptions {
3
+ export interface BuildCommandOptionsInterface {
4
4
  develop?: boolean;
5
5
  bootstrap?: boolean;
6
6
  }
7
7
 
8
- export interface BuilderConfig {
8
+ export interface BuilderConfigInterface {
9
9
  development?: boolean;
10
10
  }
11
11
 
12
- export type BuilderBootCallable = (builder: BuilderInterface) => Promise<void>
12
+ export type BuilderBootCallableType = (builder: BuilderInterface) => Promise<void>
13
13
 
14
14
  export interface BuilderInterface {
15
15
  readonly workdir: string;
16
- readonly options: BuilderConfig;
16
+ readonly options: BuilderConfigInterface;
17
17
  // readonly signal: ISignalStack<BuilderSignalMap>;
18
18
 
19
19
  // get context(): BuildContext<BuildOptions> | null;
@@ -36,7 +36,7 @@ export interface BuilderInterface {
36
36
  }
37
37
 
38
38
 
39
- export interface BuilderHMRDeclaration {
39
+ export interface BuilderHMRDeclarationInterface {
40
40
  filename: string;
41
41
  timestamp?: number;
42
42
  version?: number;
@@ -1,7 +1,7 @@
1
- import type {ArtifactsConfig} from "@/types/artifact";
1
+ import type {ArtifactsConfigInterface} from "./artifact";
2
2
 
3
- export interface Configurable {
3
+ export interface ConfigurableInterface {
4
4
  rootDir: string;
5
5
  version: string;
6
- artifacts?: ArtifactsConfig
6
+ artifacts?: ArtifactsConfigInterface
7
7
  }
@@ -1,6 +1,6 @@
1
- import {HttpMethod, Parametrable} from "@/sdk/enums";
2
- import {Context} from "@/types/core";
3
- import {MiddlewareCallable, MiddlewareType} from "@/types/middleware";
1
+ import {HttpMethod, Parametrable} from "../sdk/enums";
2
+ import {ContextInterface} from "./core";
3
+ import {MiddlewareCallable, MiddlewareType} from "./middleware";
4
4
 
5
5
  export interface ControllerMetaInterface {
6
6
  prefix?: string;
@@ -20,14 +20,14 @@ export interface ParamMetaInterface {
20
20
  index: number;
21
21
  type: Parametrable;
22
22
  key?: string;
23
- callable?: (ctx: Context) => any;
23
+ callable?: (ctx: ContextInterface) => any;
24
24
  metatype?: any;
25
25
  }
26
26
 
27
- export interface RouteDecoratorParameters {
27
+ export interface RouteDecoratorParametersInterface {
28
28
  controller: ControllerMetaInterface;
29
29
  route: RouteMetaInterface;
30
30
  index: number;
31
31
  }
32
32
 
33
- export type RouteDecoratorCallable = (parameters: RouteDecoratorParameters) => void;
33
+ export type RouteDecoratorCallable = (parameters: RouteDecoratorParametersInterface) => void;
@@ -1,3 +1,3 @@
1
1
 
2
2
 
3
- export type IConstructor<T = any> = new (...args: any[]) => T;
3
+ export type ConstructorType<T = any> = new (...args: any[]) => T;
@@ -3,18 +3,16 @@ import type {
3
3
  RuntimeReplyInterface
4
4
  } from './runtime'
5
5
 
6
- export type HookName =
6
+ export type HookNameType =
7
7
  | 'onRequest'
8
8
  | 'preParsing'
9
9
  | 'preHandler'
10
10
  | 'onSend'
11
11
  | 'onResponse'
12
12
 
13
- export type HookHandler = (
14
- ctx: Context
15
- ) => Promise<void> | void
13
+ export type HookHandlerCallable = (ctx: ContextInterface) => Promise<void> | void
16
14
 
17
- export interface Context {
15
+ export interface ContextInterface {
18
16
  req: RuntimeRequestInterface
19
17
  reply: RuntimeReplyInterface
20
18
 
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- export interface IFileStatInfo {
3
+ export interface FileStatInfoInterface {
4
4
  absolute: string;
5
5
  relative: string;
6
6
  dir: string;
@@ -1,17 +1,26 @@
1
1
 
2
- export type IEncryptionResult = string;
2
+ export type EncryptionResultType = string;
3
3
 
4
- export interface IDerivationOptions {
5
- salt?: string; // hex string; if not provided, a random 16-byte salt will be generated
6
- iterations?: number; // for PBKDF2
7
- keylen?: number; // bytes length for derived key (default 64)
8
- digest?: string; // for PBKDF2 digest (default 'sha512')
4
+ export interface DerivationOptionsInterface {
5
+ // hex string; if not provided, a random 16-byte salt will be generated
6
+ salt?: string;
7
+ // for PBKDF2
8
+ iterations?: number;
9
+ // bytes length for derived key (default 64)
10
+ keylen?: number;
11
+ // for PBKDF2 digest (default 'sha512')
12
+ digest?: string;
9
13
  }
10
14
 
11
- export interface IScryptOptions {
12
- salt?: string; // hex string; if not provided, a random 16-byte salt will be generated
13
- keylen?: number; // bytes length for derived key (default 64)
14
- cost?: number; // N parameter (default 16384)
15
- blockSize?: number; // r parameter (default 8)
16
- parallelization?: number; // p parameter (default 1)
15
+ export interface ScryptOptionsInterface {
16
+ // hex string; if not provided, a random 16-byte salt will be generated
17
+ salt?: string;
18
+ // bytes length for derived key (default 64)
19
+ keylen?: number;
20
+ // N parameter (default 16384)
21
+ cost?: number;
22
+ // r parameter (default 8)
23
+ blockSize?: number;
24
+ // p parameter (default 1)
25
+ parallelization?: number;
17
26
  }
@@ -1,3 +1,3 @@
1
- export type IGenericValue = 'string' | 'int' | 'bigInt' | 'float' | 'boolean'
1
+ export type GenericValueType = 'string' | 'int' | 'bigInt' | 'float' | 'boolean'
2
2
 
3
- export type IGenericValueType = IGenericValue | 'array' | 'object' | 'function' | undefined;
3
+ export type GenericValuesType = GenericValueType | 'array' | 'object' | 'function' | undefined;
@@ -0,0 +1,12 @@
1
+ import {MiddlewareParametersInterface} from "./middleware";
2
+
3
+ export interface GuardOptions {
4
+ name: string;
5
+ handler: GuardCallable
6
+ }
7
+
8
+ export interface GuardDeclaration extends GuardOptions {
9
+ enabled: boolean;
10
+ }
11
+
12
+ export type GuardCallable = (parameters: MiddlewareParametersInterface) => Promise<boolean> | boolean
@@ -1,14 +1,12 @@
1
1
  export type * from "./config"
2
2
  export type * from "./builder"
3
3
  export type * from "./thread"
4
- export type * from "./access-guards"
4
+ export type * from "./guard"
5
5
  export type * from "./contruct"
6
6
  export type * from "./directory"
7
7
  export type * from "./encryption"
8
8
  export type * from "./generic"
9
- export type * from "./http-responses"
10
9
  export type * from "./parseable"
11
- export type * from "./scheme"
12
10
  export type * from "./values"
13
11
  export type * from "./utilities"
14
12
  export type * from "./artifact"
@@ -1,10 +1,10 @@
1
- import {IConstructor} from "@/types/contruct";
1
+ import {ConstructorType} from "./contruct";
2
2
  import {LifetimeEnum} from "@protorians/core";
3
3
 
4
4
 
5
5
  export interface ContainerDefinitionInterface<T = any> {
6
6
  name: string;
7
- construct: IConstructor<T>;
7
+ construct: ConstructorType<T>;
8
8
  lifetime: LifetimeEnum;
9
9
  instance?: any;
10
10
  scope?: Symbol;
@@ -1,11 +1,11 @@
1
- export interface OnMount {
1
+ export interface OnMountInterface {
2
2
  onMount(): void | Promise<void>;
3
3
  }
4
4
 
5
- export interface OnUnmount {
5
+ export interface OnUnmountInterface {
6
6
  onUnmount(): void | Promise<void>;
7
7
  }
8
8
 
9
- export interface OnInit {
9
+ export interface OnInitInterface {
10
10
  onInit(): void | Promise<void>;
11
11
  }