@ooneex/container 0.0.1 → 0.0.5

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,8 +1,7 @@
1
1
  # @ooneex/container
2
2
 
3
- A powerful and lightweight Dependency Injection (DI) container for TypeScript/JavaScript applications. Built on top of Inversify, this package provides a simple yet comprehensive API for managing service dependencies and constants with different scoping strategies.
3
+ A lightweight dependency injection container built on Inversify for managing services, their lifecycle, and dependencies. This package provides a simple yet powerful API for registering, resolving, and managing service instances with support for singletons, transients, and request-scoped dependencies.
4
4
 
5
- ![Browser](https://img.shields.io/badge/Browser-Compatible-green?style=flat-square&logo=googlechrome)
6
5
  ![Bun](https://img.shields.io/badge/Bun-Compatible-orange?style=flat-square&logo=bun)
7
6
  ![Deno](https://img.shields.io/badge/Deno-Compatible-blue?style=flat-square&logo=deno)
8
7
  ![Node.js](https://img.shields.io/badge/Node.js-Compatible-green?style=flat-square&logo=node.js)
@@ -11,25 +10,19 @@ A powerful and lightweight Dependency Injection (DI) container for TypeScript/Ja
11
10
 
12
11
  ## Features
13
12
 
14
- ✅ **Service Registration** - Register classes and resolve dependencies automatically
13
+ ✅ **Dependency Injection** - Full DI container with automatic dependency resolution
15
14
 
15
+ ✅ **Multiple Scopes** - Support for Singleton, Transient, and Request scopes
16
16
 
17
- ✅ **Multiple Scopes** - Singleton, Transient, and Request scoping support
17
+ ✅ **Service Aliases** - Register services with string aliases for flexible resolution
18
18
 
19
- ✅ **Constant Management** - Store and retrieve constants with string or symbol identifiers
19
+ ✅ **Constant Values** - Store and retrieve constant values across your application
20
20
 
21
21
  ✅ **Type-Safe** - Full TypeScript support with proper type definitions
22
22
 
23
- ✅ **Lightweight** - Minimal overhead with powerful dependency injection
23
+ ✅ **Inversify Based** - Built on the battle-tested Inversify library
24
24
 
25
- ✅ **Cross-Platform** - Works in Browser, Node.js, Bun, and Deno
26
-
27
- ✅ **Error Handling** - Comprehensive error reporting
28
- with ContainerException
29
-
30
- ✅ **Service Lifecycle** - Complete control over service creation and removal
31
-
32
- ✅ **Symbol Support** - Use symbols as identifiers for constants and services
25
+ ✅ **Shared Instance** - Global container instance for easy access across modules
33
26
 
34
27
  ## Installation
35
28
 
@@ -55,470 +48,359 @@ npm install @ooneex/container
55
48
 
56
49
  ## Usage
57
50
 
58
- ### Basic Service Registration
51
+ ### Basic Usage
59
52
 
60
53
  ```typescript
61
- import { Container, EContainerScope } from '@ooneex/container';
62
-
63
- const container = new Container();
64
-
65
- class DatabaseService {
66
- public connect(): string {
67
- return "Connected to database";
68
- }
69
- }
54
+ import { container, EContainerScope } from '@ooneex/container';
70
55
 
71
56
  class UserService {
72
- private database: DatabaseService;
73
-
74
- constructor() {
75
- this.database = container.get(DatabaseService);
76
- }
77
-
78
- public createUser(name: string): string {
79
- this.database.connect();
80
- return `User ${name} created`;
57
+ public getUsers() {
58
+ return [{ id: 1, name: 'John' }];
81
59
  }
82
60
  }
83
61
 
84
- // Register services
85
- container.add(DatabaseService);
62
+ // Register as singleton (default)
86
63
  container.add(UserService);
87
64
 
88
- // Resolve an
89
- d use services
65
+ // Resolve instance
90
66
  const userService = container.get(UserService);
91
- console.log(userService.createUser("John")); // "User John created"
67
+ console.log(userService.getUsers());
92
68
  ```
93
69
 
94
- ### Scoping Strategies
70
+ ### Different Scopes
95
71
 
96
72
  ```typescript
97
- import { Container, EContainerScope } from '@ooneex/container';
98
-
99
- const container = new Container();
100
-
101
- class SingletonService {
102
- private static instanceCount = 0;
103
- public readonly instanceId: number;
73
+ import { container, EContainerScope } from '@ooneex/container';
104
74
 
105
- constructor() {
106
- this.instanceId = ++SingletonService.instanceCount;
107
- }
75
+ class DatabaseConnection {
76
+ public readonly id = Math.random();
108
77
  }
109
78
 
110
- class TransientService {
111
- private static instanceCount = 0;
112
- public readonly instanceId: number;
79
+ class RequestLogger {
80
+ public readonly id = Math.random();
81
+ }
113
82
 
114
- constructor() {
115
- this.instanceId = ++TransientService.instanceCount;
116
- }
83
+ class TemporaryWorker {
84
+ public readonly id = Math.random();
117
85
  }
118
86
 
119
- // Singleton scope (default) - same instance every time
120
- container.add(SingletonService, EContainerScope.Singleton);
121
- const singleton1 = container.get(SingletonService);
122
- const singleton2 = container.get(SingletonService);
123
- console.log(singleton1.instanceId === singleton2.instanceId); // true
124
-
125
- // Transient scope - new instance every time
126
- container.add(TransientService, EContainerScope.Transient);
127
- const transient1 = container.get(TransientService);
128
- const transient2 = container.get(TransientService);
129
- console.log(transient1.instanceId !== transient2.instanceId); // true
130
- ```
87
+ // Singleton - same instance throughout app lifetime
88
+ container.add(DatabaseConnection, EContainerScope.Singleton);
131
89
 
132
- ### Constants Management
90
+ // Request - new instance per request context
91
+ container.add(RequestLogger, EContainerScope.Request);
133
92
 
134
- ```typescript
135
- import { Container } from '@ooneex/container';
93
+ // Transient - new instance every time
94
+ container.add(TemporaryWorker, EContainerScope.Transient);
136
95
 
137
- const container = new Container();
96
+ const db1 = container.get(DatabaseConnection);
97
+ const db2 = container.get(DatabaseConnection);
98
+ console.log(db1.id === db2.id); // true (singleton)
138
99
 
139
- // String-based constants
140
- container.addConstant("API_URL", "https://api.example.com");
141
- container.addConstant("MAX_RETRIES", 3);
100
+ const worker1 = container.get(TemporaryWorker);
101
+ const worker2 = container.get(TemporaryWorker);
102
+ console.log(worker1.id === worker2.id); // false (transient)
103
+ ```
142
104
 
143
- // Symbol-based constants
144
- const DATABASE_CONFIG = Symbol("database-config");
145
- const dbConfig = {
146
- host: "localhost",
147
- port: 5432,
148
- database: "myapp"
149
- };
105
+ ### Using Aliases
150
106
 
151
- container.addConstant(DATABASE_CONFIG, dbConfig);
107
+ ```typescript
108
+ import { container } from '@ooneex/container';
152
109
 
153
- // Retrieve constants
154
- const apiUrl = container.getConstant<string>("API_URL");
155
- const maxRetries = container.getConstant<number>("MAX_RETRIES");
156
- const config = container.getConstant<typeof dbConfig>(DATABASE_CONFIG);
110
+ class EmailService {
111
+ public send(to: string, message: string) {
112
+ console.log(`Sending to ${to}: ${message}`);
113
+ }
114
+ }
157
115
 
158
- console.log(apiUrl); // "https://api.example.com"
159
- console.log(maxRetries); // 3
160
- console.log(config.host); // "localhost"
116
+ container.add(EmailService);
117
+ container.addAlias('mailer', EmailService);
118
+
119
+ // Resolve by alias
120
+ const mailer = container.get<EmailService>('mailer');
121
+ mailer.send('user@example.com', 'Hello!');
161
122
  ```
162
123
 
163
- ### Advanced Usage with Mixed Dependencies
124
+ ### Constants
164
125
 
165
126
  ```typescript
166
- import { Container } from '@ooneex/container';
127
+ import { container } from '@ooneex/container';
167
128
 
168
- const container = new Container();
129
+ // Store configuration values
130
+ container.addConstant('app.name', 'My Application');
131
+ container.addConstant('app.version', '1.0.0');
132
+ container.addConstant('app.config', {
133
+ debug: true,
134
+ maxConnections: 100
135
+ });
169
136
 
170
- const DB_CONFIG = Symbol("db-config");
171
- const API_URL = "API_URL";
172
-
173
- interface DatabaseConfig {
174
- host: string;
175
- port: number;
176
- }
137
+ // Retrieve constants
138
+ const appName = container.getConstant<string>('app.name');
139
+ const config = container.getConstant<{ debug: boolean }>('app.config');
177
140
 
178
- class ApiService {
179
- public getEndpoint(): string {
180
- const apiUrl = container.getConstant<string>(API_URL);
181
- return `${apiUrl}/users`;
182
- }
183
- }
141
+ console.log(appName); // "My Application"
142
+ console.log(config.debug); // true
143
+ ```
184
144
 
185
- class DatabaseService {
186
- public connect(): string {
187
- const config = container.getConstant<DatabaseConfig>(DB_CONFIG);
188
- return `Connected to ${config.host}:${config.port}`;
189
- }
190
- }
145
+ ### With Decorators
191
146
 
192
- class UserService {
193
- private api: ApiService;
194
- private db: DatabaseService;
147
+ ```typescript
148
+ import { injectable, inject, container } from '@ooneex/container';
195
149
 
196
- constructor() {
197
- this.api = container.get(ApiService);
198
- this.db = container.get(DatabaseService);
150
+ @injectable()
151
+ class Logger {
152
+ public log(message: string) {
153
+ console.log(`[LOG] ${message}`);
199
154
  }
155
+ }
200
156
 
201
- public processUser(): string {
202
- const endpoint = this.api.getEndpoint();
203
- const connection = this.db.connect();
204
- return `Processing user via ${endpoint} with ${connection}`;
157
+ @injectable()
158
+ class UserRepository {
159
+ constructor(@inject(Logger) private readonly logger: Logger) {}
160
+
161
+ public findAll() {
162
+ this.logger.log('Finding all users');
163
+ return [];
205
164
  }
206
165
  }
207
166
 
208
- // Register constants
209
- container.addConstant(DB_CONFIG, { host: "localhost", port: 5432 });
210
- container.addConstant(API_URL, "https://api.example.com");
211
-
212
- // Register services
213
- container.add(ApiService);
214
- container.add(DatabaseService);
215
- container.add(UserService);
167
+ container.add(Logger);
168
+ container.add(UserRepository);
216
169
 
217
- // Use the services
218
- const userService = container.get(UserService);
219
- console.log(userService.processUser());
170
+ const repo = container.get(UserRepository);
171
+ repo.findAll();
220
172
  ```
221
173
 
222
174
  ## API Reference
223
175
 
224
- ### `Container` Class
176
+ ### Classes
225
177
 
226
- The main dependency injection container class.
178
+ #### `Container`
179
+
180
+ Main dependency injection container class.
181
+
182
+ **Constructor:**
183
+ ```typescript
184
+ new Container()
185
+ ```
227
186
 
228
- #### Service Methods
187
+ **Methods:**
229
188
 
230
189
  ##### `add(target: Constructor, scope?: EContainerScope): void`
231
- Registers a class constructor in the container with optional scoping.
190
+
191
+ Registers a class with the container.
232
192
 
233
193
  **Parameters:**
234
194
  - `target` - The class constructor to register
235
- - `scope` - The lifecycle scope (default: `EContainerScope.Singleton`)
195
+ - `scope` - Optional scope (default: `EContainerScope.Singleton`)
236
196
 
237
197
  **Example:**
238
198
  ```typescript
239
- container.add(DatabaseService);
240
- container.add(LoggerService, EContainerScope.Transient);
241
- container.add(RequestService, EContainerScope.Request);
199
+ container.add(MyService);
200
+ container.add(MyService, EContainerScope.Transient);
242
201
  ```
243
202
 
244
- ##### `get<T>(target: Constructor<T>): T`
245
- Resolves and returns an instance of the registered class.
203
+ ##### `get<T>(target: Constructor | string): T`
204
+
205
+ Resolves an instance from the container.
246
206
 
247
207
  **Parameters:**
248
- - `target` - The class constructor to resolve
208
+ - `target` - Class constructor or alias string
249
209
 
250
- **Returns:** Instance of the requested class
210
+ **Returns:** The resolved instance
251
211
 
252
- **Throws:** `ContainerException` if the service is not registered
212
+ **Throws:** `ContainerException` if resolution fails
253
213
 
254
214
  **Example:**
255
215
  ```typescript
256
- const service = container.get(DatabaseService);
257
- service.connect();
216
+ const service = container.get(MyService);
217
+ const aliased = container.get<MyService>('myService');
258
218
  ```
259
219
 
260
- ##### `has(target: Constructor): boolean`
261
- Checks if a service is registered in the container.
220
+ ##### `has(target: Constructor | string): boolean`
221
+
222
+ Checks if a service is registered.
262
223
 
263
224
  **Parameters:**
264
- - `target` - The class constructor to check
225
+ - `target` - Class constructor or alias string
265
226
 
266
227
  **Returns:** `true` if registered, `false` otherwise
267
228
 
268
229
  **Example:**
269
230
  ```typescript
270
- if (container.has(DatabaseService)) {
271
- const db = container.get(DatabaseService);
231
+ if (container.has(MyService)) {
232
+ const service = container.get(MyService);
272
233
  }
273
234
  ```
274
235
 
275
- ##### `remove(target: Constructor): void`
276
- Removes a service registration from the container.
236
+ ##### `remove(target: Constructor | string): void`
237
+
238
+ Removes a registered service.
277
239
 
278
240
  **Parameters:**
279
- - `target` - The class constructor to remove
241
+ - `target` - Class constructor or alias string
280
242
 
281
243
  **Example:**
282
244
  ```typescript
283
- container.remove(DatabaseService);
284
- console.log(container.has(DatabaseService)); // false
245
+ container.remove(MyService);
285
246
  ```
286
247
 
287
- #### Constants Methods
248
+ ##### `addConstant<T>(identifier: string | symbol, value: T): void`
288
249
 
289
- ##### `addConstant
290
- <T>(identifier: string | symbol, value: T): void`
291
- Registers a constant value in the container.
250
+ Registers a constant value.
292
251
 
293
252
  **Parameters:**
294
- - `identifier` - String or symbol identifier for the constant
295
- - `value` - The constant value to store
253
+ - `identifier` - String or symbol identifier
254
+ - `value` - The constant value
296
255
 
297
256
  **Example:**
298
257
  ```typescript
299
- container.addConstant("API_KEY", "secret-key-123");
300
- const CONFIG_SYMBOL = Symbol("config");
301
- container.addConstant(CONFIG_SYMBOL, { env: "production" });
258
+ container.addConstant('api.url', 'https://api.example.com');
302
259
  ```
303
260
 
304
261
  ##### `getConstant<T>(identifier: string | symbol): T`
305
- Retrieves a constant value from the container.
262
+
263
+ Retrieves a constant value.
306
264
 
307
265
  **Parameters:**
308
- - `identifier` - String or symbol identifier for the constant
266
+ - `identifier` - String or symbol identifier
309
267
 
310
- **Returns:** The stored constant value
268
+ **Returns:** The constant value
311
269
 
312
- **Throws:** `ContainerException` if the constant is not found
270
+ **Throws:** `ContainerException` if not found
313
271
 
314
272
  **Example:**
315
273
  ```typescript
316
- const apiKey = container.getConstant<string>("API_KEY");
317
- const config = container.getConstant<Config>(CONFIG_SYMBOL);
274
+ const apiUrl = container.getConstant<string>('api.url');
318
275
  ```
319
276
 
320
277
  ##### `hasConstant(identifier: string | symbol): boolean`
321
- Checks if a constant is registered in the container.
322
278
 
323
- **Parameters:**
324
- - `identifier` - String or symbol identifier to check
279
+ Checks if a constant is registered.
325
280
 
326
- **Returns:** `true` if the constant exists, `false` otherwise
281
+ **Parameters:**
282
+ - `identifier` - String or symbol identifier
327
283
 
328
- **Example:**
329
- ```typescript
330
- if (container.hasConstant("API_KEY")) {
331
- const key = container.getConstant<string>("API_KEY");
332
- }
333
- ```
284
+ **Returns:** `true` if registered, `false` otherwise
334
285
 
335
286
  ##### `removeConstant(identifier: string | symbol): void`
336
- Removes a constant from the container.
337
-
338
- **Parameters:**
339
- - `identifier` - String or symbol identifier to remove
340
287
 
341
- **Example:**
342
- ```typescript
343
- container.removeConstant("API_KEY");
344
- console.log(container.hasConstant("API_KEY")); // false
345
- ```
288
+ Removes a registered constant.
346
289
 
347
- ### `EContainerScope` Enum
290
+ **Parameters:**
291
+ - `identifier` - String or symbol identifier
348
292
 
349
- Defines the lifecycle
350
- scopes for service instances.
293
+ ##### `addAlias<T>(alias: string, target: Constructor): void`
351
294
 
352
- #### Values
295
+ Creates an alias for a registered service.
353
296
 
354
- ##### `EContainerScope.Singleton`
355
- Creates a single instance that is reused for all requests (default behavior).
297
+ **Parameters:**
298
+ - `alias` - String alias name
299
+ - `target` - The target class constructor
356
300
 
357
301
  **Example:**
358
302
  ```typescript
359
- container.add(DatabaseService, EContainerScope.Singleton);
303
+ container.add(EmailService);
304
+ container.addAlias('mailer', EmailService);
360
305
  ```
361
306
 
362
- ##### `EContainerScope.Transient`
363
- Creates a new instance for every request.
307
+ ### Enums
364
308
 
365
- **Example:**
366
- ```typescript
367
- container.add(RequestIdService, EContainerScope.Transient);
368
- ```
309
+ #### `EContainerScope`
369
310
 
370
- ##### `EContainerScope.Request`
371
- Creates one instance per request scope (useful in web applications).
311
+ | Value | Description |
312
+ |-------|-------------|
313
+ | `Singleton` | Single instance shared across all requests |
314
+ | `Transient` | New instance created on every resolution |
315
+ | `Request` | New instance per request context |
372
316
 
373
- **Example:**
374
- ```typescript
375
- container.add(UserContextService, EContainerScope.Request);
376
- ```
317
+ ### Exported Functions
377
318
 
378
- ### `IContainer` Interface
319
+ #### `injectable()`
379
320
 
380
- Interface defining the contract for dependency injection containers.
321
+ Decorator to mark a class as injectable (re-exported from Inversify).
381
322
 
382
- **Example:**
383
- ```typescript
384
- import { IContainer } from '@ooneex/container';
323
+ #### `inject()`
385
324
 
386
- class CustomContainer implements IContainer {
387
- // Implement all required methods
388
- add(target: Constructor, scope?: EContainerScope): void {
389
- // Custom implementation
390
- }
325
+ Decorator to inject dependencies (re-exported from Inversify).
391
326
 
392
- get<T>(target: Constructor<T>): T {
393
- // Custom implementation
394
- }
327
+ ### Global Instance
395
328
 
396
- // ... other methods
397
- }
329
+ ```typescript
330
+ import { container } from '@ooneex/container';
398
331
  ```
399
332
 
400
- ### `ContainerException` Class
333
+ A pre-configured global container instance is exported for convenience.
401
334
 
402
- Exception thrown when container operations fail.
335
+ ## Advanced Usage
403
336
 
404
- **Properties:**
405
- - Extends the base `Exception` class from `@ooneex/exception`
406
- - Contains detailed error information and context
407
- - HTTP status code set to `500 Internal Server Error`
337
+ ### Custom Container Instance
408
338
 
409
- **Example:**
410
339
  ```typescript
411
- try {
412
- const service = container.get(UnregisteredService);
413
- } catch (error) {
414
- if (error instanceof ContainerException) {
415
- console.log(error.message); // "Failed to resolve dependency: UnregisteredService"
416
- console.log(error.status); // 500
417
- }
418
- }
419
- ```
340
+ import { Container } from '@ooneex/container';
420
341
 
421
- ## Error Handling
342
+ const myContainer = new Container();
343
+ myContainer.add(MyService);
344
+ ```
422
345
 
423
- The container provides comprehensive error handling through the `ContainerException` class:
346
+ ### Service Factory Pattern
424
347
 
425
348
  ```typescript
426
- import { Container, ContainerException } from '@ooneex/container';
427
-
428
- const container = new Container();
429
-
430
- // Service not registered
431
- try {
432
- const service = container.get(UnknownService);
433
- } catch (error) {
434
- if (error instanceof ContainerException) {
435
- console.log(`Service error: ${error.message}`);
349
+ import { container, injectable } from '@ooneex/container';
350
+
351
+ @injectable()
352
+ class ConfigService {
353
+ private readonly config: Record<string, unknown> = {};
354
+
355
+ public set(key: string, value: unknown): void {
356
+ this.config[key] = value;
436
357
  }
437
- }
438
-
439
- // Constant not found
440
- try {
441
- const value = container.getConstant("MISSING_CONSTANT");
442
- } catch (error) {
443
- if (error instanceof ContainerException) {
444
- console.log(`Constant error: ${error.message}`);
358
+
359
+ public get<T>(key: string): T {
360
+ return this.config[key] as T;
445
361
  }
446
362
  }
447
- ```
448
363
 
449
- ## Best Practices
364
+ container.add(ConfigService);
450
365
 
451
- ### 1. Use Symbols for Internal Constants
452
- ```typescript
453
- // Use symbols to avoid naming conflicts
454
- const DATABASE_CONFIG = Symbol("database-config");
455
- container.addConstant(DATABASE_CONFIG, config);
366
+ const config = container.get(ConfigService);
367
+ config.set('database.host', 'localhost');
456
368
  ```
457
369
 
458
- ### 2. Check Registration Before Use
459
- ```typescript
460
- if (!container.has(OptionalService)) {
461
- container.add(OptionalService);
462
- }
463
- ```
370
+ ### Error Handling
464
371
 
465
- ### 3. Handle Exceptions Gracefully
466
372
  ```typescript
373
+ import { container, ContainerException } from '@ooneex/container';
374
+
467
375
  try {
468
- const service = container.get(CriticalService);
469
- return service.process();
376
+ const service = container.get(UnregisteredService);
470
377
  } catch (error) {
471
378
  if (error instanceof ContainerException) {
472
- // Log error and provide fallback
473
- console.error("Service unavailable:", error.message);
474
- return defaultResult;
379
+ console.error('Service not found:', error.message);
475
380
  }
476
- throw error;
477
381
  }
478
382
  ```
479
383
 
480
- ### 4. Use Appropriate Scoping
481
- ```typescript
482
- // Singleton for shared resources
483
- container.add(DatabaseConnection, EContainerScope.Singleton);
384
+ ### Integration with Ooneex Framework
484
385
 
485
- // Transient for stateful services
486
- container.add(UserSession, EContainerScope.Transient);
386
+ ```typescript
387
+ import { container } from '@ooneex/container';
388
+ import { decorator } from '@ooneex/service';
487
389
 
488
- // Request scope for web request context
489
- container.add(RequestContext, EContainerScope.Request);
490
- ```
390
+ @decorator.service()
391
+ class PaymentService {
392
+ public processPayment(amount: number) {
393
+ // Payment logic
394
+ }
395
+ }
491
396
 
492
- ### 5. Organize Dependencies
493
- ```typescript
494
- // Group related services and constants
495
- const setupDatabase = (container: Container) => {
496
- const DB_CONFIG = Symbol("db-config");
497
- container.addConstant(DB_CONFIG, databaseConfig);
498
- container.add(DatabaseService);
499
- container.add(UserRepository);
500
- };
501
-
502
- const setupApi = (container: Container) => {
503
- container.addConstant("API_BASE_URL", process.env.API_URL);
504
- container.add(ApiClient);
505
- container.add(AuthService);
506
- };
397
+ // Service is automatically registered by the decorator
398
+ const paymentService = container.get(PaymentService);
507
399
  ```
508
400
 
509
401
  ## License
510
402
 
511
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
512
-
513
- ## Copyright
514
-
515
- Copyright (c) 2025 Ooneex
516
-
517
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
518
-
519
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
520
-
521
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
403
+ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
522
404
 
523
405
  ## Contributing
524
406
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { inject } from "inversify";
1
+ import { inject, injectable } from "inversify";
2
2
  /** biome-ignore-all lint/suspicious/noExplicitAny: trust me */
3
3
  declare enum EContainerScope {
4
4
  Singleton = "singleton",
@@ -34,28 +34,4 @@ import { Exception } from "@ooneex/exception";
34
34
  declare class ContainerException extends Exception {
35
35
  constructor(message: string, data?: Record<string, unknown>);
36
36
  }
37
- import { AnalyticsClassType } from "@ooneex/analytics";
38
- import { CacheClassType } from "@ooneex/cache";
39
- import { CronClassType } from "@ooneex/cron";
40
- import { DatabaseClassType } from "@ooneex/database";
41
- import { LoggerClassType } from "@ooneex/logger";
42
- import { MailerClassType } from "@ooneex/mailer";
43
- import { MiddlewareClassType } from "@ooneex/middleware";
44
- import { PermissionClassType } from "@ooneex/permission";
45
- import { RepositoryClassType } from "@ooneex/repository";
46
- import { ServiceClassType } from "@ooneex/service";
47
- import { StorageClassType } from "@ooneex/storage";
48
- declare const decorator: {
49
- analytics: (scope?: EContainerScope) => (target: AnalyticsClassType) => void;
50
- service: (scope?: EContainerScope) => (target: ServiceClassType) => void;
51
- cache: (scope?: EContainerScope) => (target: CacheClassType) => void;
52
- database: (scope?: EContainerScope) => (target: DatabaseClassType) => void;
53
- logger: (scope?: EContainerScope) => (target: LoggerClassType) => void;
54
- mailer: (scope?: EContainerScope) => (target: MailerClassType) => void;
55
- middleware: (scope?: EContainerScope) => (target: MiddlewareClassType) => void;
56
- repository: (scope?: EContainerScope) => (target: RepositoryClassType) => void;
57
- storage: (scope?: EContainerScope) => (target: StorageClassType) => void;
58
- cron: (scope?: EContainerScope) => (target: CronClassType) => void;
59
- permission: (scope?: EContainerScope) => (target: PermissionClassType) => void;
60
- };
61
- export { inject, decorator, container, IContainer, EContainerScope, ContainerException, Container };
37
+ export { injectable, inject, container, IContainer, EContainerScope, ContainerException, Container };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import{inject as E}from"inversify";import{Container as y}from"inversify";import{Exception as l}from"@ooneex/exception";import{HttpStatus as t}from"@ooneex/http-status";class e extends l{constructor(n,o={}){super(n,{status:t.Code.InternalServerError,data:o});this.name="ContainerException"}}var r;((a)=>{a.Singleton="singleton";a.Transient="transient";a.Request="request"})(r||={});var s=new y;class p{alias={};add(n,o="singleton"){try{s.unbind(n)}catch{}let m=s.bind(n).toSelf();switch(o){case"request":m.inRequestScope();break;case"transient":m.inTransientScope();break;default:m.inSingletonScope()}}resolveAlias(n,o=!0){if(typeof n==="string"){let m=this.alias[n];if(!m){if(o)throw new e(`Failed to resolve alias: ${n}`);return null}return m}return n}get(n){let o=this.resolveAlias(n,!0);try{return s.get(o)}catch(m){throw new e(`Failed to resolve dependency: ${typeof n==="string"?n:n.name}`)}}has(n){let o=this.resolveAlias(n,!1);if(o===null)return!1;return s.isBound(o)}remove(n){let o=this.resolveAlias(n,!0);if(o&&s.isBound(o))s.unbind(o)}addConstant(n,o){try{s.unbind(n)}catch{}s.bind(n).toConstantValue(o)}getConstant(n){try{return s.get(n)}catch(o){throw new e(`Failed to resolve constant: ${n.toString()}`)}}hasConstant(n){return s.isBound(n)}removeConstant(n){if(s.isBound(n))s.unbind(n)}addAlias(n,o){this.alias[n]=o}}var i=new p;var W={analytics:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Analytics")&&!o.name.endsWith("AnalyticsAdapter"))throw new e(`Class name "${o.name}" must end with "Analytics" or "AnalyticsAdapter"`);i.add(o,n)}},service:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Service"))throw new e(`Class name "${o.name}" must end with "Service"`);i.add(o,n)}},cache:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Cache"))throw new e(`Class name "${o.name}" must end with "Cache"`);i.add(o,n)}},database:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Database"))throw new e(`Class name "${o.name}" must end with "Database"`);i.add(o,n)}},logger:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Logger"))throw new e(`Class name "${o.name}" must end with "Logger"`);i.add(o,n)}},mailer:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Mailer")&&!o.name.endsWith("MailerAdapter"))throw new e(`Class name "${o.name}" must end with "Mailer" or "MailerAdapter"`);i.add(o,n)}},middleware:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Middleware"))throw new e(`Class name "${o.name}" must end with "Middleware"`);i.add(o,n)}},repository:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Repository"))throw new e(`Class name "${o.name}" must end with "Repository"`);i.add(o,n)}},storage:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Storage"))throw new e(`Class name "${o.name}" must end with "Storage"`);i.add(o,n)}},cron:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Cron"))throw new e(`Class name "${o.name}" must end with "Cron"`);i.add(o,n)}},permission:(n="singleton")=>{return(o)=>{if(!o.name.endsWith("Permission"))throw new e(`Class name "${o.name}" must end with "Permission"`);i.add(o,n)}}};export{E as inject,W as decorator,i as container,r as EContainerScope,e as ContainerException,p as Container};
1
+ import{inject as G,injectable as J}from"inversify";import{Container as w}from"inversify";import{Exception as b}from"@ooneex/exception";import{HttpStatus as l}from"@ooneex/http-status";class u extends b{constructor(o,m={}){super(o,{status:l.Code.InternalServerError,data:m});this.name="ContainerException"}}var p;((y)=>{y.Singleton="singleton";y.Transient="transient";y.Request="request"})(p||={});var n=new w;class x{alias={};add(o,m="singleton"){try{n.unbind(o)}catch{}let s=n.bind(o).toSelf();switch(m){case"request":s.inRequestScope();break;case"transient":s.inTransientScope();break;default:s.inSingletonScope()}}resolveAlias(o,m=!0){if(typeof o==="string"){let s=this.alias[o];if(!s){if(m)throw new u(`Failed to resolve alias: ${o}`);return null}return s}return o}get(o){let m=this.resolveAlias(o,!0);try{return n.get(m)}catch(s){throw new u(`Failed to resolve dependency: ${typeof o==="string"?o:o.name}`)}}has(o){let m=this.resolveAlias(o,!1);if(m===null)return!1;return n.isBound(m)}remove(o){let m=this.resolveAlias(o,!0);if(m&&n.isBound(m))n.unbind(m)}addConstant(o,m){try{n.unbind(o)}catch{}n.bind(o).toConstantValue(m)}getConstant(o){try{return n.get(o)}catch(m){throw new u(`Failed to resolve constant: ${o.toString()}`)}}hasConstant(o){return n.isBound(o)}removeConstant(o){if(n.isBound(o))n.unbind(o)}addAlias(o,m){this.alias[o]=m}}var j=new x;export{J as injectable,G as inject,j as container,p as EContainerScope,u as ContainerException,x as Container};
2
2
 
