raiton 5.9.4-beta.15 → 5.9.5-beta.16
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 +3 -1
- package/docs/README.md +131 -0
- package/docs/cli/README.md +81 -0
- package/docs/cli/commands.md +167 -0
- package/docs/cli/hmr.md +121 -0
- package/docs/core/README.md +67 -0
- package/docs/core/application.md +149 -0
- package/docs/core/builder-thread.md +231 -0
- package/docs/core/config.md +124 -0
- package/docs/core/controller.md +120 -0
- package/docs/core/injection.md +226 -0
- package/docs/core/middleware.md +172 -0
- package/docs/core/plugin-scope.md +171 -0
- package/docs/core/router.md +122 -0
- package/docs/framework/README.md +96 -0
- package/docs/framework/base-classes.md +214 -0
- package/docs/framework/decorators/README.md +60 -0
- package/docs/framework/decorators/controllable.md +151 -0
- package/docs/framework/decorators/injection.md +186 -0
- package/docs/framework/decorators/middleware.md +167 -0
- package/docs/framework/decorators/openapi.md +254 -0
- package/docs/framework/decorators/parametrable.md +248 -0
- package/docs/framework/decorators/socket.md +152 -0
- package/docs/framework/encryption.md +183 -0
- package/docs/framework/env.md +88 -0
- package/docs/framework/plugins/README.md +50 -0
- package/docs/framework/plugins/body-parser.md +138 -0
- package/docs/framework/plugins/openapi.md +217 -0
- package/docs/framework/plugins/security.md +159 -0
- package/docs/framework/responses.md +180 -0
- package/docs/framework/runtime.md +138 -0
- package/docs/types/README.md +206 -0
- package/package.json +1 -1
- package/source/core/application.ts +2 -0
- package/source/core/router/handler.ts +2 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Système de Types
|
|
2
|
+
|
|
3
|
+
**Dossier :** `source/types/`
|
|
4
|
+
**Import :** `import { ... } from "raiton/types"` ou `import type { ... } from "raiton/types"`
|
|
5
|
+
|
|
6
|
+
> **Navigation :** [← docs/](../README.md) | [↑ Index](../README.md)
|
|
7
|
+
|
|
8
|
+
## Table des matières
|
|
9
|
+
|
|
10
|
+
- [Liste complète des fichiers de types](#liste-complète)
|
|
11
|
+
- [Interfaces clés](#interfaces-clés)
|
|
12
|
+
- [ApplicationConfigInterface](#applicationconfiginterface)
|
|
13
|
+
- [ThreadInterface](#threadinterface)
|
|
14
|
+
- [ContextInterface](#contextinterface)
|
|
15
|
+
- [MiddlewareParametersInterface](#middlewareparametersinterface)
|
|
16
|
+
- [ContainerDefinitionInterface](#containerdefinitioninterface)
|
|
17
|
+
- [PluginInterface](#plugininterface)
|
|
18
|
+
- [ControllerMetaInterface](#controllermetainterface)
|
|
19
|
+
- [ConfigurableInterface](#configurableinterface)
|
|
20
|
+
- [Export map](#export-map)
|
|
21
|
+
|
|
22
|
+
29 fichiers de types dans `source/types/`, tous réexportés via `source/types/index.ts`.
|
|
23
|
+
|
|
24
|
+
## Liste complète
|
|
25
|
+
|
|
26
|
+
| Fichier | Interface(s) principale(s) |
|
|
27
|
+
|---------|---------------------------|
|
|
28
|
+
| `application.ts` | `ApplicationInterface`, `ApplicationConfigInterface` |
|
|
29
|
+
| `artifact.ts` | Types d'artifacts |
|
|
30
|
+
| `builder.ts` | `BuilderInterface`, `BuilderConfigInterface` |
|
|
31
|
+
| `config.ts` | `ConfigurableInterface` |
|
|
32
|
+
| `contruct.ts` | `ConstructorType<T>` |
|
|
33
|
+
| `controller.ts` | `ControllerMetaInterface`, `RouteMetaInterface`, `RouteDecoratorCallable` |
|
|
34
|
+
| `core.ts` | `ContextInterface`, `RaitonCoreInterface` |
|
|
35
|
+
| `directory.ts` | Types de répertoires |
|
|
36
|
+
| `encryption.ts` | `EncryptionResultType`, `DerivationOptionsInterface`, `ScryptOptionsInterface` |
|
|
37
|
+
| `generic.ts` | Types génériques |
|
|
38
|
+
| `guard.ts` | Types de guards |
|
|
39
|
+
| `http-responses.ts` | Types de réponses HTTP |
|
|
40
|
+
| `injection.ts` | `ContainerDefinitionInterface` |
|
|
41
|
+
| `lifecycle.ts` | Types de cycle de vie |
|
|
42
|
+
| `middleware.ts` | `MiddlewareType`, `MiddlewareCallable`, `MiddlewareParametersInterface` |
|
|
43
|
+
| `parseable.ts` | Types de parsing |
|
|
44
|
+
| `plugin.ts` | `PluginInterface` |
|
|
45
|
+
| `raiton.ts` | Types statiques |
|
|
46
|
+
| `responses.ts` | Types de réponses |
|
|
47
|
+
| `router.ts` | Types de routage |
|
|
48
|
+
| `runtime.ts` | `RuntimeAdapterInterface`, `RuntimeServerInterface`, `RuntimeHandlerCallable` |
|
|
49
|
+
| `scheme.ts` | Types de schémas |
|
|
50
|
+
| `server.ts` | Types serveur |
|
|
51
|
+
| `socket.ts` | `SocketEventType` |
|
|
52
|
+
| `thread.ts` | `ThreadInterface`, `ThreadOptionsInterface`, `ThreadSetupOptionsInterface` |
|
|
53
|
+
| `utilities.ts` | Types utilitaires |
|
|
54
|
+
| `values.ts` | Types de valeurs |
|
|
55
|
+
| *(autres fichiers)* | |
|
|
56
|
+
|
|
57
|
+
## Interfaces clés
|
|
58
|
+
|
|
59
|
+
### `ApplicationConfigInterface`
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
interface ApplicationConfigInterface {
|
|
63
|
+
port?: number
|
|
64
|
+
hostname?: string
|
|
65
|
+
protocole?: string
|
|
66
|
+
pathname?: string
|
|
67
|
+
prefix?: string
|
|
68
|
+
develop?: boolean
|
|
69
|
+
verbose?: boolean
|
|
70
|
+
workdir?: string
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### `ThreadInterface`
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
interface ThreadInterface {
|
|
78
|
+
application: ApplicationInterface | null
|
|
79
|
+
runtime: RuntimeAdapterInterface | null
|
|
80
|
+
runtimeServer: RuntimeServerInterface | null
|
|
81
|
+
readonly appDir: string
|
|
82
|
+
readonly builder: BuilderInterface
|
|
83
|
+
|
|
84
|
+
setup(options: ThreadSetupOptionsInterface): this
|
|
85
|
+
run(): Promise<this>
|
|
86
|
+
stop(): Promise<void>
|
|
87
|
+
restart(): void
|
|
88
|
+
sleep(ms: number): Promise<unknown>
|
|
89
|
+
wait(condition: ThreadWaitCallable): Promise<void>
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `ContextInterface`
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
interface ContextInterface {
|
|
97
|
+
req: any
|
|
98
|
+
reply: any
|
|
99
|
+
state: Record<string, any>
|
|
100
|
+
params?: Record<string, string>
|
|
101
|
+
send?: (data: any) => void
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### `MiddlewareParametersInterface`
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
interface MiddlewareParametersInterface {
|
|
109
|
+
context: RequestContext
|
|
110
|
+
next: () => Promise<any>
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### `ContainerDefinitionInterface`
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
interface ContainerDefinitionInterface {
|
|
118
|
+
name: string
|
|
119
|
+
construct: ConstructorType
|
|
120
|
+
lifetime: LifetimeEnum
|
|
121
|
+
scope?: Symbol
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### `PluginInterface`
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
interface PluginInterface {
|
|
129
|
+
name: string
|
|
130
|
+
setup: (scope: PluginScope) => void
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### `ControllerMetaInterface`
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
interface ControllerMetaInterface {
|
|
138
|
+
prefix: string
|
|
139
|
+
routes: RouteMetaInterface[]
|
|
140
|
+
middlewares: Record<string, any>
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### `RouteMetaInterface`
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
interface RouteMetaInterface {
|
|
148
|
+
method: HttpMethod
|
|
149
|
+
path: string
|
|
150
|
+
propertyKey: string
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### `ConstructorType`
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
type ConstructorType<T = any> = new (...args: any[]) => T
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### `ConfigurableInterface`
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
interface ConfigurableInterface {
|
|
164
|
+
rootDir?: string
|
|
165
|
+
version?: string
|
|
166
|
+
port?: number
|
|
167
|
+
hostname?: string
|
|
168
|
+
protocole?: string
|
|
169
|
+
pathname?: string
|
|
170
|
+
artifacts?: { types: string[] }
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Export map
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
// source/types/index.ts
|
|
178
|
+
export type * from './config'
|
|
179
|
+
export type * from './builder'
|
|
180
|
+
export type * from './thread'
|
|
181
|
+
export type * from './guard'
|
|
182
|
+
export type * from './contruct'
|
|
183
|
+
export type * from './directory'
|
|
184
|
+
export type * from './encryption'
|
|
185
|
+
export type * from './generic'
|
|
186
|
+
export type * from './parseable'
|
|
187
|
+
export type * from './values'
|
|
188
|
+
export type * from './utilities'
|
|
189
|
+
export type * from './artifact'
|
|
190
|
+
export type * from './middleware'
|
|
191
|
+
export type * from './core'
|
|
192
|
+
export type * from './plugin'
|
|
193
|
+
export type * from './runtime'
|
|
194
|
+
export type * from './router'
|
|
195
|
+
export type * from './controller'
|
|
196
|
+
export type * from './socket'
|
|
197
|
+
export type * from './injection'
|
|
198
|
+
export type * from './responses'
|
|
199
|
+
export type * from './server'
|
|
200
|
+
export type * from './raiton'
|
|
201
|
+
export type * from './lifecycle'
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
[← docs/](../README.md) | [↑ Index](../README.md)
|
package/package.json
CHANGED
|
@@ -171,6 +171,7 @@ export class Application implements ApplicationInterface {
|
|
|
171
171
|
|
|
172
172
|
context.reply.send(responses)
|
|
173
173
|
} catch (e: any) {
|
|
174
|
+
Logger.info(`${req.method} ${req.url}`)
|
|
174
175
|
Logger.error('Failed to execute handle', e.message ?? e)
|
|
175
176
|
if (this.config.develop) {
|
|
176
177
|
console.error(e)
|
|
@@ -184,6 +185,7 @@ export class Application implements ApplicationInterface {
|
|
|
184
185
|
await this.root.middleware.run(ctx, handler)
|
|
185
186
|
await this.root.hooks.run('onResponse', ctx)
|
|
186
187
|
} catch (err: any) {
|
|
188
|
+
Logger.info(`${req.method} ${req.url}`)
|
|
187
189
|
if (err instanceof HttpException || err instanceof ThrowableResponse) {
|
|
188
190
|
Logger.error(`Server error`, err.message ?? err);
|
|
189
191
|
ctx.reply.status(err.statusCode ?? 500)
|
|
@@ -25,6 +25,8 @@ export function createHandler(
|
|
|
25
25
|
return responses;
|
|
26
26
|
} catch (err: any) {
|
|
27
27
|
|
|
28
|
+
Logger.info(`${ctx.req?.method} ${ctx.req?.url}`)
|
|
29
|
+
|
|
28
30
|
if (err instanceof HttpException || err instanceof ThrowableResponse) {
|
|
29
31
|
Logger.error(`Failed to execute ${handlerName} handler`, err.message ?? err);
|
|
30
32
|
ctx.reply.status(err.statusCode ?? 500)
|