raiton 6.5.0-beta.13 → 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.
Files changed (166) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +16 -9
  3. package/build/bin/index.mjs +10288 -6059
  4. package/deno.json +4 -1
  5. package/docs/contributors/framework/README.md +2 -0
  6. package/docs/contributors/framework/cache/README.md +55 -0
  7. package/docs/contributors/framework/cache/cache.md +86 -0
  8. package/docs/contributors/framework/cache/etag.md +82 -0
  9. package/docs/contributors/framework/decorators/README.md +1 -0
  10. package/docs/contributors/framework/plugins/csrf.md +277 -0
  11. package/docs/contributors/framework/plugins/security.md +40 -6
  12. package/docs/contributors/framework/runtime.md +13 -3
  13. package/docs/user-guide/README.md +8 -4
  14. package/docs/user-guide/best-practices.md +1 -0
  15. package/docs/user-guide/cache.md +79 -0
  16. package/docs/user-guide/cli.md +35 -3
  17. package/docs/user-guide/csrf.md +557 -0
  18. package/docs/user-guide/decorators/README.md +3 -0
  19. package/docs/user-guide/decorators/cache.md +79 -0
  20. package/docs/user-guide/decorators/health-check.md +125 -0
  21. package/docs/user-guide/health-check.md +117 -0
  22. package/docs/user-guide/runtime.md +2 -1
  23. package/docs/user-guide/security.md +8 -2
  24. package/package.json +8 -3
  25. package/source/bin/bootstrapper.ts +4 -4
  26. package/source/bin/cli-tools.ts +27 -3
  27. package/source/bin/cli.ts +2 -2
  28. package/source/bin/commands.registry.ts +17 -0
  29. package/source/bin/constants.ts +1 -0
  30. package/source/bin/index.ts +2 -2
  31. package/source/commands/artifact.command.ts +2 -2
  32. package/source/commands/build.command.ts +2 -2
  33. package/source/commands/develop.command.ts +4 -5
  34. package/source/commands/grafts.command.ts +1 -1
  35. package/source/commands/start.command.ts +2 -2
  36. package/source/core/application.ts +10 -10
  37. package/source/core/artifacts/artifact.ts +1 -1
  38. package/source/core/artifacts/index.ts +1 -1
  39. package/source/core/builder.ts +69 -15
  40. package/source/core/bytes.util.ts +1 -1
  41. package/source/core/commands.ts +24 -14
  42. package/source/core/config/config.ts +2 -2
  43. package/source/core/config/define.ts +2 -2
  44. package/source/core/config/index.ts +2 -2
  45. package/source/core/context.ts +1 -1
  46. package/source/core/controller/builder.ts +31 -8
  47. package/source/core/controller/compiler.ts +6 -6
  48. package/source/core/controller/index.ts +4 -4
  49. package/source/core/controller/metadata.ts +2 -2
  50. package/source/core/controller/tracker.ts +1 -1
  51. package/source/core/directories.ts +3 -2
  52. package/source/core/guards.ts +1 -1
  53. package/source/core/helpers/index.ts +1 -1
  54. package/source/core/hooks.ts +1 -1
  55. package/source/core/index.ts +16 -16
  56. package/source/core/injection/index.ts +1 -1
  57. package/source/core/injection/injection.ts +3 -3
  58. package/source/core/mcp/builder.ts +8 -8
  59. package/source/core/mcp/index.ts +3 -3
  60. package/source/core/mcp/metadata.ts +2 -2
  61. package/source/core/mcp/tracker.ts +1 -1
  62. package/source/core/middleware/compose.ts +2 -2
  63. package/source/core/middleware/index.ts +2 -2
  64. package/source/core/middleware/pipeline.ts +2 -2
  65. package/source/core/plugins/index.ts +2 -2
  66. package/source/core/plugins/plugin.ts +1 -1
  67. package/source/core/plugins/scope.ts +4 -4
  68. package/source/core/raiton.ts +1 -1
  69. package/source/core/router/handler.ts +30 -6
  70. package/source/core/router/handler.utils.ts +3 -3
  71. package/source/core/router/index.ts +4 -4
  72. package/source/core/router/matcher.ts +1 -1
  73. package/source/core/router/route.ts +1 -1
  74. package/source/core/router/router.ts +4 -4
  75. package/source/core/server.ts +1 -1
  76. package/source/core/socket/builder.ts +2 -2
  77. package/source/core/socket/index.ts +2 -2
  78. package/source/core/socket/metadata.ts +2 -2
  79. package/source/core/thread.ts +53 -20
  80. package/source/framework/artifacts.ts +8 -5
  81. package/source/framework/cache/cache.decorator.ts +35 -0
  82. package/source/framework/cache/cache.ts +197 -0
  83. package/source/framework/cache/etag.ts +174 -0
  84. package/source/framework/cache/index.ts +4 -0
  85. package/source/framework/cache/types.ts +111 -0
  86. package/source/framework/constants/decorators.constant.ts +4 -0
  87. package/source/framework/constants/index.ts +2 -2
  88. package/source/framework/decorators/access-guard.decorator.ts +2 -2
  89. package/source/framework/decorators/api-response.decorator.ts +1 -1
  90. package/source/framework/decorators/api.decorator.ts +1 -1
  91. package/source/framework/decorators/controllable.decorator.ts +3 -3
  92. package/source/framework/decorators/csrf-guard.decorator.ts +60 -0
  93. package/source/framework/decorators/csrf-token.decorator.ts +20 -0
  94. package/source/framework/decorators/guard.decorator.ts +4 -4
  95. package/source/framework/decorators/health-check.decorator.ts +50 -0
  96. package/source/framework/decorators/index.ts +14 -11
  97. package/source/framework/decorators/injection.decorator.ts +3 -3
  98. package/source/framework/decorators/mcp.decorator.ts +4 -4
  99. package/source/framework/decorators/middleware.decorator.ts +2 -2
  100. package/source/framework/decorators/parametrable.decorator.ts +2 -2
  101. package/source/framework/decorators/routable.decorator.ts +3 -3
  102. package/source/framework/decorators/route-interaction.decorator.ts +4 -4
  103. package/source/framework/decorators/socket.decorator.ts +3 -3
  104. package/source/framework/encryption.ts +2 -2
  105. package/source/framework/enums/csrf.enum.ts +4 -0
  106. package/source/framework/enums/index.ts +8 -7
  107. package/source/framework/enums/runtime.enum.ts +1 -2
  108. package/source/framework/env.ts +2 -2
  109. package/source/framework/exceptions/http-exception.ts +3 -3
  110. package/source/framework/exceptions/index.ts +2 -2
  111. package/source/framework/health-check.ts +137 -0
  112. package/source/framework/index.ts +18 -16
  113. package/source/framework/mcp/handler.ts +3 -3
  114. package/source/framework/mcp/index.ts +3 -3
  115. package/source/framework/mcp/protocol.ts +1 -1
  116. package/source/framework/mcp/streamable-http.ts +3 -3
  117. package/source/framework/parameter-bag.ts +2 -2
  118. package/source/framework/plugins/body-parser.plugin.ts +3 -3
  119. package/source/framework/plugins/index.ts +4 -4
  120. package/source/framework/plugins/mcp.plugin.ts +5 -5
  121. package/source/framework/plugins/openapi.plugin.ts +4 -4
  122. package/source/framework/plugins/security/body-limit.ts +3 -3
  123. package/source/framework/plugins/security/cors.ts +2 -2
  124. package/source/framework/plugins/security/csrf.ts +145 -0
  125. package/source/framework/plugins/security/headers.ts +2 -2
  126. package/source/framework/plugins/security/index.ts +7 -5
  127. package/source/framework/plugins/security/method-guard.ts +3 -3
  128. package/source/framework/plugins/security/rate-limit.ts +3 -3
  129. package/source/framework/repositories.ts +1 -1
  130. package/source/framework/responses/error.ts +2 -2
  131. package/source/framework/responses/helpers.ts +3 -3
  132. package/source/framework/responses/http-throwable.ts +3 -3
  133. package/source/framework/responses/http.ts +3 -3
  134. package/source/framework/responses/index.ts +4 -4
  135. package/source/framework/runtime/bun/server.ts +5 -5
  136. package/source/framework/runtime/deno/server.ts +156 -96
  137. package/source/framework/runtime/index.ts +11 -17
  138. package/source/framework/runtime/node/reply.ts +1 -1
  139. package/source/framework/runtime/node/request.ts +2 -2
  140. package/source/framework/runtime/node/server.ts +3 -3
  141. package/source/framework/runtime/web/server.ts +2 -2
  142. package/source/framework/services.ts +1 -1
  143. package/source/framework/utilities/artifact.util.ts +4 -0
  144. package/source/framework/utilities/csrf.util.ts +162 -0
  145. package/source/framework/utilities/index.ts +10 -9
  146. package/source/framework/utilities/openapi.utils.ts +7 -7
  147. package/source/framework/utilities/utilities.util.ts +1 -1
  148. package/source/types/application.ts +2 -2
  149. package/source/types/builder.ts +1 -1
  150. package/source/types/config.ts +1 -1
  151. package/source/types/controller.ts +3 -3
  152. package/source/types/core.ts +1 -1
  153. package/source/types/csrf.ts +38 -0
  154. package/source/types/guard.ts +1 -1
  155. package/source/types/http-responses.ts +1 -1
  156. package/source/types/index.ts +26 -25
  157. package/source/types/injection.ts +1 -1
  158. package/source/types/middleware.ts +1 -1
  159. package/source/types/plugin.ts +1 -1
  160. package/source/types/raiton.ts +1 -1
  161. package/source/types/responses.ts +2 -2
  162. package/source/types/router.ts +2 -2
  163. package/source/types/runtime.ts +3 -5
  164. package/source/types/thread.ts +4 -4
  165. /package/source/framework/utilities/{https.ts → https.util.ts} +0 -0
  166. /package/source/framework/utilities/{url.ts → url.util.ts} +0 -0