3
- //# debugId=5D96BB24FDB8E1BC64756E2164756E21
3
+ //# debugId=34C1AFF9D7D5EC8B64756E2164756E21
package/dist/index.js.map CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["src/index.ts", "src/Container.ts", "src/ContainerException.ts", "src/types.ts", "src/decorators.ts"],
3
+ "sources": ["src/index.ts", "src/Container.ts", "src/ContainerException.ts", "src/types.ts"],
4
4
  "sourcesContent": [
5
- "export { inject } from \"inversify\";\nexport * from \"./Container\";\nexport * from \"./ContainerException\";\nexport * from \"./decorators\";\nexport * from \"./types\";\n",
5
+ "export { inject, injectable } from \"inversify\";\nexport { Container, container } from \"./Container\";\nexport { ContainerException } from \"./ContainerException\";\nexport * from \"./types\";\n",
6
6
  "/** biome-ignore-all lint/suspicious/noExplicitAny: trust me */\n\nimport { Container as InversifyContainer } from \"inversify\";\nimport { ContainerException } from \"./ContainerException\";\nimport { EContainerScope, type IContainer } from \"./types\";\n\n// Shared DI container instance across all Container instances\nconst sharedDI = new InversifyContainer();\n\nexport class Container implements IContainer {\n private alias: Record<string, any> = {};\n\n public add(target: new (...args: any[]) => any, scope: EContainerScope = EContainerScope.Singleton): void {\n try {\n sharedDI.unbind(target);\n } catch {}\n\n const binding = sharedDI.bind(target).toSelf();\n\n switch (scope) {\n case EContainerScope.Request:\n binding.inRequestScope();\n break;\n case EContainerScope.Transient:\n binding.inTransientScope();\n break;\n default:\n binding.inSingletonScope();\n }\n }\n\n private resolveAlias<T>(\n target: (new (...args: any[]) => T) | string,\n throwOnMissing = true,\n ): (new (...args: any[]) => T) | null {\n if (typeof target === \"string\") {\n const aliasedTarget = this.alias[target];\n if (!aliasedTarget) {\n if (throwOnMissing) {\n throw new ContainerException(`Failed to resolve alias: ${target}`);\n }\n return null;\n }\n return aliasedTarget as new (\n ...args: any[]\n ) => T;\n }\n return target as new (\n ...args: any[]\n ) => T;\n }\n\n public get<T>(target: (new (...args: any[]) => T) | string): T {\n const resolvedTarget = this.resolveAlias(target, true);\n\n try {\n return sharedDI.get<T>(resolvedTarget as new (...args: any[]) => T);\n } catch (_e) {\n throw new ContainerException(\n `Failed to resolve dependency: ${typeof target === \"string\" ? target : target.name}`,\n );\n }\n }\n\n public has(target: (new (...args: any[]) => unknown) | string): boolean {\n const resolvedTarget = this.resolveAlias(target, false);\n if (resolvedTarget === null) {\n return false;\n }\n return sharedDI.isBound(resolvedTarget);\n }\n\n public remove(target: (new (...args: unknown[]) => unknown) | string): void {\n const resolvedTarget = this.resolveAlias(target, true);\n if (resolvedTarget && sharedDI.isBound(resolvedTarget)) {\n sharedDI.unbind(resolvedTarget);\n }\n }\n\n public addConstant<T>(identifier: string | symbol, value: T): void {\n try {\n sharedDI.unbind(identifier);\n } catch {}\n\n sharedDI.bind<T>(identifier).toConstantValue(value);\n }\n\n public getConstant<T>(identifier: string | symbol): T {\n try {\n return sharedDI.get<T>(identifier);\n } catch (_e) {\n throw new ContainerException(`Failed to resolve constant: ${identifier.toString()}`);\n }\n }\n\n public hasConstant(identifier: string | symbol): boolean {\n return sharedDI.isBound(identifier);\n }\n\n public removeConstant(identifier: string | symbol): void {\n if (sharedDI.isBound(identifier)) {\n sharedDI.unbind(identifier);\n }\n }\n\n public addAlias<T>(alias: string, target: new (...args: any[]) => T): void {\n this.alias[alias] = target;\n }\n}\n\nexport const container: Container = new Container();\n",
7
7
  "import { Exception } from \"@ooneex/exception\";\nimport { HttpStatus } from \"@ooneex/http-status\";\n\nexport class ContainerException extends Exception {\n constructor(message: string, data: Record<string, unknown> = {}) {\n super(message, {\n status: HttpStatus.Code.InternalServerError,\n data,\n });\n this.name = \"ContainerException\";\n }\n}\n",
8
- "/** biome-ignore-all lint/suspicious/noExplicitAny: trust me */\n\nexport enum EContainerScope {\n Singleton = \"singleton\",\n Transient = \"transient\",\n Request = \"request\",\n}\n\nexport interface IContainer {\n add: (target: new (...args: any[]) => any, scope?: EContainerScope) => void;\n get: <T>(target: (new (...args: any[]) => T) | string) => T;\n has: (target: (new (...args: any[]) => any) | string) => boolean;\n remove: (target: (new (...args: any[]) => any) | string) => void;\n addConstant: <T>(identifier: string | symbol, value: T) => void;\n getConstant: <T>(identifier: string | symbol) => T;\n hasConstant: (identifier: string | symbol) => boolean;\n removeConstant(identifier: string | symbol): void;\n addAlias<T>(alias: string, target: new (...args: any[]) => T): void;\n}\n",
9
- "import type { AnalyticsClassType } from \"@ooneex/analytics\";\nimport type { CacheClassType } from \"@ooneex/cache\";\nimport type { CronClassType } from \"@ooneex/cron\";\nimport type { DatabaseClassType } from \"@ooneex/database\";\nimport type { LoggerClassType } from \"@ooneex/logger\";\nimport type { MailerClassType } from \"@ooneex/mailer\";\nimport type { MiddlewareClassType } from \"@ooneex/middleware\";\nimport type { PermissionClassType } from \"@ooneex/permission\";\nimport type { RepositoryClassType } from \"@ooneex/repository\";\nimport type { ServiceClassType } from \"@ooneex/service\";\nimport type { StorageClassType } from \"@ooneex/storage\";\nimport { container } from \"./Container\";\nimport { ContainerException } from \"./ContainerException\";\nimport { EContainerScope } from \"./types\";\n\nexport const decorator = {\n analytics: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: AnalyticsClassType): void => {\n if (!target.name.endsWith(\"Analytics\") && !target.name.endsWith(\"AnalyticsAdapter\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Analytics\" or \"AnalyticsAdapter\"`);\n }\n container.add(target, scope);\n };\n },\n service: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: ServiceClassType): void => {\n if (!target.name.endsWith(\"Service\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Service\"`);\n }\n container.add(target, scope);\n };\n },\n cache: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: CacheClassType): void => {\n if (!target.name.endsWith(\"Cache\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Cache\"`);\n }\n container.add(target, scope);\n };\n },\n database: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: DatabaseClassType): void => {\n if (!target.name.endsWith(\"Database\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Database\"`);\n }\n container.add(target, scope);\n };\n },\n logger: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: LoggerClassType): void => {\n if (!target.name.endsWith(\"Logger\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Logger\"`);\n }\n container.add(target, scope);\n };\n },\n mailer: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: MailerClassType): void => {\n if (!target.name.endsWith(\"Mailer\") && !target.name.endsWith(\"MailerAdapter\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Mailer\" or \"MailerAdapter\"`);\n }\n container.add(target, scope);\n };\n },\n middleware: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: MiddlewareClassType): void => {\n if (!target.name.endsWith(\"Middleware\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Middleware\"`);\n }\n container.add(target, scope);\n };\n },\n repository: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: RepositoryClassType): void => {\n if (!target.name.endsWith(\"Repository\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Repository\"`);\n }\n container.add(target, scope);\n };\n },\n storage: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: StorageClassType): void => {\n if (!target.name.endsWith(\"Storage\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Storage\"`);\n }\n container.add(target, scope);\n };\n },\n cron: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: CronClassType): void => {\n if (!target.name.endsWith(\"Cron\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Cron\"`);\n }\n container.add(target, scope);\n\n // Create own container\n };\n },\n permission: (scope: EContainerScope = EContainerScope.Singleton) => {\n return (target: PermissionClassType): void => {\n if (!target.name.endsWith(\"Permission\")) {\n throw new ContainerException(`Class name \"${target.name}\" must end with \"Permission\"`);\n }\n container.add(target, scope);\n };\n },\n};\n"
8
+ "/** biome-ignore-all lint/suspicious/noExplicitAny: trust me */\n\nexport enum EContainerScope {\n Singleton = \"singleton\",\n Transient = \"transient\",\n Request = \"request\",\n}\n\nexport interface IContainer {\n add: (target: new (...args: any[]) => any, scope?: EContainerScope) => void;\n get: <T>(target: (new (...args: any[]) => T) | string) => T;\n has: (target: (new (...args: any[]) => any) | string) => boolean;\n remove: (target: (new (...args: any[]) => any) | string) => void;\n addConstant: <T>(identifier: string | symbol, value: T) => void;\n getConstant: <T>(identifier: string | symbol) => T;\n hasConstant: (identifier: string | symbol) => boolean;\n removeConstant(identifier: string | symbol): void;\n addAlias<T>(alias: string, target: new (...args: any[]) => T): void;\n}\n"
10
9
  ],
