@ooneex/module 0.17.0 → 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 +1,116 @@
1
- # @ooneex/router
1
+ # @ooneex/module
2
+
3
+ Module system for organizing application features into cohesive units -- groups controllers, entities, services, and middleware by domain.
4
+
5
+ ![Bun](https://img.shields.io/badge/Bun-Compatible-orange?style=flat-square&logo=bun)
6
+ ![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue?style=flat-square&logo=typescript)
7
+ ![MIT License](https://img.shields.io/badge/License-MIT-yellow?style=flat-square)
8
+
9
+ ## Features
10
+
11
+ ✅ **Domain Grouping** - Organize controllers, entities, middleware, and more by feature domain
12
+
13
+ ✅ **Controller Registration** - Bundle related controllers into a single module
14
+
15
+ ✅ **Entity Binding** - Associate database entities with their owning module
16
+
17
+ ✅ **Middleware Scoping** - Attach middleware to specific modules
18
+
19
+ ✅ **Permission Support** - Optional per-module permission classes
20
+
21
+ ✅ **Cron Jobs** - Optional cron job classes scoped to a module
22
+
23
+ ✅ **Event Handling** - Optional pub/sub event classes per module
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ bun add @ooneex/module
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ### Defining a Module
34
+
35
+ ```typescript
36
+ import type { ModuleType } from '@ooneex/module';
37
+ import { UserCreateController, UserListController } from './controllers';
38
+ import { UserEntity } from './entities';
39
+ import { AuthMiddleware } from './middleware';
40
+
41
+ const UserModule: ModuleType = {
42
+ controllers: [UserCreateController, UserListController],
43
+ entities: [UserEntity],
44
+ middlewares: [AuthMiddleware],
45
+ };
46
+
47
+ export { UserModule };
48
+ ```
49
+
50
+ ### Module with All Options
51
+
52
+ ```typescript
53
+ import type { ModuleType } from '@ooneex/module';
54
+
55
+ const OrderModule: ModuleType = {
56
+ controllers: [OrderCreateController, OrderListController],
57
+ entities: [OrderEntity, OrderItemEntity],
58
+ permissions: [OrderPermission],
59
+ middlewares: [OrderValidationMiddleware],
60
+ cronJobs: [OrderCleanupCron],
61
+ events: [OrderCreatedEvent, OrderShippedEvent],
62
+ };
63
+ ```
64
+
65
+ ## API Reference
66
+
67
+ ### Types
68
+
69
+ #### `ModuleType`
70
+
71
+ ```typescript
72
+ type ModuleType = {
73
+ controllers: ControllerClassType[];
74
+ entities: EntityClassType[];
75
+ permissions?: PermissionClassType[];
76
+ middlewares?: MiddlewareClassType[];
77
+ cronJobs?: CronClassType[];
78
+ events?: PubSubClassType[];
79
+ };
80
+ ```
81
+
82
+ **Required fields:**
83
+ - `controllers` - Array of controller classes belonging to this module
84
+ - `entities` - Array of entity classes belonging to this module
85
+
86
+ **Optional fields:**
87
+ - `permissions` - Permission classes for access control
88
+ - `middlewares` - Middleware classes to apply to this module
89
+ - `cronJobs` - Cron job classes scoped to this module
90
+ - `events` - Pub/sub event classes for this module
91
+
92
+ ## License
93
+
94
+ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
95
+
96
+ ## Contributing
97
+
98
+ Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
99
+
100
+ ### Development Setup
101
+
102
+ 1. Clone the repository
103
+ 2. Install dependencies: `bun install`
104
+ 3. Run tests: `bun run test`
105
+ 4. Build the project: `bun run build`
106
+
107
+ ### Guidelines
108
+
109
+ - Write tests for new features
110
+ - Follow the existing code style
111
+ - Update documentation for API changes
112
+ - Ensure all tests pass before submitting PR
113
+
114
+ ---
115
+
116
+ Made with ❤️ by the Ooneex team
package/dist/index.d.ts CHANGED
@@ -1,7 +1,15 @@
1
1
  import { ControllerClassType } from "@ooneex/controller";
2
+ import { CronClassType } from "@ooneex/cron";
2
3
  import { EntityClassType } from "@ooneex/entity";
4
+ import { MiddlewareClassType } from "@ooneex/middleware";
5
+ import { PermissionClassType } from "@ooneex/permission";
6
+ import { PubSubClassType } from "@ooneex/pub-sub";
3
7
  type ModuleType = {
4
8
  controllers: ControllerClassType[];
5
9
  entities: EntityClassType[];
10
+ permissions?: PermissionClassType[];
11
+ middlewares?: MiddlewareClassType[];
12
+ cronJobs?: CronClassType[];
13
+ events?: PubSubClassType[];
6
14
  };
7
15
  export { ModuleType };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ooneex/module",
3
- "description": "Module system for organizing application features by grouping controllers, entities, and related components",
4
- "version": "0.17.0",
3
+ "description": "Module system for organizing application features into cohesive units — groups controllers, entities, services, and middleware by domain",
4
+ "version": "1.0.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -27,8 +27,12 @@
27
27
  "npm:publish": "bun publish --tolerate-republish --access public"
28
28
  },
29
29
  "devDependencies": {
30
- "@ooneex/controller": "0.16.1",
31
- "@ooneex/entity": "0.0.17"
30
+ "@ooneex/middleware": "0.17.1",
31
+ "@ooneex/controller": "0.17.1",
32
+ "@ooneex/permission": "0.0.19",
33
+ "@ooneex/pub-sub": "0.0.20",
34
+ "@ooneex/cron": "0.0.18",
35
+ "@ooneex/entity": "0.0.18"
32
36
  },
33
37
  "keywords": [
34
38
  "bun",