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,17 @@
|
|
|
1
|
+
import ArtifactCommand from "../commands/artifact.command.ts";
|
|
2
|
+
import BuildCommand from "../commands/build.command.ts";
|
|
3
|
+
import DevelopCommand from "../commands/develop.command.ts";
|
|
4
|
+
import GraftsCommand from "../commands/grafts.command.ts";
|
|
5
|
+
import StartCommand from "../commands/start.command.ts";
|
|
6
|
+
import type {Command} from "commander";
|
|
7
|
+
import type {RaitonCommand} from "../core/index.ts";
|
|
8
|
+
|
|
9
|
+
export type RaitonCommandConstructor = new (cli: Command, workdir: string, appdir: string) => RaitonCommand;
|
|
10
|
+
|
|
11
|
+
export const RaitonCommandsRegistry: RaitonCommandConstructor[] = [
|
|
12
|
+
ArtifactCommand,
|
|
13
|
+
BuildCommand,
|
|
14
|
+
DevelopCommand,
|
|
15
|
+
GraftsCommand,
|
|
16
|
+
StartCommand,
|
|
17
|
+
];
|
package/source/bin/constants.ts
CHANGED
package/source/bin/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {RaitonCommand, RaitonBuilder} from "../core";
|
|
1
|
+
import {RaitonCommand, RaitonBuilder} from "../core/index.ts";
|
|
2
2
|
import {Logger} from "@protorians/logger";
|
|
3
|
-
import type {BuildCommandOptionsInterface} from "../types";
|
|
3
|
+
import type {BuildCommandOptionsInterface} from "../types/index.ts";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export default class ArtifactCommand extends RaitonCommand {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {RaitonCommand, RaitonBuilder} from "../core";
|
|
1
|
+
import {RaitonCommand, RaitonBuilder} from "../core/index.ts";
|
|
2
2
|
import {LBadge, Logger} from "@protorians/logger";
|
|
3
|
-
import type {BuildCommandOptionsInterface} from "../types";
|
|
3
|
+
import type {BuildCommandOptionsInterface} from "../types/index.ts";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export default class BuildCommand extends RaitonCommand {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/// <reference types="deno" />
|
|
2
|
-
import {Raiton, RaitonCommand} from "../core";
|
|
2
|
+
import {Raiton, RaitonCommand} from "../core/index.ts";
|
|
3
3
|
import {ChildProcess, ChildProcessWithoutNullStreams} from 'node:child_process';
|
|
4
4
|
import {Logger} from "@protorians/logger";
|
|
5
|
-
import {EventMessageEnum} from "../framework";
|
|
6
|
-
import {CliTools} from "../bin/cli-tools";
|
|
7
|
-
import path from "node:path";
|
|
5
|
+
import {EventMessageEnum} from "../framework/index.ts";
|
|
6
|
+
import {CliTools} from "../bin/cli-tools.ts";
|
|
8
7
|
|
|
9
8
|
export default class DevelopCommand extends RaitonCommand {
|
|
10
9
|
public readonly name: string = 'develop';
|
|
@@ -32,7 +31,7 @@ export default class DevelopCommand extends RaitonCommand {
|
|
|
32
31
|
protected async run(): Promise<void> {
|
|
33
32
|
// Logger.info('Workdir', this.workdir);
|
|
34
33
|
|
|
35
|
-
const entryPoint =
|
|
34
|
+
const entryPoint = CliTools.cliEntry(this.appdir);
|
|
36
35
|
this.child = CliTools.spawn(entryPoint, ['build', '-d'], {
|
|
37
36
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
38
37
|
cwd: this.workdir
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="deno" />
|
|
2
|
-
import {RaitonBuilder, RaitonCommand} from "../core";
|
|
2
|
+
import {RaitonBuilder, RaitonCommand} from "../core/index.ts";
|
|
3
3
|
import {ChildProcess} from 'node:child_process';
|
|
4
4
|
import {LBadge, Logger} from "@protorians/logger";
|
|
5
|
-
import {StartCommandOptionsInterface} from "../types";
|
|
5
|
+
import {StartCommandOptionsInterface} from "../types/index.ts";
|
|
6
6
|
|
|
7
7
|
export default class StartCommand extends RaitonCommand {
|
|
8
8
|
public readonly name: string = 'start';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {Security, bodyParserPlugin} from "../framework/plugins";
|
|
2
|
-
import {PluginScope} from './plugins/scope'
|
|
3
|
-
import {RequestContext} from './context'
|
|
4
|
-
import {ApplicationConfigInterface, ApplicationInterface} from "../types/application";
|
|
5
|
-
import {HttpException, HttpMethod, ThrowableResponse, RaitonResponses, HttpStatus} from "../framework";
|
|
6
|
-
import {RouteHandlerCallable} from "../types";
|
|
1
|
+
import {Security, bodyParserPlugin} from "../framework/plugins/index.ts";
|
|
2
|
+
import {PluginScope} from './plugins/scope.ts'
|
|
3
|
+
import {RequestContext} from './context.ts'
|
|
4
|
+
import {ApplicationConfigInterface, ApplicationInterface} from "../types/application.ts";
|
|
5
|
+
import {HttpException, HttpMethod, ThrowableResponse, RaitonResponses, HttpStatus} from "../framework/index.ts";
|
|
6
|
+
import {RouteHandlerCallable} from "../types/index.ts";
|
|
7
7
|
import {Logger} from "@protorians/logger";
|
|
8
|
-
import {RaitonConfig} from "./config";
|
|
9
|
-
import {Artifacts} from "../framework/artifacts";
|
|
10
|
-
import {Injection} from "./injection";
|
|
11
|
-
import {HttpsConfigInterface, resolveHttpsConfig} from "../framework/utilities/https.util";
|
|
8
|
+
import {RaitonConfig} from "./config/index.ts";
|
|
9
|
+
import {Artifacts} from "../framework/artifacts.ts";
|
|
10
|
+
import {Injection} from "./injection/index.ts";
|
|
11
|
+
import {HttpsConfigInterface, resolveHttpsConfig} from "../framework/utilities/https.util.ts";
|
|
12
12
|
|
|
13
13
|
export class Application implements ApplicationInterface {
|
|
14
14
|
private root: PluginScope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./artifact";
|
|
1
|
+
export * from "./artifact.ts";
|
package/source/core/builder.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {RaitonConfig} from "./config";
|
|
1
|
+
import {RaitonConfig} from "./config/index.ts";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {RaitonDirectories} from "./directories";
|
|
3
|
+
import {RaitonDirectories} from "./directories.ts";
|
|
4
4
|
import fs, {WatchEventType} from "node:fs";
|
|
5
|
-
import type {BuilderConfigInterface, BuilderInterface, ThreadInterface,} from "../types";
|
|
6
|
-
import {RaitonThread} from "./thread";
|
|
7
|
-
import {Raiton} from "./raiton";
|
|
8
|
-
import {ControllerBuilder} from "./controller";
|
|
5
|
+
import type {BuilderConfigInterface, BuilderInterface, ThreadInterface,} from "../types/index.ts";
|
|
6
|
+
import {RaitonThread} from "./thread.ts";
|
|
7
|
+
import {Raiton} from "./raiton.ts";
|
|
8
|
+
import {ControllerBuilder} from "./controller/index.ts";
|
|
9
9
|
import {watch} from "fs";
|
|
10
10
|
import {LBadge, Logger} from "@protorians/logger";
|
|
11
|
-
import {Throwable} from "../framework/exceptions";
|
|
12
|
-
import {Artifacts, HMR_CHANNELS, HmrChannel} from "../framework/artifacts";
|
|
11
|
+
import {Throwable} from "../framework/exceptions/index.ts";
|
|
12
|
+
import {Artifacts, HMR_CHANNELS, HmrChannel} from "../framework/artifacts.ts";
|
|
13
13
|
import {build} from "esbuild";
|
|
14
14
|
import {execSync, spawn, spawnSync} from "node:child_process";
|
|
15
|
+
import {isNodeUsed} from "../bin/constants.ts";
|
|
15
16
|
|
|
16
17
|
export class RaitonBuilder implements BuilderInterface {
|
|
17
18
|
protected _source: string | null = null;
|
|
@@ -55,6 +56,14 @@ export class RaitonBuilder implements BuilderInterface {
|
|
|
55
56
|
const classification = Artifacts.classify(filename)
|
|
56
57
|
if (!classification) return
|
|
57
58
|
|
|
59
|
+
// Sur Node, le rechargement d'artefacts TypeScript en mémoire n'est pas
|
|
60
|
+
// possible (import() natif des fichiers .ts). On bascule alors sur le
|
|
61
|
+
// redémarrage de processus via IPC RESTART géré par la commande `develop`.
|
|
62
|
+
if (isNodeUsed) {
|
|
63
|
+
Raiton.thread?.restart()
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
|
|
58
67
|
const payload = {
|
|
59
68
|
filename,
|
|
60
69
|
timestamp: Date.now(),
|
|
@@ -102,7 +111,7 @@ export class RaitonBuilder implements BuilderInterface {
|
|
|
102
111
|
|
|
103
112
|
|
|
104
113
|
this._bootstrapper = path.join(this._source, RaitonDirectories.bootstrapFile)
|
|
105
|
-
this._bootstrapperFile = path.join(RaitonDirectories.server(
|
|
114
|
+
this._bootstrapperFile = path.join(RaitonDirectories.server(this.workdir), RaitonDirectories.compiledBootstrapFile)
|
|
106
115
|
|
|
107
116
|
return this;
|
|
108
117
|
|
|
@@ -198,24 +207,69 @@ export class RaitonBuilder implements BuilderInterface {
|
|
|
198
207
|
|
|
199
208
|
const source = path.relative(this.workdir, this._source)
|
|
200
209
|
const output = path.relative(this.workdir, this._out)
|
|
201
|
-
const tsconfig = 'tsconfig.json'
|
|
202
|
-
// const tsconfig = path.join(path.relative(this._source, this.workdir), 'tsconfig.json')
|
|
203
210
|
|
|
204
211
|
Logger.log(LBadge.notice('Building'), 'application');
|
|
205
212
|
Logger.log(LBadge.info('Source'), source);
|
|
206
213
|
Logger.log(LBadge.info('Output'), output);
|
|
207
214
|
|
|
208
|
-
|
|
215
|
+
await this.typecheck()
|
|
216
|
+
await this.compile()
|
|
217
|
+
|
|
218
|
+
return this;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
protected async typecheck(): Promise<this> {
|
|
222
|
+
const tsconfigPath = path.join(this.workdir, 'tsconfig.json')
|
|
223
|
+
if (!fs.existsSync(tsconfigPath)) return this
|
|
224
|
+
|
|
225
|
+
try {
|
|
226
|
+
execSync(`cd ${this.workdir} && npx tsc -p tsconfig.json --noEmit`, {stdio: 'inherit'})
|
|
227
|
+
} catch (e: any) {
|
|
228
|
+
Logger.warn('TypeScript check reported errors', e?.message ?? e)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return this;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
protected async compile(): Promise<this> {
|
|
235
|
+
if (!this._source) throw new Error('Application source not found');
|
|
236
|
+
if (!this._out) throw new Error('Application output not found');
|
|
237
|
+
if (!this.bootstrapper) throw new Error('Bootstrapper not found')
|
|
238
|
+
|
|
239
|
+
const outfile = this.bootstrapperFile
|
|
240
|
+
if (!outfile) throw new Error('Bootstrapper file not found')
|
|
241
|
+
|
|
242
|
+
await build({
|
|
243
|
+
entryPoints: [this.bootstrapper],
|
|
244
|
+
bundle: true,
|
|
245
|
+
platform: 'node',
|
|
246
|
+
format: 'esm',
|
|
247
|
+
target: 'node20',
|
|
248
|
+
outfile,
|
|
249
|
+
sourcemap: true,
|
|
250
|
+
packages: 'external',
|
|
251
|
+
external: ['@protorians/*', 'argon2', 'bcrypt'],
|
|
252
|
+
})
|
|
209
253
|
|
|
210
254
|
return this;
|
|
211
255
|
}
|
|
212
256
|
|
|
213
257
|
public async boot(): Promise<any> {
|
|
214
258
|
if (!this.bootstrapper) throw new Error('Bootstrapper not found')
|
|
215
|
-
if (!fs.existsSync(this.bootstrapper))
|
|
216
|
-
throw new Error(`Bootstrapper file "${this.bootstrapper}" does not exists`)
|
|
217
259
|
|
|
218
|
-
|
|
260
|
+
let entry = this.bootstrapper
|
|
261
|
+
|
|
262
|
+
if (isNodeUsed) {
|
|
263
|
+
const compiled = this.bootstrapperFile
|
|
264
|
+
if (!compiled) throw new Error('Bootstrapper file not found')
|
|
265
|
+
if (!fs.existsSync(compiled)) await this.compile()
|
|
266
|
+
entry = compiled
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (!fs.existsSync(entry))
|
|
270
|
+
throw new Error(`Bootstrapper file "${entry}" does not exists`)
|
|
271
|
+
|
|
272
|
+
const bootstrapper = await import(entry);
|
|
219
273
|
if (!('default' in bootstrapper))
|
|
220
274
|
throw new Error('Bootstrapper not supported! Please export to "default"')
|
|
221
275
|
|
package/source/core/commands.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {Command} from "commander";
|
|
2
|
-
import {RaitonCommand} from "./command";
|
|
2
|
+
import {RaitonCommand} from "./command.ts";
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import {Logger} from "@protorians/logger";
|
|
@@ -17,28 +17,38 @@ export class RaitonCommands {
|
|
|
17
17
|
|
|
18
18
|
public async harvest(): Promise<void> {
|
|
19
19
|
const dir = path.join(this.appdir, 'commands');
|
|
20
|
-
|
|
21
|
-
if (!fs.existsSync(dir)) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
20
|
|
|
25
|
-
|
|
21
|
+
if (fs.existsSync(dir)) {
|
|
22
|
+
const files = fs.readdirSync(dir);
|
|
23
|
+
|
|
24
|
+
for (const file of files) {
|
|
25
|
+
if (file.startsWith('~')) continue;
|
|
26
|
+
if (file.endsWith('.d.ts')) continue;
|
|
27
|
+
if (!file.includes('.command.')) continue;
|
|
28
|
+
|
|
29
|
+
const filepath = path.join(dir, file);
|
|
30
|
+
const mod = await import(filepath);
|
|
31
|
+
|
|
32
|
+
const capability = new mod.default(this.cli, this.workdir, this.appdir)
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
if (file.startsWith('~')) continue;
|
|
29
|
-
if (file.endsWith('.d.ts')) continue;
|
|
30
|
-
if (!file.includes('.command.')) continue;
|
|
34
|
+
if (!(capability instanceof RaitonCommand)) continue;
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
capability.register();
|
|
37
|
+
this.stack.add(capability);
|
|
38
|
+
}
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const {RaitonCommandsRegistry} = await import("../bin/commands.registry.ts");
|
|
44
|
+
|
|
45
|
+
for (const constructor of RaitonCommandsRegistry) {
|
|
46
|
+
const capability = new constructor(this.cli, this.workdir, this.appdir)
|
|
36
47
|
|
|
37
48
|
if (!(capability instanceof RaitonCommand)) continue;
|
|
38
49
|
|
|
39
50
|
capability.register();
|
|
40
51
|
this.stack.add(capability);
|
|
41
52
|
}
|
|
42
|
-
|
|
43
53
|
}
|
|
44
54
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
-
import {ConfigurableInterface} from "../../types";
|
|
3
|
+
import {ConfigurableInterface} from "../../types/index.ts";
|
|
4
4
|
import {Logger} from "@protorians/logger";
|
|
5
|
-
import {Raiton} from "../raiton";
|
|
5
|
+
import {Raiton} from "../raiton.ts";
|
|
6
6
|
|
|
7
7
|
export class RaitonConfig {
|
|
8
8
|
static readonly current: Map<keyof ConfigurableInterface, ConfigurableInterface[keyof ConfigurableInterface]> = new Map();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ConfigurableInterface} from "../../types/config";
|
|
2
|
-
import {JsonUtil} from "../../framework/utilities";
|
|
1
|
+
import {ConfigurableInterface} from "../../types/config.ts";
|
|
2
|
+
import {JsonUtil} from "../../framework/utilities/index.ts";
|
|
3
3
|
|
|
4
4
|
export async function defineConfig(config?: ConfigurableInterface) {
|
|
5
5
|
const workdir = process.cwd();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./config"
|
|
2
|
-
export * from "./define"
|
|
1
|
+
export * from "./config.ts"
|
|
2
|
+
export * from "./define.ts"
|
package/source/core/context.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import {BuilderHMRDeclarationInterface} from "../../types";
|
|
2
|
+
import {BuilderHMRDeclarationInterface} from "../../types/index.ts";
|
|
3
3
|
import {LBadge, Logger} from "@protorians/logger";
|
|
4
|
-
import {compileController} from "./compiler";
|
|
5
|
-
import {compileSocket} from "../socket/builder";
|
|
6
|
-
import {compileMcp} from "../mcp/builder";
|
|
7
|
-
import {RaitonThread} from "../thread";
|
|
8
|
-
import {Injection} from "../injection";
|
|
9
|
-
import {isControllerArtifact, isSocketArtifact, isMcpArtifact} from "../../framework";
|
|
10
|
-
import {Artifacts} from "../../framework/artifacts";
|
|
4
|
+
import {compileController} from "./compiler.ts";
|
|
5
|
+
import {compileSocket} from "../socket/builder.ts";
|
|
6
|
+
import {compileMcp} from "../mcp/builder.ts";
|
|
7
|
+
import {RaitonThread} from "../thread.ts";
|
|
8
|
+
import {Injection} from "../injection/index.ts";
|
|
9
|
+
import {isControllerArtifact, isSocketArtifact, isMcpArtifact} from "../../framework/index.ts";
|
|
10
|
+
import {Artifacts} from "../../framework/artifacts.ts";
|
|
11
11
|
import path from "node:path";
|
|
12
|
-
import {ControllerRouteTracker} from "./tracker";
|
|
12
|
+
import {ControllerRouteTracker} from "./tracker.ts";
|
|
13
13
|
|
|
14
14
|
export class ControllerBuilder {
|
|
15
15
|
|
|
@@ -1,9 +1,9 @@
|
|
|
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
|
-
import {ControllerRouteTracker} from "./tracker";
|
|
1
|
+
import {ApplicationInterface} from "../../types/application.ts";
|
|
2
|
+
import {getControllerMetadata} from "../index.ts";
|
|
3
|
+
import {createHandler} from "../router/index.ts";
|
|
4
|
+
import {Injection} from "../injection/index.ts";
|
|
5
|
+
import {ControllerMetaInterface} from "../../types/index.ts";
|
|
6
|
+
import {ControllerRouteTracker} from "./tracker.ts";
|
|
7
7
|
|
|
8
8
|
export function compileController(
|
|
9
9
|
ControllerClass: any,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./metadata"
|
|
2
|
-
export * from "./compiler"
|
|
3
|
-
export * from "./builder"
|
|
4
|
-
export * from "./tracker"
|
|
1
|
+
export * from "./metadata.ts"
|
|
2
|
+
export * from "./compiler.ts"
|
|
3
|
+
export * from "./builder.ts"
|
|
4
|
+
export * from "./tracker.ts"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {ControllerMetaInterface} from "../../types";
|
|
2
|
-
import {METADATA_KEYS} from "../../framework";
|
|
1
|
+
import {ControllerMetaInterface} from "../../types/index.ts";
|
|
2
|
+
import {METADATA_KEYS} from "../../framework/index.ts";
|
|
3
3
|
import "reflect-metadata";
|
|
4
4
|
|
|
5
5
|
export function getControllerMetadata(target: any): ControllerMetaInterface {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import {RaitonConfig} from "./config";
|
|
3
|
-
import {Raiton} from "./raiton";
|
|
2
|
+
import {RaitonConfig} from "./config/index.ts";
|
|
3
|
+
import {Raiton} from "./raiton.ts";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
export class RaitonDirectories {
|
|
7
7
|
public static readonly index = `.${Raiton.identifier}`;
|
|
8
8
|
public static readonly bootstrapFile = 'main.ts';
|
|
9
|
+
public static readonly compiledBootstrapFile = 'main.mjs';
|
|
9
10
|
// public static readonly bootstrapFile = 'main.js';
|
|
10
11
|
|
|
11
12
|
public static caches(workdir: string): string {
|
package/source/core/guards.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './raiton';
|
|
1
|
+
export * from './raiton.ts';
|
package/source/core/hooks.ts
CHANGED
package/source/core/index.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export * from "./config";
|
|
2
|
-
export * from "./process.util";
|
|
3
|
-
export * from "./builder";
|
|
4
|
-
export * from "./bytes.util";
|
|
5
|
-
export * from "./commands";
|
|
6
|
-
export * from "./command";
|
|
7
|
-
export * from "./directories";
|
|
8
|
-
export * from "./raiton";
|
|
9
|
-
export * from "./thread";
|
|
10
|
-
export * from "./application";
|
|
11
|
-
export * from "./controller";
|
|
12
|
-
export * from "./socket";
|
|
13
|
-
export * from "./mcp";
|
|
14
|
-
export * from "./plugins";
|
|
15
|
-
export * from "./middleware";
|
|
16
|
-
export * from "./router";
|
|
1
|
+
export * from "./config/index.ts";
|
|
2
|
+
export * from "./process.util.ts";
|
|
3
|
+
export * from "./builder.ts";
|
|
4
|
+
export * from "./bytes.util.ts";
|
|
5
|
+
export * from "./commands.ts";
|
|
6
|
+
export * from "./command.ts";
|
|
7
|
+
export * from "./directories.ts";
|
|
8
|
+
export * from "./raiton.ts";
|
|
9
|
+
export * from "./thread.ts";
|
|
10
|
+
export * from "./application.ts";
|
|
11
|
+
export * from "./controller/index.ts";
|
|
12
|
+
export * from "./socket/index.ts";
|
|
13
|
+
export * from "./mcp/index.ts";
|
|
14
|
+
export * from "./plugins/index.ts";
|
|
15
|
+
export * from "./middleware/index.ts";
|
|
16
|
+
export * from "./router/index.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './injection';
|
|
1
|
+
export * from './injection.ts';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import type {ConstructorType, ContainerDefinitionInterface} from "../../types";
|
|
2
|
+
import type {ConstructorType, ContainerDefinitionInterface} from "../../types/index.ts";
|
|
3
3
|
import {LifetimeEnum, TextUtility} from "@protorians/core";
|
|
4
4
|
import {Logger} from "@protorians/logger";
|
|
5
|
-
import {METADATA_KEYS} from "../../framework/constants";
|
|
6
|
-
import {Throwable} from "../../framework/exceptions";
|
|
5
|
+
import {METADATA_KEYS} from "../../framework/constants/index.ts";
|
|
6
|
+
import {Throwable} from "../../framework/exceptions/index.ts";
|
|
7
7
|
|
|
8
8
|
const camelCase = TextUtility.camelCase;
|
|
9
9
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {registerMcpServer, unregisterMcpServer, getMcpServerMetadata} from "./metadata";
|
|
2
|
-
import {Injection} from "../injection";
|
|
3
|
-
import {McpServerRegistrationInterface} from "../../types";
|
|
4
|
-
import {McpRouteTracker} from "./tracker";
|
|
5
|
-
import {RaitonThread} from "../thread";
|
|
6
|
-
import {HttpMethod} from "../../framework/enums";
|
|
7
|
-
import {mcpHandleGet, mcpHandlePost, isMcpJsonRpc, SESSION_HEADER} from "../../framework/mcp/streamable-http";
|
|
8
|
-
import type {ContextInterface} from "../../types/core";
|
|
1
|
+
import {registerMcpServer, unregisterMcpServer, getMcpServerMetadata} from "./metadata.ts";
|
|
2
|
+
import {Injection} from "../injection/index.ts";
|
|
3
|
+
import {McpServerRegistrationInterface} from "../../types/index.ts";
|
|
4
|
+
import {McpRouteTracker} from "./tracker.ts";
|
|
5
|
+
import {RaitonThread} from "../thread.ts";
|
|
6
|
+
import {HttpMethod} from "../../framework/enums/index.ts";
|
|
7
|
+
import {mcpHandleGet, mcpHandlePost, isMcpJsonRpc, SESSION_HEADER} from "../../framework/mcp/streamable-http.ts";
|
|
8
|
+
import type {ContextInterface} from "../../types/core.ts";
|
|
9
9
|
|
|
10
10
|
export function compileMcp(McpServerClass: any): McpServerRegistrationInterface | undefined {
|
|
11
11
|
const metadata = getMcpServerMetadata(McpServerClass.prototype || McpServerClass)
|
package/source/core/mcp/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./metadata"
|
|
2
|
-
export * from "./builder"
|
|
3
|
-
export * from "./tracker"
|
|
1
|
+
export * from "./metadata.ts"
|
|
2
|
+
export * from "./builder.ts"
|
|
3
|
+
export * from "./tracker.ts"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {McpServerMetaInterface, McpServerRegistrationInterface} from "../../types";
|
|
2
|
-
import {METADATA_KEYS} from "../../framework/constants";
|
|
1
|
+
import {McpServerMetaInterface, McpServerRegistrationInterface} from "../../types/index.ts";
|
|
2
|
+
import {METADATA_KEYS} from "../../framework/constants/index.ts";
|
|
3
3
|
import "reflect-metadata";
|
|
4
4
|
|
|
5
5
|
const registry = new Map<string, McpServerRegistrationInterface>();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {MiddlewareType} from '../../types'
|
|
2
|
-
import {Throwable} from "../../framework/exceptions";
|
|
1
|
+
import {MiddlewareType} from '../../types/index.ts'
|
|
2
|
+
import {Throwable} from "../../framework/exceptions/index.ts";
|
|
3
3
|
|
|
4
4
|
export function middlewareCompose(middlewares: MiddlewareType[]) {
|
|
5
5
|
return function (request: any) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./compose"
|
|
2
|
-
export * from "./pipeline"
|
|
1
|
+
export * from "./compose.ts"
|
|
2
|
+
export * from "./pipeline.ts"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MiddlewareType } from '../../types'
|
|
2
|
-
import { middlewareCompose } from '
|
|
1
|
+
import { MiddlewareType } from '../../types/index.ts'
|
|
2
|
+
import { middlewareCompose } from '../index.ts'
|
|
3
3
|
|
|
4
4
|
export class MiddlewarePipeline {
|
|
5
5
|
private stack: MiddlewareType[] = []
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./scope"
|
|
2
|
-
export * from "./plugin"
|
|
1
|
+
export * from "./scope.ts"
|
|
2
|
+
export * from "./plugin.ts"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {HookStore} from '../hooks'
|
|
2
|
-
import {MiddlewarePipeline} from '../middleware'
|
|
3
|
-
import {Route, Router} from '../router'
|
|
4
|
-
import {HttpMethod} from "../../framework/enums";
|
|
1
|
+
import {HookStore} from '../hooks.ts'
|
|
2
|
+
import {MiddlewarePipeline} from '../middleware/index.ts'
|
|
3
|
+
import {Route, Router} from '../router/index.ts'
|
|
4
|
+
import {HttpMethod} from "../../framework/enums/index.ts";
|
|
5
5
|
|
|
6
6
|
export class PluginScope {
|
|
7
7
|
public hooks: HookStore
|
package/source/core/raiton.ts
CHANGED