11
- "mappings": "AAAA,iBAAS,kBCET,oBAAS,kBCFT,oBAAS,0BACT,qBAAS,4BAEF,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AAQ,EAAI,EACrD,GAAI,GAAkB,EAAS,QAAQ,CAAc,EACnD,EAAS,OAAO,CAAc,EAI3B,WAAc,CAAC,EAA6B,EAAgB,CACjE,GAAI,CACF,EAAS,OAAO,CAAU,EAC1B,KAAM,EAER,EAAS,KAAQ,CAAU,EAAE,gBAAgB,CAAK,EAG7C,WAAc,CAAC,EAAgC,CACpD,GAAI,CACF,OAAO,EAAS,IAAO,CAAU,EACjC,MAAO,EAAI,CACX,MAAM,IAAI,EAAmB,+BAA+B,EAAW,SAAS,GAAG,GAIhF,WAAW,CAAC,EAAsC,CACvD,OAAO,EAAS,QAAQ,CAAU,EAG7B,cAAc,CAAC,EAAmC,CACvD,GAAI,EAAS,QAAQ,CAAU,EAC7B,EAAS,OAAO,CAAU,EAIvB,QAAW,CAAC,EAAe,EAAyC,CACzE,KAAK,MAAM,GAAS,EAExB,CAEO,IAAM,EAAuB,IAAI",
11
+ "debugId": "34C1AFF9D7D5EC8B64756E2164756E21",
13
12
  "names": []