@@ -1,16 +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 "./plugins/index"
7
- export * from "./runtime/index"
8
- export * from "./mcp/index"
9
- export * from "./exceptions/index"
10
- export * from "./controllers"
11
- export * from "./data-transfer-object"
12
- export * from "./view-model"
13
- export * from "./encryption"
14
- export * from "./parameter-bag"
15
- export * from "./repositories"
16
- export * from "./services"
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"
@@ -2,7 +2,7 @@ import type {
2
2
  JsonRpcError,
3
3
  JsonRpcRequest,
4
4
  JsonRpcResponse,
5
- } from "../../types";
5
+ } from "../../types/index.ts";
6
6
 
7
7
  export const McpVersion = '2024-11-05'
8
8
  export const LatestProtocolVersion = '2024-11-05'
@@ -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 {
@@ -0,0 +1,145 @@
1
+ import crypto from "node:crypto";
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
+
9
+ const DEFAULT_METHODS = ['POST', 'PUT', 'PATCH', 'DELETE']
10
+ const DEFAULT_COOKIE_NAME = '_csrf'
11
+ const DEFAULT_HEADER_NAME = 'X-CSRF-Token'
12
+ const DEFAULT_TTL = 3600_000
13
+
14
+ export const secureCsrf = (opts: CsrfOptions = {}) => {
15
+
16
+ return definePlugin((scope) => {
17
+ const mode = opts.mode ?? CSRF_MODE_DEFAULT
18
+ const secret = opts.secret ?? cryptoRandomSecret()
19
+ const cookieName = opts.cookieName ?? DEFAULT_COOKIE_NAME
20
+ const headerName = opts.headerName ?? DEFAULT_HEADER_NAME
21
+ const ttl = opts.ttl ?? DEFAULT_TTL
22
+ const methods = (opts.methods ?? DEFAULT_METHODS).map(m => m.toUpperCase())
23
+ const skipPaths = opts.skip ?? []
24
+ const cookieOpts: CsrfCookieOptions = {
25
+ httpOnly: false,
26
+ secure: false,
27
+ sameSite: 'lax',
28
+ path: '/',
29
+ ...opts.cookieOptions,
30
+ }
31
+
32
+ const tokenStore = mode === CSRF_MODE_SYNCHRONIZER
33
+ ? CsrfUtil.createTokenStore(ttl)
34
+ : undefined
35
+
36
+ const destroy = () => {
37
+ tokenStore?.destroy()
38
+ }
39
+
40
+ scope.addHook('onResponse', async (ctx: any) => {
41
+ if (ctx && typeof ctx === 'object' && 'reply' in ctx) {
42
+ const method = (ctx.req?.method ?? '').toUpperCase()
43
+ if (methods.includes(method)) {
44
+ const token = tokenStore
45
+ ? tokenStore.create()
46
+ : CsrfUtil.generateDoubleSubmitToken(secret)
47
+
48
+ ctx.state = ctx.state ?? {}
49
+ ctx.state.csrfToken = token
50
+
51
+ ctx.reply.header(
52
+ 'Set-Cookie',
53
+ CsrfUtil.serializeCookie(cookieName, token, cookieOpts)
54
+ )
55
+ }
56
+ }
57
+ })
58
+
59
+ scope.use(async ({context, next}: MiddlewareParametersInterface) => {
60
+ const method = (context.req.method ?? '').toUpperCase()
61
+
62
+ if (method === 'GET' || method === 'HEAD' || method === 'OPTIONS') {
63
+ const token = tokenStore
64
+ ? tokenStore.create()
65
+ : CsrfUtil.generateDoubleSubmitToken(secret)
66
+
67
+ context.state = context.state ?? {}
68
+ context.state.csrfToken = token
69
+
70
+ context.reply.header(
71
+ 'Set-Cookie',
72
+ CsrfUtil.serializeCookie(cookieName, token, cookieOpts)
73
+ )
74
+
75
+ return next()
76
+ }
77
+
78
+ if (!methods.includes(method)) {
79
+ return next()
80
+ }
81
+
82
+ const requestPath = new URL(context.req.url, 'http://localhost').pathname
83
+ if (skipPaths.some(p => requestPath.startsWith(p))) {
84
+ return next()
85
+ }
86
+
87
+ const isBrowser = CsrfUtil.isBrowserClient(context.req.headers, opts.client)
88
+ if (!isBrowser) {
89
+ return next()
90
+ }
91
+
92
+ const cookieHeader = context.req.headers.get('cookie') ?? ''
93
+ const cookieToken = CsrfUtil.extractCookieValue(cookieHeader, cookieName)
94
+ const headerToken = context.req.headers.get(headerName.toLowerCase())
95
+
96
+ if (!cookieToken || !headerToken) {
97
+ context.reply.status(HttpStatus.FORBIDDEN)
98
+ return context.reply.send(
99
+ RaitonResponses(
100
+ 'CSRF token missing',
101
+ null,
102
+ HttpStatus.FORBIDDEN,
103
+ {error: true}
104
+ )
105
+ )
106
+ }
107
+
108
+ let valid = false
109
+
110
+ if (mode === CSRF_MODE_DOUBLE_SUBMIT) {
111
+ valid = CsrfUtil.validateDoubleSubmitToken(secret, cookieToken, ttl)
112
+ && CsrfUtil.timingSafeEqual(cookieToken, headerToken)
113
+ } else {
114
+ const storeValid = tokenStore?.validate(cookieToken) ?? false
115
+ valid = storeValid && CsrfUtil.timingSafeEqual(cookieToken, headerToken)
116
+ }
117
+
118
+ if (!valid) {
119
+ context.reply.status(HttpStatus.FORBIDDEN)
120
+ return context.reply.send(
121
+ RaitonResponses(
122
+ 'CSRF token invalid',
123
+ null,
124
+ HttpStatus.FORBIDDEN,
125
+ {error: true}
126
+ )
127
+ )
128
+ }
129
+
130
+ context.state = context.state ?? {}
131
+ context.state.csrfValidated = true
132
+
133
+ await next()
134
+ })
135
+
136
+ }, 'csrf')
137
+ }
138
+
139
+ function cryptoRandomSecret(): string {
140
+ return crypto.randomBytes(32).toString('hex')
141
+ }
142
+
143
+ const CSRF_MODE_DEFAULT = CSRFModeEnum.DOUBLE_SUBMIT
144
+ const CSRF_MODE_SYNCHRONIZER = CSRFModeEnum.SYNCHRONIZER
145
+ const CSRF_MODE_DOUBLE_SUBMIT = CSRFModeEnum.DOUBLE_SUBMIT
@@ -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) => {
@@ -1,8 +1,9 @@
1
- import {secureHeaders} from './headers'
2
- import {secureCors} from './cors'
3
- import {secureRateLimit} from './rate-limit'
4
- import {secureBodyLimit} from './body-limit'
5
- import {secureMethodGuard} from './method-guard'
1
+ import {secureHeaders} from './headers.ts'
2
+ import {secureCors} from './cors.ts'
3
+ import {secureRateLimit} from './rate-limit.ts'
4
+ import {secureBodyLimit} from './body-limit.ts'
5
+ import {secureMethodGuard} from './method-guard.ts'
6
+ import {secureCsrf} from './csrf.ts'
6
7
 
7
8
  export class Security {
8
9
  static headers = secureHeaders
@@ -10,4 +11,5 @@ export class Security {
10
11
  static rateLimit = secureRateLimit
11
12
  static bodyLimit = secureBodyLimit
12
13
  static methodGuard = secureMethodGuard
14
+ static csrf = secureCsrf
13
15
  }
@@ -1,6 +1,6 @@
1
- import {definePlugin} from "../../../core/plugins";
2
- import {ContextInterface, MiddlewareParametersInterface, MiddlewareNextCallable} from "../../../types";
3
- import {RaitonResponses, HttpStatus} from "../..";
1
+ import {definePlugin} from "../../../core/plugins/index.ts";
2
+ import {ContextInterface, MiddlewareParametersInterface, MiddlewareNextCallable} from "../../../types/index.ts";
3
+ import {RaitonResponses, HttpStatus} from "../../index.ts";
4
4
 
5
5
 
6
6
  export const secureMethodGuard = (allowed: string[]) =>
@@ -1,6 +1,6 @@
1
- import {definePlugin} from "../../../core/plugins";
2
- import {ContextInterface, MiddlewareParametersInterface, MiddlewareNextCallable} from "../../../types";
3
- import {RaitonResponses, HttpStatus} from "../..";
1
+ import {definePlugin} from "../../../core/plugins/index.ts";
2
+ import {ContextInterface, MiddlewareParametersInterface, MiddlewareNextCallable} from "../../../types/index.ts";
3
+ import {RaitonResponses, HttpStatus} from "../../index.ts";
4
4
 
5
5
 
6
6
  export interface RateLimitOptions {
@@ -1,4 +1,4 @@
1
- import {Throwable} from "./exceptions";
1
+ import {Throwable} from "./exceptions/index.ts";
2
2
 
3
3
 
4
4
  export class DelegateRepository {
@@ -1,5 +1,5 @@
1
- import type {ErrorResponseInterface} from "../../types";
2
- import {HttpResponse} from "./http";
1
+ import type {ErrorResponseInterface} from "../../types/index.ts";
2
+ import {HttpResponse} from "./http.ts";
3
3
 
4
4
 
5
5
  export class HttpErrorResponse {
@@ -1,6 +1,6 @@
1
- import {HttpResponse, HttpStatus} from "..";
2
- import {HttpResponseInterface} from "../../types";
3
- import {Raiton} from "../../core";
1
+ import {HttpResponse, HttpStatus} from "../index.ts";
2
+ import {HttpResponseInterface} from "../../types/index.ts";
3
+ import {Raiton} from "../../core/index.ts";
4
4
 
5
5
 
6
6
  export function RaitonResponses(
@@ -1,6 +1,6 @@
1
- import {HttpResponseInterface} from "../../types";
2
- import {HttpStatus} from "../enums";
3
- import {Raiton} from "../../core";
1
+ import {HttpResponseInterface} from "../../types/index.ts";
2
+ import {HttpStatus} from "../enums/index.ts";
3
+ import {Raiton} from "../../core/index.ts";
4
4
 
5
5
 
6
6
  export class ThrowableResponse extends Error {
@@ -1,6 +1,6 @@
1
- import {HttpResponseInterface} from "../../types";
2
- import {HttpStatus} from "../enums";
3
- import {ThrowableResponse} from ".";
1
+ import {HttpResponseInterface} from "../../types/index.ts";
2
+ import {HttpStatus} from "../enums/index.ts";
3
+ import {ThrowableResponse} from "./index.ts";
4
4
 
5
5
 
6
6
  export class HttpResponse {
@@ -1,4 +1,4 @@
1
- export * from "./error"
2
- export * from "./http-throwable"
3
- export * from "./http"
4
- export * from "./helpers"
1
+ export * from "./error.ts"
2
+ export * from "./http-throwable.ts"
3
+ export * from "./http.ts"
4
+ export * from "./helpers.ts"
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  RuntimeAdapterInterface,
3
3
  RuntimeServerOptionsInterface,
4
- } from '../../../types'
4
+ } from '../../../types/index.ts'
5
5
  import {Logger} from "@protorians/logger";
6
- import {getRealIp} from "../../utilities";
7
- import {findSocketForPath} from "../../../core/socket";
8
- import {Injection} from "../../../core/injection";
9
- import {RaitonResponses, HttpStatus} from "../..";
6
+ import {getRealIp} from "../../utilities/index.ts";
7
+ import {findSocketForPath} from "../../../core/socket/index.ts";
8
+ import {Injection} from "../../../core/injection/index.ts";
9
+ import {RaitonResponses, HttpStatus} from "../../index.ts";
10
10
 
11
11
  export const bunRuntime: RuntimeAdapterInterface = {
12
12
  createServer(handler, options?: RuntimeServerOptionsInterface) {