@venizia/ignis-inversion 0.0.1-2 → 0.0.1-3
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/LICENSE.md +102 -0
- package/README.md +57 -0
- package/dist/common/app-error.d.ts +1 -1
- package/dist/common/base-helper.js +2 -2
- package/dist/common/index.d.ts +5 -5
- package/dist/common/keys.js +2 -2
- package/dist/common/types.d.ts +1 -1
- package/dist/common/types.js +8 -8
- package/dist/container.d.ts +2 -2
- package/dist/container.js +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/registry.d.ts +2 -2
- package/dist/registry.js +3 -3
- package/package.json +5 -10
package/LICENSE.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Ignis Framework License
|
|
2
|
+
|
|
3
|
+
Ignis is a TypeScript Server Infrastructure framework built on [Hono](https://hono.dev/).
|
|
4
|
+
|
|
5
|
+
## MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2025 VENIZIA Ltd. Co.
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Packages
|
|
30
|
+
|
|
31
|
+
This monorepo contains the following packages, all licensed under MIT:
|
|
32
|
+
|
|
33
|
+
| Package | Description |
|
|
34
|
+
|---------|-------------|
|
|
35
|
+
| `@venizia/ignis` | Core framework - controllers, services, decorators |
|
|
36
|
+
| `@venizia/ignis-helpers` | Utility helpers - logging, cron, Redis, queues, storage |
|
|
37
|
+
| `@venizia/ignis-inversion` | Dependency Injection & IoC container |
|
|
38
|
+
| `@venizia/dev-configs` | Shared ESLint, Prettier, TypeScript configurations |
|
|
39
|
+
| `@venizia/ignis-docs` | Documentation and MCP Server |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Third-Party Dependencies
|
|
44
|
+
|
|
45
|
+
Ignis uses the following open-source libraries. We are grateful to the authors and contributors of these projects.
|
|
46
|
+
|
|
47
|
+
### Core Dependencies
|
|
48
|
+
|
|
49
|
+
| Library | License | Description |
|
|
50
|
+
|---------|---------|-------------|
|
|
51
|
+
| [Hono](https://github.com/honojs/hono) | MIT | Ultrafast web framework |
|
|
52
|
+
| [Zod](https://github.com/colinhacks/zod) | MIT | TypeScript-first schema validation |
|
|
53
|
+
| [Drizzle ORM](https://github.com/drizzle-team/drizzle-orm) | Apache-2.0 | TypeScript ORM |
|
|
54
|
+
| [Jose](https://github.com/panva/jose) | MIT | JavaScript Object Signing and Encryption |
|
|
55
|
+
|
|
56
|
+
### Helpers Dependencies
|
|
57
|
+
|
|
58
|
+
| Library | License | Description |
|
|
59
|
+
|---------|---------|-------------|
|
|
60
|
+
| [Winston](https://github.com/winstonjs/winston) | MIT | Universal logging library |
|
|
61
|
+
| [BullMQ](https://github.com/taskforcesh/bullmq) | MIT | Message queue and job scheduling |
|
|
62
|
+
| [IORedis](https://github.com/redis/ioredis) | MIT | Redis client for Node.js |
|
|
63
|
+
| [MinIO](https://github.com/minio/minio-js) | Apache-2.0 | S3-compatible object storage client |
|
|
64
|
+
| [Axios](https://github.com/axios/axios) | MIT | HTTP client |
|
|
65
|
+
| [Day.js](https://github.com/iamkun/dayjs) | MIT | Date manipulation library |
|
|
66
|
+
| [Cron](https://github.com/kelektiv/node-cron) | MIT | Cron job scheduler |
|
|
67
|
+
| [Socket.IO](https://github.com/socketio/socket.io) | MIT | Real-time bidirectional communication |
|
|
68
|
+
| [MQTT.js](https://github.com/mqttjs/MQTT.js) | MIT | MQTT client |
|
|
69
|
+
|
|
70
|
+
### Utility Dependencies
|
|
71
|
+
|
|
72
|
+
| Library | License | Description |
|
|
73
|
+
|---------|---------|-------------|
|
|
74
|
+
| [Lodash](https://github.com/lodash/lodash) | MIT | Utility library |
|
|
75
|
+
| [reflect-metadata](https://github.com/rbuckton/reflect-metadata) | Apache-2.0 | Metadata reflection API |
|
|
76
|
+
|
|
77
|
+
### Documentation Dependencies
|
|
78
|
+
|
|
79
|
+
| Library | License | Description |
|
|
80
|
+
|---------|---------|-------------|
|
|
81
|
+
| [VitePress](https://github.com/vuejs/vitepress) | MIT | Static site generator |
|
|
82
|
+
| [Fuse.js](https://github.com/krisk/fuse) | Apache-2.0 | Fuzzy search library |
|
|
83
|
+
| [gray-matter](https://github.com/jonschlinkert/gray-matter) | MIT | Front-matter parser |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Acknowledgments
|
|
88
|
+
|
|
89
|
+
Ignis Framework is inspired by and built upon the work of many open-source projects:
|
|
90
|
+
|
|
91
|
+
- **[Hono](https://hono.dev/)** by Yusuke Wada - The ultrafast web framework that powers Ignis
|
|
92
|
+
- **[LoopBack 4](https://loopback.io/)** by IBM/StrongLoop - Inspiration for the enterprise architecture patterns
|
|
93
|
+
- **[NestJS](https://nestjs.com/)** by Kamil Mysliwiec - Inspiration for decorator-based controllers
|
|
94
|
+
- **[InversifyJS](https://inversify.io/)** - Inspiration for the IoC container design
|
|
95
|
+
|
|
96
|
+
We thank all the maintainers and contributors of these projects for their excellent work.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Contributing
|
|
101
|
+
|
|
102
|
+
By contributing to Ignis, you agree that your contributions will be licensed under the MIT License.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @venizia/ignis-inversion
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@venizia/ignis-inversion)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A standalone **Dependency Injection & Inversion of Control (IoC)** container for the **Ignis Framework**.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
bun add @venizia/ignis-inversion
|
|
12
|
+
# or
|
|
13
|
+
npm install @venizia/ignis-inversion
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Example
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { Container, injectable, inject } from "@venizia/ignis-inversion";
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
class UserService {
|
|
23
|
+
getUser(id: string) {
|
|
24
|
+
return { id, name: "John" };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@injectable()
|
|
29
|
+
class UserController {
|
|
30
|
+
constructor(@inject("UserService") private userService: UserService) {}
|
|
31
|
+
|
|
32
|
+
findUser(id: string) {
|
|
33
|
+
return this.userService.getUser(id);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Register and resolve
|
|
38
|
+
const container = new Container();
|
|
39
|
+
container.bind("UserService").toClass(UserService);
|
|
40
|
+
container.bind("UserController").toClass(UserController);
|
|
41
|
+
|
|
42
|
+
const controller = container.resolve<UserController>("UserController");
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## About Ignis
|
|
46
|
+
|
|
47
|
+
Ignis brings together the structured, enterprise development experience of **LoopBack 4** with the blazing speed and simplicity of **Hono** - giving you the best of both worlds.
|
|
48
|
+
|
|
49
|
+
## Documentation
|
|
50
|
+
|
|
51
|
+
- [Ignis Repository](https://github.com/venizia-ai/ignis)
|
|
52
|
+
- [Getting Started](https://github.com/venizia-ai/ignis/blob/main/packages/docs/wiki/get-started/index.md)
|
|
53
|
+
- [Dependency Injection](https://github.com/venizia-ai/ignis/blob/main/packages/docs/wiki/get-started/core-concepts/dependency-injection.md)
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.BaseHelper = void 0;
|
|
4
4
|
class BaseHelper {
|
|
5
5
|
constructor(opts) {
|
|
6
|
-
this.scope = opts.scope ??
|
|
7
|
-
this.identifier = opts.identifier ??
|
|
6
|
+
this.scope = opts.scope ?? '';
|
|
7
|
+
this.identifier = opts.identifier ?? '';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.BaseHelper = BaseHelper;
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from './app-error';
|
|
2
|
+
export * from './base-helper';
|
|
3
|
+
export * from './keys';
|
|
4
|
+
export * from './logger';
|
|
5
|
+
export * from './types';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/common/keys.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MetadataKeys = void 0;
|
|
4
4
|
exports.MetadataKeys = {
|
|
5
5
|
// Property metadata
|
|
6
|
-
PROPERTIES: Symbol.for(
|
|
6
|
+
PROPERTIES: Symbol.for('ignis:properties'),
|
|
7
7
|
// Injection metadata
|
|
8
|
-
INJECT: Symbol.for(
|
|
8
|
+
INJECT: Symbol.for('ignis:inject'),
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=keys.js.map
|
package/dist/common/types.d.ts
CHANGED
package/dist/common/types.js
CHANGED
|
@@ -7,24 +7,24 @@ exports.BindingKeys = exports.BindingValueTypes = exports.BindingScopes = export
|
|
|
7
7
|
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
8
8
|
const app_error_1 = require("./app-error");
|
|
9
9
|
const isClass = (target) => {
|
|
10
|
-
return typeof target ===
|
|
10
|
+
return typeof target === 'function' && target.prototype !== undefined;
|
|
11
11
|
};
|
|
12
12
|
exports.isClass = isClass;
|
|
13
13
|
const isClassProvider = (target) => {
|
|
14
|
-
return (typeof target ===
|
|
14
|
+
return (typeof target === 'function' && target.prototype && typeof target.prototype.value === 'function');
|
|
15
15
|
};
|
|
16
16
|
exports.isClassProvider = isClassProvider;
|
|
17
17
|
// -----------------------------------------------------------------------
|
|
18
18
|
class BindingScopes {
|
|
19
|
-
static { this.SINGLETON =
|
|
20
|
-
static { this.TRANSIENT =
|
|
19
|
+
static { this.SINGLETON = 'singleton'; }
|
|
20
|
+
static { this.TRANSIENT = 'transient'; }
|
|
21
21
|
}
|
|
22
22
|
exports.BindingScopes = BindingScopes;
|
|
23
23
|
// -----------------------------------------------------------------------
|
|
24
24
|
class BindingValueTypes {
|
|
25
|
-
static { this.CLASS =
|
|
26
|
-
static { this.VALUE =
|
|
27
|
-
static { this.PROVIDER =
|
|
25
|
+
static { this.CLASS = 'class'; }
|
|
26
|
+
static { this.VALUE = 'value'; }
|
|
27
|
+
static { this.PROVIDER = 'provider'; }
|
|
28
28
|
}
|
|
29
29
|
exports.BindingValueTypes = BindingValueTypes;
|
|
30
30
|
// -----------------------------------------------------------------------
|
|
@@ -41,7 +41,7 @@ class BindingKeys {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
keyParts.push(key);
|
|
44
|
-
return keyParts.join(
|
|
44
|
+
return keyParts.join('.');
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
exports.BindingKeys = BindingKeys;
|
package/dist/container.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseHelper } from
|
|
2
|
-
import { BindingValueTypes, IProvider, TBindingScope, TClass, TConstValue, TNullable } from
|
|
1
|
+
import { BaseHelper } from './common/base-helper';
|
|
2
|
+
import { BindingValueTypes, IProvider, TBindingScope, TClass, TConstValue, TNullable } from './common/types';
|
|
3
3
|
export declare class Binding<T = any> extends BaseHelper {
|
|
4
4
|
key: string;
|
|
5
5
|
private bindScope;
|
package/dist/container.js
CHANGED
|
@@ -13,7 +13,7 @@ class Binding extends base_helper_1.BaseHelper {
|
|
|
13
13
|
this.bindScope = types_1.BindingScopes.TRANSIENT;
|
|
14
14
|
this.tags = new Set([]);
|
|
15
15
|
this.key = opts.key;
|
|
16
|
-
const keyParts = this.key.split(
|
|
16
|
+
const keyParts = this.key.split('.');
|
|
17
17
|
if (keyParts.length > 1) {
|
|
18
18
|
const [namespace] = keyParts;
|
|
19
19
|
this.setTags(namespace);
|
|
@@ -139,15 +139,15 @@ class Container extends base_helper_1.BaseHelper {
|
|
|
139
139
|
getBinding(opts) {
|
|
140
140
|
let key = null;
|
|
141
141
|
switch (typeof opts.key) {
|
|
142
|
-
case
|
|
142
|
+
case 'string': {
|
|
143
143
|
key = opts.key;
|
|
144
144
|
break;
|
|
145
145
|
}
|
|
146
|
-
case
|
|
146
|
+
case 'symbol': {
|
|
147
147
|
key = opts.key.toString();
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
|
-
case
|
|
150
|
+
case 'object': {
|
|
151
151
|
key = types_1.BindingKeys.build(opts.key);
|
|
152
152
|
break;
|
|
153
153
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export * from './common';
|
|
3
|
+
export * from './container';
|
|
4
|
+
export * from './registry';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/registry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseHelper } from
|
|
2
|
-
import { IInjectMetadata, IPropertyMetadata, TClass } from
|
|
1
|
+
import { BaseHelper } from './common/base-helper';
|
|
2
|
+
import { IInjectMetadata, IPropertyMetadata, TClass } from './common/types';
|
|
3
3
|
/**
|
|
4
4
|
* Central metadata registry for storing and retrieving decorator metadata
|
|
5
5
|
*/
|
package/dist/registry.js
CHANGED
|
@@ -15,7 +15,7 @@ class MetadataRegistry extends base_helper_1.BaseHelper {
|
|
|
15
15
|
// -----------------------------------------------------------------
|
|
16
16
|
define(opts) {
|
|
17
17
|
const { target, key, value } = opts;
|
|
18
|
-
logger_1.Logger.debug(
|
|
18
|
+
logger_1.Logger.debug('[define] Set metadata | target: %s | key: %s | value: %j', target.constructor.name, key.toString(), value);
|
|
19
19
|
Reflect.defineMetadata(key, value, target);
|
|
20
20
|
}
|
|
21
21
|
// -----------------------------------------------------------------
|
|
@@ -37,14 +37,14 @@ class MetadataRegistry extends base_helper_1.BaseHelper {
|
|
|
37
37
|
getKeys(opts) {
|
|
38
38
|
const { target } = opts;
|
|
39
39
|
return (Reflect.getMetadataKeys(target)?.filter(key => {
|
|
40
|
-
return typeof key ===
|
|
40
|
+
return typeof key === 'symbol' || typeof key === 'string';
|
|
41
41
|
}) ?? []);
|
|
42
42
|
}
|
|
43
43
|
// -----------------------------------------------------------------
|
|
44
44
|
getMethodNames(opts) {
|
|
45
45
|
const { target } = opts;
|
|
46
46
|
const prototype = target.prototype;
|
|
47
|
-
const methods = Object.getOwnPropertyNames(prototype).filter(name => name !==
|
|
47
|
+
const methods = Object.getOwnPropertyNames(prototype).filter(name => name !== 'constructor' && typeof prototype[name] === 'function');
|
|
48
48
|
return methods;
|
|
49
49
|
}
|
|
50
50
|
// -----------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-inversion",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-3",
|
|
4
4
|
"description": "Dependency Injection & Inversion of Control Container",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dependency injection",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"README.md",
|
|
26
|
-
"LICENSE",
|
|
26
|
+
"LICENSE.md",
|
|
27
27
|
"dist",
|
|
28
28
|
"!/**/tests",
|
|
29
29
|
"!/**/dist/tests",
|
|
@@ -44,17 +44,12 @@
|
|
|
44
44
|
"prettier:cli": "prettier \"**/*.{js,ts}\" -l",
|
|
45
45
|
"prettier:fix": "bun run prettier:cli --write",
|
|
46
46
|
"rebuild": "sh ./scripts/rebuild.sh no-version",
|
|
47
|
-
"
|
|
48
|
-
"rebuild:minor": "sh ./scripts/rebuild.sh minor",
|
|
49
|
-
"rebuild:patch": "sh ./scripts/rebuild.sh patch",
|
|
50
|
-
"rebuild:premajor": "sh ./scripts/rebuild.sh premajor",
|
|
51
|
-
"rebuild:preminor": "sh ./scripts/rebuild.sh preminor",
|
|
52
|
-
"rebuild:prepatch": "sh ./scripts/rebuild.sh prepatch",
|
|
53
|
-
"rebuild:prerelease": "sh ./scripts/rebuild.sh prerelease"
|
|
47
|
+
"prepublishOnly": "bun run rebuild"
|
|
54
48
|
},
|
|
55
49
|
"repository": {
|
|
56
50
|
"type": "git",
|
|
57
|
-
"url": "git+https://github.com/VENIZIA-AI/ignis.git"
|
|
51
|
+
"url": "git+https://github.com/VENIZIA-AI/ignis.git",
|
|
52
|
+
"directory": "packages/inversion"
|
|
58
53
|
},
|
|
59
54
|
"author": {
|
|
60
55
|
"name": "VENIZIA AI Developer",
|