14
13
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ooneex/container",
3
- "description": "",
4
- "version": "0.0.1",
3
+ "description": "Lightweight dependency injection container built on Inversify for managing services and their lifecycle",
4
+ "version": "0.0.5",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -25,27 +25,21 @@
25
25
  "test": "bun test tests",
26
26
  "build": "bunup",
27
27
  "lint": "tsgo --noEmit && bunx biome lint",
28
- "publish:prod": "bun publish --tolerate-republish --access public",
29
- "publish:pack": "bun pm pack --destination ./dist",
30
- "publish:dry": "bun publish --dry-run"
28
+ "publish": "bun publish --access public || true"
31
29
  },
32
- "devDependencies": {
33
- "@ooneex/analytics": "0.0.1",
34
- "@ooneex/cache": "0.0.1",
35
- "@ooneex/cron": "0.0.1",
36
- "@ooneex/database": "0.0.1",
37
- "@ooneex/logger": "0.0.1",
38
- "@ooneex/mailer": "0.0.1",
39
- "@ooneex/middleware": "0.0.1",
40
- "@ooneex/permission": "0.0.1",
41
- "@ooneex/repository": "0.0.1",
42
- "@ooneex/service": "0.0.1",
43
- "@ooneex/storage": "0.0.1"
44
- },
45
- "peerDependencies": {},
46
30
  "dependencies": {
47
31
  "@ooneex/exception": "0.0.1",
48
32
  "@ooneex/http-status": "0.0.1",
49
33
  "inversify": "^7.10.4"
50
- }
34
+ },
35
+ "keywords": [
36
+ "bun",
37
+ "container",
38
+ "dependency-injection",
39
+ "di",
40
+ "inversify",
41
+ "ioc",
42
+ "ooneex",
43
+ "typescript"
44
+ ]
51
45
  }