raiton 3.0.0 → 3.0.2
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/build/bin/index.mjs +1 -1
- package/package.json +1 -1
- package/scripts/update-version.ts +3 -3
- package/source/bin/bootstrapper.ts +3 -3
- package/source/bin/cli-tools.ts +1 -1
- package/source/commands/artifact.command.ts +2 -2
- package/source/commands/build.command.ts +2 -2
- package/source/commands/develop.command.ts +3 -3
- package/source/commands/grafts.command.ts +1 -1
- package/source/commands/start.command.ts +3 -3
- package/source/core/application.ts +6 -6
- package/source/core/builder.ts +7 -7
- package/source/core/config/config.ts +2 -2
- package/source/core/config/define.ts +2 -2
- package/source/core/context.ts +1 -1
- package/source/core/controller/builder.ts +5 -5
- package/source/core/controller/compiler.ts +5 -5
- package/source/core/controller/metadata.ts +2 -2
- package/source/core/directories.ts +1 -1
- package/source/core/hooks.ts +1 -1
- package/source/core/injection/injection.ts +3 -3
- package/source/core/middleware/compose.ts +2 -2
- package/source/core/middleware/pipeline.ts +2 -2
- package/source/core/plugins/plugin.ts +1 -1
- package/source/core/plugins/scope.ts +3 -3
- package/source/core/raiton.ts +1 -1
- package/source/core/router/handler.ts +7 -7
- 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/thread.ts +8 -8
- package/source/sdk/artifacts.ts +4 -4
- package/source/sdk/decorators/controllable.decorator.ts +3 -3
- package/source/sdk/decorators/injection.decorator.ts +3 -3
- package/source/sdk/decorators/middleware.decorator.ts +2 -2
- package/source/sdk/decorators/parametrable.ts +2 -2
- package/source/sdk/decorators/routable.decorator.ts +3 -3
- package/source/sdk/encryption.ts +1 -1
- package/source/sdk/exceptions/http-exception.ts +3 -3
- package/source/sdk/parameter-bag.ts +1 -1
- package/source/sdk/plugins/body-parser.plugin.ts +3 -3
- package/source/sdk/plugins/security/body-limit.ts +2 -2
- package/source/sdk/plugins/security/cors.ts +2 -2
- package/source/sdk/plugins/security/headers.ts +2 -2
- package/source/sdk/plugins/security/method-guard.ts +2 -2
- package/source/sdk/plugins/security/rate-limit.ts +2 -2
- package/source/sdk/repositories.ts +1 -1
- package/source/sdk/responses/error.ts +2 -2
- package/source/sdk/responses/helpers.ts +3 -3
- package/source/sdk/responses/http-throwable.ts +3 -3
- package/source/sdk/responses/http.ts +3 -3
- package/source/sdk/runtime/bun/server.ts +1 -1
- package/source/sdk/runtime/deno/server.ts +1 -1
- package/source/sdk/runtime/index.ts +6 -6
- package/source/sdk/runtime/node/server.ts +1 -1
- package/source/sdk/runtime/web/server.ts +1 -1
- package/source/types/application.ts +1 -1
- package/source/types/config.ts +1 -1
- package/source/types/controller.ts +3 -3
- 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 +1 -1
- package/source/types/router.ts +2 -2
- package/source/types/runtime.ts +1 -1
- package/source/types/thread.ts +4 -4
package/build/bin/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -29,8 +29,7 @@ function determineIncrement(commits: string[]) {
|
|
|
29
29
|
commit.includes("BREAKING CHANGE") ||
|
|
30
30
|
commit.includes("!") ||
|
|
31
31
|
commit.toLowerCase().startsWith("release") ||
|
|
32
|
-
commit.toLowerCase().startsWith("upgrade")
|
|
33
|
-
commit.toLowerCase().startsWith("remove")
|
|
32
|
+
commit.toLowerCase().startsWith("upgrade")
|
|
34
33
|
) {
|
|
35
34
|
return "major";
|
|
36
35
|
}
|
|
@@ -42,7 +41,8 @@ function determineIncrement(commits: string[]) {
|
|
|
42
41
|
} else if (
|
|
43
42
|
!increment &&
|
|
44
43
|
commit.startsWith("fix") ||
|
|
45
|
-
commit.startsWith("update")
|
|
44
|
+
commit.startsWith("update") ||
|
|
45
|
+
commit.toLowerCase().startsWith("remove")
|
|
46
46
|
) {
|
|
47
47
|
increment = "patch";
|
|
48
48
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Command} from 'commander';
|
|
2
|
-
import {RaitonCommands, RaitonConfig} from "
|
|
3
|
-
import {getPackageRoot} from "
|
|
4
|
-
import {CliTools} from "
|
|
2
|
+
import {RaitonCommands, RaitonConfig} from "../core";
|
|
3
|
+
import {getPackageRoot} from "../sdk";
|
|
4
|
+
import {CliTools} from "./cli-tools";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
export default async function bootstrapper(cli: Command) {
|
package/source/bin/cli-tools.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {RaitonCommand, RaitonBuilder} from "
|
|
1
|
+
import {RaitonCommand, RaitonBuilder} from "../core";
|
|
2
2
|
import {Logger} from "@protorians/logger";
|
|
3
|
-
import type {BuildCommandOptions} from "
|
|
3
|
+
import type {BuildCommandOptions} from "../types";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export default class ArtifactCommand extends RaitonCommand {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {RaitonCommand, RaitonBuilder} from "
|
|
1
|
+
import {RaitonCommand, RaitonBuilder} from "../core";
|
|
2
2
|
import {LBadge, Logger} from "@protorians/logger";
|
|
3
|
-
import type {BuildCommandOptions} from "
|
|
3
|
+
import type {BuildCommandOptions} from "../types";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export default class BuildCommand extends RaitonCommand {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {Raiton, RaitonCommand} from "
|
|
1
|
+
import {Raiton, RaitonCommand} from "../core";
|
|
2
2
|
import {ChildProcess, ChildProcessWithoutNullStreams} from 'node:child_process';
|
|
3
3
|
import {Logger} from "@protorians/logger";
|
|
4
|
-
import {EventMessageEnum} from "
|
|
5
|
-
import {CliTools} from "
|
|
4
|
+
import {EventMessageEnum} from "../sdk";
|
|
5
|
+
import {CliTools} from "../bin/cli-tools";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
|
|
8
8
|
export default class DevelopCommand extends RaitonCommand {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {RaitonCommand} from "
|
|
1
|
+
import {RaitonCommand} from "../core";
|
|
2
2
|
import {ChildProcess} from 'node:child_process';
|
|
3
|
-
import {Raiton} from "
|
|
4
|
-
import {CliTools} from "
|
|
3
|
+
import {Raiton} from "../core/raiton";
|
|
4
|
+
import {CliTools} from "../bin/cli-tools";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
|
|
7
7
|
export default class StartCommand extends RaitonCommand {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {PluginScope} from '
|
|
1
|
+
import {PluginScope} from './plugins/scope'
|
|
2
2
|
import {RequestContext} from './context'
|
|
3
|
-
import {ApplicationConfig, ApplicationInterface} from "
|
|
4
|
-
import {HttpMethod} from "
|
|
5
|
-
import {RouteHandler} from "
|
|
3
|
+
import {ApplicationConfig, ApplicationInterface} from "../types/application";
|
|
4
|
+
import {HttpMethod} from "../sdk";
|
|
5
|
+
import {RouteHandler} from "../types";
|
|
6
6
|
import {Logger} from "@protorians/logger";
|
|
7
|
-
import {RaitonConfig} from "
|
|
8
|
-
import {Artifacts} from "
|
|
7
|
+
import {RaitonConfig} from "./config";
|
|
8
|
+
import {Artifacts} from "../sdk/artifacts";
|
|
9
9
|
|
|
10
10
|
export class Application implements ApplicationInterface {
|
|
11
11
|
private root: PluginScope
|
package/source/core/builder.ts
CHANGED
|
@@ -2,16 +2,16 @@ import {RaitonConfig} from "./config";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import {RaitonDirectories} from "./directories";
|
|
4
4
|
import fs, {WatchEventType} from "node:fs";
|
|
5
|
-
import type {BuilderConfig, BuilderInterface,} from "
|
|
5
|
+
import type {BuilderConfig, BuilderInterface,} from "../types";
|
|
6
6
|
import {RaitonThread} from "./thread";
|
|
7
|
-
import {Raiton} from "
|
|
8
|
-
import {isControllerArtifact, isServiceArtifact} from "
|
|
9
|
-
import {ControllerBuilder} from "
|
|
7
|
+
import {Raiton} from "./raiton";
|
|
8
|
+
import {isControllerArtifact, isServiceArtifact} from "../sdk";
|
|
9
|
+
import {ControllerBuilder} from "./controller";
|
|
10
10
|
import {watch} from "fs";
|
|
11
11
|
import {LBadge, Logger} from "@protorians/logger";
|
|
12
|
-
import {Throwable} from "
|
|
13
|
-
import {Injection} from "
|
|
14
|
-
import {Artifacts} from "
|
|
12
|
+
import {Throwable} from "../sdk/exceptions";
|
|
13
|
+
import {Injection} from "./injection";
|
|
14
|
+
import {Artifacts} from "../sdk/artifacts";
|
|
15
15
|
|
|
16
16
|
export class RaitonBuilder implements BuilderInterface {
|
|
17
17
|
protected _source: string | null = null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
-
import {Configurable} from "
|
|
3
|
+
import {Configurable} from "../../types";
|
|
4
4
|
import {Logger} from "@protorians/logger";
|
|
5
|
-
import {Raiton} from "
|
|
5
|
+
import {Raiton} from "../raiton";
|
|
6
6
|
|
|
7
7
|
export class RaitonConfig {
|
|
8
8
|
static readonly current: Map<keyof Configurable, Configurable[keyof Configurable]> = new Map();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Configurable} from "
|
|
2
|
-
import {JsonUtil} from "
|
|
1
|
+
import {Configurable} from "../../types/config";
|
|
2
|
+
import {JsonUtil} from "../../sdk/utilities";
|
|
3
3
|
|
|
4
4
|
export async function defineConfig(config?: Configurable) {
|
|
5
5
|
const workdir = process.cwd();
|
package/source/core/context.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import {BuilderHMRDeclaration} from "
|
|
2
|
+
import {BuilderHMRDeclaration} from "../../types";
|
|
3
3
|
import {LBadge, Logger} from "@protorians/logger";
|
|
4
|
-
import {compileController} from "
|
|
5
|
-
import {RaitonThread} from "
|
|
6
|
-
import {Injection} from "
|
|
7
|
-
import {isControllerArtifact} from "
|
|
4
|
+
import {compileController} from "./compiler";
|
|
5
|
+
import {RaitonThread} from "../thread";
|
|
6
|
+
import {Injection} from "../injection";
|
|
7
|
+
import {isControllerArtifact} from "../../sdk";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
|
|
10
10
|
export class ControllerBuilder {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {ApplicationInterface} from "
|
|
2
|
-
import {getControllerMetadata} from "
|
|
3
|
-
import {createHandler} from "
|
|
4
|
-
import {Injection} from "
|
|
5
|
-
import {ControllerMetaInterface} from "
|
|
1
|
+
import {ApplicationInterface} from "../../types/application";
|
|
2
|
+
import {getControllerMetadata} from "..";
|
|
3
|
+
import {createHandler} from "../router";
|
|
4
|
+
import {Injection} from "../injection";
|
|
5
|
+
import {ControllerMetaInterface} from "../../types";
|
|
6
6
|
|
|
7
7
|
export function compileController(
|
|
8
8
|
ControllerClass: any,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ControllerMetaInterface} from "
|
|
2
|
-
import {METADATA_KEYS} from "
|
|
1
|
+
import {ControllerMetaInterface} from "../../types";
|
|
2
|
+
import {METADATA_KEYS} from "../../sdk";
|
|
3
3
|
import "reflect-metadata";
|
|
4
4
|
|
|
5
5
|
export function getControllerMetadata(target: any): ControllerMetaInterface {
|
package/source/core/hooks.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import type {IConstructor, ContainerDefinitionInterface} from "
|
|
2
|
+
import type {IConstructor, ContainerDefinitionInterface} from "../../types";
|
|
3
3
|
import {LifetimeEnum, TextUtility} from "@protorians/core";
|
|
4
4
|
import {Logger} from "@protorians/logger";
|
|
5
|
-
import {METADATA_KEYS} from "
|
|
6
|
-
import {Throwable} from "
|
|
5
|
+
import {METADATA_KEYS} from "../../sdk/constants";
|
|
6
|
+
import {Throwable} from "../../sdk/exceptions";
|
|
7
7
|
|
|
8
8
|
const camelCase = TextUtility.camelCase;
|
|
9
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {MiddlewareType} from '
|
|
2
|
-
import {Throwable} from "
|
|
1
|
+
import {MiddlewareType} from '../../types'
|
|
2
|
+
import {Throwable} from "../../sdk/exceptions";
|
|
3
3
|
|
|
4
4
|
export function middlewareCompose(middlewares: MiddlewareType[]) {
|
|
5
5
|
return function (request: any) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {HookStore} from '
|
|
2
|
-
import {MiddlewarePipeline} from '
|
|
3
|
-
import {Route, Router} from '
|
|
1
|
+
import {HookStore} from '../hooks'
|
|
2
|
+
import {MiddlewarePipeline} from '../middleware'
|
|
3
|
+
import {Route, Router} from '../router'
|
|
4
4
|
|
|
5
5
|
export class PluginScope {
|
|
6
6
|
public hooks: HookStore
|
package/source/core/raiton.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {ControllerMetaInterface, MiddlewareCallable, ParamMetaInterface, RouteMetaInterface} from "
|
|
2
|
-
import {METADATA_KEYS, Parametrable} from "
|
|
1
|
+
import {ControllerMetaInterface, MiddlewareCallable, ParamMetaInterface, RouteMetaInterface} from "../../types";
|
|
2
|
+
import {METADATA_KEYS, Parametrable} from "../../sdk";
|
|
3
3
|
import {Logger} from "@protorians/logger";
|
|
4
|
-
import {middlewareCompose, Raiton} from "
|
|
5
|
-
import {DataTransferObject} from "
|
|
6
|
-
import {Throwable} from "
|
|
7
|
-
import {HttpException} from "
|
|
8
|
-
import {ThrowableResponse} from "
|
|
4
|
+
import {middlewareCompose, Raiton} from "..";
|
|
5
|
+
import {DataTransferObject} from "../../sdk/data-transfer-object";
|
|
6
|
+
import {Throwable} from "../../sdk/exceptions/throwable";
|
|
7
|
+
import {HttpException} from "../../sdk/exceptions";
|
|
8
|
+
import {ThrowableResponse} from "../../sdk/responses/http-throwable";
|
|
9
9
|
|
|
10
10
|
export function createHandler(
|
|
11
11
|
instance: any,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {RouteHandler} from '
|
|
2
|
-
import {HttpMethod} from "
|
|
3
|
-
import {Route} from '
|
|
4
|
-
import {RouteMatcher} from '
|
|
1
|
+
import {RouteHandler} from '../../types'
|
|
2
|
+
import {HttpMethod} from "../../sdk/enums";
|
|
3
|
+
import {Route} from './route'
|
|
4
|
+
import {RouteMatcher} from './matcher'
|
|
5
5
|
|
|
6
6
|
export class Router {
|
|
7
7
|
private matcher = new RouteMatcher()
|
package/source/core/server.ts
CHANGED
package/source/core/thread.ts
CHANGED
|
@@ -6,17 +6,17 @@ import type {
|
|
|
6
6
|
ThreadOptions,
|
|
7
7
|
ThreadSetupOptions,
|
|
8
8
|
ThreadWaitCallable,
|
|
9
|
-
} from "
|
|
10
|
-
import {EventMessageEnum, RuntimeType} from "
|
|
9
|
+
} from "../types";
|
|
10
|
+
import {EventMessageEnum, RuntimeType} from "../sdk/enums";
|
|
11
11
|
import {ProcessUtility} from "@protorians/core";
|
|
12
12
|
import {until} from "./process.util";
|
|
13
|
-
import {ApplicationInterface} from "
|
|
14
|
-
import {Runtime} from "
|
|
13
|
+
import {ApplicationInterface} from "../types/application";
|
|
14
|
+
import {Runtime} from "../sdk/runtime";
|
|
15
15
|
import {LBadge, Logger} from "@protorians/logger";
|
|
16
|
-
import {ControllerBuilder} from "
|
|
17
|
-
import {bodyParserPlugin} from "
|
|
18
|
-
import {Injection} from "
|
|
19
|
-
import {Throwable} from "
|
|
16
|
+
import {ControllerBuilder} from "./controller";
|
|
17
|
+
import {bodyParserPlugin} from "../sdk/plugins/body-parser.plugin";
|
|
18
|
+
import {Injection} from "./injection/injection";
|
|
19
|
+
import {Throwable} from "../sdk/exceptions";
|
|
20
20
|
import os from "os";
|
|
21
21
|
|
|
22
22
|
|
package/source/sdk/artifacts.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {Injection} from "
|
|
1
|
+
import {Injection} from "../core/injection";
|
|
2
2
|
import {Logger} from "@protorians/logger";
|
|
3
|
-
import type {IConstructor} from "
|
|
4
|
-
import {Raiton} from "
|
|
5
|
-
import {isArtifact, isControllerArtifact} from "
|
|
3
|
+
import type {IConstructor} from "../types";
|
|
4
|
+
import {Raiton} from "../core/raiton";
|
|
5
|
+
import {isArtifact, isControllerArtifact} from "./utilities";
|
|
6
6
|
|
|
7
7
|
export class Artifacts {
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {getControllerMetadata} from "
|
|
2
|
-
import {Injectable} from "
|
|
1
|
+
import {getControllerMetadata} from "../../core/controller";
|
|
2
|
+
import {Injectable} from "..";
|
|
3
3
|
import {LifetimeEnum} from "@protorians/core";
|
|
4
|
-
import {ControllerDecoratorCallable} from "
|
|
4
|
+
import {ControllerDecoratorCallable} from "../../types";
|
|
5
5
|
|
|
6
6
|
export function Controllable(prefix = '') {
|
|
7
7
|
return (target: any) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import type {IConstructor} from "
|
|
3
|
-
import {Injection} from "
|
|
2
|
+
import type {IConstructor} from "../../types/contruct";
|
|
3
|
+
import {Injection} from "../../core/injection";
|
|
4
4
|
import {LifetimeEnum} from "@protorians/core";
|
|
5
5
|
import {Logger} from "@protorians/logger";
|
|
6
|
-
import {METADATA_KEYS} from "
|
|
6
|
+
import {METADATA_KEYS} from "../constants";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
export function Injectable(lifetime?: LifetimeEnum, name?: string, scope?: any) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import type {Context, ParamMetaInterface} from "
|
|
3
|
-
import {METADATA_KEYS, Parametrable} from "
|
|
2
|
+
import type {Context, ParamMetaInterface} from "../../types";
|
|
3
|
+
import {METADATA_KEYS, Parametrable} from "..";
|
|
4
4
|
|
|
5
5
|
function createRouteParametrableDecorator(type: ParamMetaInterface['type'], callable?: (context: Context) => any) {
|
|
6
6
|
return (key?: string) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {getControllerMetadata} from "
|
|
2
|
-
import {HttpMethod} from "
|
|
3
|
-
import {ControllerMetaInterface, RouteDecoratorCallable, RouteMetaInterface} from "
|
|
1
|
+
import {getControllerMetadata} from "../../core";
|
|
2
|
+
import {HttpMethod} from "..";
|
|
3
|
+
import {ControllerMetaInterface, RouteDecoratorCallable, RouteMetaInterface} from "../../types";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
function stabilizeRoute(meta: ControllerMetaInterface, {path, method, propertyKey}: Partial<RouteMetaInterface>) {
|
package/source/sdk/encryption.ts
CHANGED
|
@@ -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 "
|
|
5
|
+
import {IDerivationOptions, IEncryptionResult, IScryptOptions} from "../types";
|
|
6
6
|
|
|
7
7
|
export class Encryption {
|
|
8
8
|
static get algos() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {HttpStatus} from "
|
|
2
|
-
import {Raiton} from "
|
|
3
|
-
import {HttpResponseBaseInterface} from "
|
|
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 "
|
|
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,7 +1,7 @@
|
|
|
1
|
-
import type {MiddlewareParameters, Plugin} from "
|
|
2
|
-
import {RequestContext} from "
|
|
1
|
+
import type {MiddlewareParameters, Plugin} from "../../types";
|
|
2
|
+
import {RequestContext} from "../../core/context";
|
|
3
3
|
import {Logger} from "@protorians/logger";
|
|
4
|
-
import {tryParseJson} from "
|
|
4
|
+
import {tryParseJson} from "../utilities/json.util";
|
|
5
5
|
|
|
6
6
|
export function bodyParserPlugin(): Plugin {
|
|
7
7
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {definePlugin} from "
|
|
2
|
-
import {Context, MiddlewareParameters, NextCallable} from "
|
|
1
|
+
import {definePlugin} from "../../../core/plugins";
|
|
2
|
+
import {Context, MiddlewareParameters, NextCallable} from "../../../types";
|
|
3
3
|
|
|
4
4
|
export interface CorsOptions {
|
|
5
5
|
origin?: string | string[]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {definePlugin} from "
|
|
2
|
-
import {Context, MiddlewareParameters, NextCallable} from "
|
|
1
|
+
import {definePlugin} from "../../../core/plugins";
|
|
2
|
+
import {Context, MiddlewareParameters, NextCallable} from "../../../types";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export const secureHeaders = definePlugin((scope) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {definePlugin} from "
|
|
2
|
-
import {Context, MiddlewareParameters, NextCallable} from "
|
|
1
|
+
import {definePlugin} from "../../../core/plugins";
|
|
2
|
+
import {Context, MiddlewareParameters, NextCallable} from "../../../types";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export const secureMethodGuard = (allowed: string[]) =>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {definePlugin} from "
|
|
2
|
-
import {Context, MiddlewareParameters, NextCallable} from "
|
|
1
|
+
import {definePlugin} from "../../../core/plugins";
|
|
2
|
+
import {Context, MiddlewareParameters, NextCallable} from "../../../types";
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export interface RateLimitOptions {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {HttpResponse, HttpStatus} from "
|
|
2
|
-
import {HttpResponseInterface} from "
|
|
3
|
-
import {Raiton} from "
|
|
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 "
|
|
2
|
-
import {HttpStatus} from "
|
|
3
|
-
import {Raiton} from "
|
|
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 "
|
|
2
|
-
import {HttpStatus} from "
|
|
3
|
-
import {ThrowableResponse} from "
|
|
1
|
+
import {HttpResponseInterface} from "../../types";
|
|
2
|
+
import {HttpStatus} from "../enums";
|
|
3
|
+
import {ThrowableResponse} from ".";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export class HttpResponse {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {RuntimeAdapterInterface, RuntimeHandlerCallable, RuntimeInterface, RuntimeServerInterface} from "
|
|
2
|
-
import {RuntimeType} from "
|
|
3
|
-
import {nodeRuntime} from "
|
|
4
|
-
import {bunRuntime} from "
|
|
5
|
-
import {denoRuntime} from "
|
|
6
|
-
import {webRuntime} from "
|
|
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 {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {RuntimeAdapterInterface, RuntimeReplyInterface, RuntimeRequestInterface} from '
|
|
1
|
+
import {RuntimeAdapterInterface, RuntimeReplyInterface, RuntimeRequestInterface} from '../../../types'
|
|
2
2
|
|
|
3
3
|
export const webRuntime: RuntimeAdapterInterface = {
|
|
4
4
|
createServer(handler) {
|
package/source/types/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {HttpMethod, Parametrable} from "
|
|
2
|
-
import {Context} from "
|
|
3
|
-
import {MiddlewareCallable, MiddlewareType} from "
|
|
1
|
+
import {HttpMethod, Parametrable} from "../sdk/enums";
|
|
2
|
+
import {Context} from "./core";
|
|
3
|
+
import {MiddlewareCallable, MiddlewareType} from "./middleware";
|
|
4
4
|
|
|
5
5
|
export interface ControllerMetaInterface {
|
|
6
6
|
prefix?: string;
|
package/source/types/plugin.ts
CHANGED
package/source/types/raiton.ts
CHANGED
package/source/types/router.ts
CHANGED
package/source/types/runtime.ts
CHANGED
package/source/types/thread.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {BuilderInterface} from "
|
|
2
|
-
import {RuntimeAdapterInterface} from "
|
|
3
|
-
import {ApplicationInterface} from "
|
|
4
|
-
import {RuntimeType} from "
|
|
1
|
+
import {BuilderInterface} from "./builder";
|
|
2
|
+
import {RuntimeAdapterInterface} from "./runtime";
|
|
3
|
+
import {ApplicationInterface} from "./application";
|
|
4
|
+
import {RuntimeType} from "../sdk/enums/runtime.enum";
|
|
5
5
|
|
|
6
6
|
export interface ThreadSetupOptions {
|
|
7
7
|
application: ApplicationInterface;
|