@ooneex/controller 0.16.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -24
- package/dist/index.d.ts +6 -4
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -1,45 +1,31 @@
|
|
|
1
1
|
# @ooneex/controller
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
HTTP controller layer with decorator-based route binding, request/response handling, and seamless integration with the routing and middleware systems.
|
|
4
4
|
|
|
5
5
|

|
|
6
|
-

|
|
7
|
-

|
|
8
6
|

|
|
9
7
|

|
|
10
8
|
|
|
11
9
|
## Features
|
|
12
10
|
|
|
13
|
-
✅ **Controller Interface** - Standard interface for all HTTP controllers
|
|
11
|
+
✅ **Controller Interface** - Standard IController interface for all HTTP controllers with typed index method
|
|
14
12
|
|
|
15
|
-
✅ **Rich Context** - Access to request, response, logger, cache,
|
|
13
|
+
✅ **Rich Context** - Access to request, response, logger, cache, storage, mailer, analytics, rate limiter, and more
|
|
16
14
|
|
|
17
|
-
✅ **Type-Safe** - Full TypeScript support with generic
|
|
15
|
+
✅ **Type-Safe** - Full TypeScript support with generic ContextConfigType for typed params, payload, queries, and response
|
|
18
16
|
|
|
19
|
-
✅ **
|
|
17
|
+
✅ **Route Information** - Context includes matched route metadata (name, path, method, version, description)
|
|
20
18
|
|
|
21
|
-
✅ **Service Access** - Built-in access to analytics, storage, mailer, and
|
|
19
|
+
✅ **Service Access** - Built-in access to analytics, storage, mailer, rate limiter, and exception logger
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
✅ **Request Data** - Parsed params, payload, queries, headers, files, IP, host, and detected language
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
bun add @ooneex/controller
|
|
28
|
-
```
|
|
23
|
+
✅ **User Context** - Authenticated user (IUser) available on the context when using auth middleware
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
pnpm add @ooneex/controller
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Yarn
|
|
36
|
-
```bash
|
|
37
|
-
yarn add @ooneex/controller
|
|
38
|
-
```
|
|
25
|
+
## Installation
|
|
39
26
|
|
|
40
|
-
### npm
|
|
41
27
|
```bash
|
|
42
|
-
|
|
28
|
+
bun add @ooneex/controller
|
|
43
29
|
```
|
|
44
30
|
|
|
45
31
|
## Usage
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { IAnalytics } from "@ooneex/analytics";
|
|
2
2
|
import { IAppEnv } from "@ooneex/app-env";
|
|
3
3
|
import { ICache } from "@ooneex/cache";
|
|
4
|
-
import { IDatabase } from "@ooneex/database";
|
|
5
4
|
import { Header } from "@ooneex/http-header";
|
|
6
5
|
import { IRequest, RequestConfigType } from "@ooneex/http-request";
|
|
7
6
|
import { IRequestFile } from "@ooneex/http-request-file";
|
|
8
7
|
import { IResponse } from "@ooneex/http-response";
|
|
9
8
|
import { ILogger, LogsEntity } from "@ooneex/logger";
|
|
10
9
|
import { IMailer } from "@ooneex/mailer";
|
|
10
|
+
import { IRateLimiter } from "@ooneex/rate-limit";
|
|
11
11
|
import { IStorage } from "@ooneex/storage";
|
|
12
12
|
import { LocaleInfoType } from "@ooneex/translation";
|
|
13
13
|
import { HttpMethodType, ScalarType } from "@ooneex/types";
|
|
@@ -21,17 +21,19 @@ type ContextConfigType = {
|
|
|
21
21
|
} & RequestConfigType;
|
|
22
22
|
type ContextType<T extends ContextConfigType = ContextConfigType> = {
|
|
23
23
|
logger: ILogger<Record<string, ScalarType>> | ILogger<LogsEntity>;
|
|
24
|
+
exceptionLogger?: ILogger;
|
|
24
25
|
analytics?: IAnalytics;
|
|
25
26
|
cache?: ICache;
|
|
26
27
|
storage?: IStorage;
|
|
27
|
-
database?: IDatabase;
|
|
28
28
|
mailer?: IMailer;
|
|
29
|
-
|
|
29
|
+
rateLimiter?: IRateLimiter;
|
|
30
|
+
route?: {
|
|
30
31
|
name: string;
|
|
31
32
|
path: `/${string}`;
|
|
32
33
|
method: HttpMethodType;
|
|
34
|
+
version: number;
|
|
33
35
|
description: string;
|
|
34
|
-
};
|
|
36
|
+
} | null;
|
|
35
37
|
app: {
|
|
36
38
|
env: IAppEnv;
|
|
37
39
|
};
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ooneex/controller",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "HTTP controller layer with decorator-based route binding, request/response handling, and seamless integration with the routing and middleware systems",
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
"npm:publish": "bun publish --tolerate-republish --access public"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@ooneex/
|
|
31
|
-
"@ooneex/
|
|
32
|
-
"@ooneex/
|
|
33
|
-
"@ooneex/
|
|
34
|
-
"@ooneex/http-header": "0.
|
|
35
|
-
"@ooneex/http-request": "0.
|
|
36
|
-
"@ooneex/http-request-file": "0.
|
|
37
|
-
"@ooneex/http-response": "0.
|
|
38
|
-
"@ooneex/logger": "0.
|
|
39
|
-
"@ooneex/mailer": "0.0.
|
|
40
|
-
"@ooneex/storage": "0.0.
|
|
41
|
-
"@ooneex/translation": "0.0.
|
|
42
|
-
"@ooneex/types": "0.0.
|
|
43
|
-
"@ooneex/user": "0.0.
|
|
30
|
+
"@ooneex/rate-limit": "0.0.19",
|
|
31
|
+
"@ooneex/analytics": "0.0.20",
|
|
32
|
+
"@ooneex/app-env": "0.0.19",
|
|
33
|
+
"@ooneex/cache": "0.0.20",
|
|
34
|
+
"@ooneex/http-header": "0.17.0",
|
|
35
|
+
"@ooneex/http-request": "0.17.0",
|
|
36
|
+
"@ooneex/http-request-file": "0.17.0",
|
|
37
|
+
"@ooneex/http-response": "0.17.0",
|
|
38
|
+
"@ooneex/logger": "0.17.2",
|
|
39
|
+
"@ooneex/mailer": "0.0.19",
|
|
40
|
+
"@ooneex/storage": "0.0.20",
|
|
41
|
+
"@ooneex/translation": "0.0.18",
|
|
42
|
+
"@ooneex/types": "0.0.19",
|
|
43
|
+
"@ooneex/user": "0.0.19"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
46
46
|
"bun",
|