@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 CHANGED
@@ -1,45 +1,31 @@
1
1
  # @ooneex/controller
2
2
 
3
- Base controller types and interfaces for handling HTTP requests and responses in Ooneex applications. This package provides the foundational `IController` interface and context types that define how controllers interact with requests, responses, and framework services.
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
  ![Bun](https://img.shields.io/badge/Bun-Compatible-orange?style=flat-square&logo=bun)
6
- ![Deno](https://img.shields.io/badge/Deno-Compatible-blue?style=flat-square&logo=deno)
7
- ![Node.js](https://img.shields.io/badge/Node.js-Compatible-green?style=flat-square&logo=node.js)
8
6
  ![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue?style=flat-square&logo=typescript)
9
7
  ![MIT License](https://img.shields.io/badge/License-MIT-yellow?style=flat-square)
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, database, and more
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 type parameters
15
+ ✅ **Type-Safe** - Full TypeScript support with generic ContextConfigType for typed params, payload, queries, and response
18
16
 
19
- ✅ **Framework Integration** - Works seamlessly with routing, middleware, and DI container
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 other services
19
+ ✅ **Service Access** - Built-in access to analytics, storage, mailer, rate limiter, and exception logger
22
20
 
23
- ## Installation
21
+ **Request Data** - Parsed params, payload, queries, headers, files, IP, host, and detected language
24
22
 
25
- ### Bun
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
- ### pnpm
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
- npm install @ooneex/controller
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
- route: {
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
@@ -1,2 +1,3 @@
1
+ // @bun
1
2
 
2
- //# debugId=BC4C8D5165931A0D64756E2164756E21
3
+ //# debugId=A14A88B5DA50735F64756E2164756E21
package/dist/index.js.map CHANGED
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "BC4C8D5165931A0D64756E2164756E21",
7
+ "debugId": "A14A88B5DA50735F64756E2164756E21",
8
8
  "names": []
9
9
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ooneex/controller",
3
- "description": "Base controller classes and decorators for handling HTTP requests and responses in Ooneex applications",
4
- "version": "0.16.1",
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/analytics": "0.0.17",
31
- "@ooneex/app-env": "0.0.16",
32
- "@ooneex/cache": "0.0.17",
33
- "@ooneex/database": "0.0.16",
34
- "@ooneex/http-header": "0.15.0",
35
- "@ooneex/http-request": "0.15.0",
36
- "@ooneex/http-request-file": "0.15.0",
37
- "@ooneex/http-response": "0.15.0",
38
- "@ooneex/logger": "0.15.0",
39
- "@ooneex/mailer": "0.0.16",
40
- "@ooneex/storage": "0.0.17",
41
- "@ooneex/translation": "0.0.16",
42
- "@ooneex/types": "0.0.16",
43
- "@ooneex/user": "0.0.16"
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",