@martel/calyx 1.12.0 → 1.13.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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/cli/index.ts +7 -1
- package/src/config/config.module.ts +16 -2
- package/src/config/config.service.ts +20 -6
- package/src/core/container.ts +340 -154
- package/src/core/testing-module.ts +4 -0
- package/src/cqrs/cqrs.ts +93 -4
- package/src/database/sequelize.module.ts +239 -0
- package/src/event-emitter/decorators.ts +2 -2
- package/src/event-emitter/event-emitter.ts +3 -0
- package/src/http/application.ts +135 -6
- package/src/http/decorators.ts +21 -1
- package/src/http/exceptions.ts +97 -0
- package/src/http/factory.ts +3 -0
- package/src/http/router.ts +27 -4
- package/src/index.ts +1 -0
- package/src/microservices/exceptions.ts +10 -0
- package/src/microservices/index.ts +1 -0
- package/src/queue/queue.module.ts +73 -5
- package/src/terminus/terminus.ts +75 -2
- package/src/validation/compiler.ts +133 -10
- package/src/validation/decorators.ts +164 -2
- package/src/websockets/exceptions.ts +10 -0
- package/src/websockets/index.ts +1 -0
- package/tests/circular-di.test.ts +151 -0
- package/tests/di.test.ts +10 -2
- package/tests/nestjs-parity.test.ts +255 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# [1.13.0](https://github.com/bmartel/calyx/compare/v1.12.0...v1.13.0) (2026-07-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **core:** implement circular dependency proxy resolution and recursive dynamic modules ([82b7c8d](https://github.com/bmartel/calyx/commit/82b7c8df2973a67f68b12a33f1200b956595f6bc))
|
|
7
|
+
* **nestjs-parity:** implement global prefixing, dynamic host routing, advanced validation, config namespaces, queues, cqrs, and health indicators ([c418b9b](https://github.com/bmartel/calyx/commit/c418b9b3ca32b9a93b3dc14e2aa10aa3ae0c75d9))
|
|
8
|
+
|
|
1
9
|
# [1.12.0](https://github.com/bmartel/calyx/compare/v1.11.0...v1.12.0) (2026-07-01)
|
|
2
10
|
|
|
3
11
|
|
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -97,7 +97,13 @@ function runBuild(cmdArgs: string[]) {
|
|
|
97
97
|
'--external',
|
|
98
98
|
'typeorm',
|
|
99
99
|
'--external',
|
|
100
|
-
'
|
|
100
|
+
'sequelize',
|
|
101
|
+
'--external',
|
|
102
|
+
'graphql',
|
|
103
|
+
'--external',
|
|
104
|
+
'class-validator',
|
|
105
|
+
'--external',
|
|
106
|
+
'class-transformer'
|
|
101
107
|
], { stdio: 'inherit' });
|
|
102
108
|
if (proc.status === 0) {
|
|
103
109
|
console.log('Build completed successfully. Output at ./dist/main.js');
|
|
@@ -40,8 +40,13 @@ export class ConfigModule {
|
|
|
40
40
|
if (options.load) {
|
|
41
41
|
for (const factory of options.load) {
|
|
42
42
|
const data = factory();
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const key = (factory as any).KEY;
|
|
44
|
+
if (key) {
|
|
45
|
+
(configData as any)[key] = data;
|
|
46
|
+
} else {
|
|
47
|
+
for (const [k, val] of Object.entries(data)) {
|
|
48
|
+
configData[k] = String(val);
|
|
49
|
+
}
|
|
45
50
|
}
|
|
46
51
|
}
|
|
47
52
|
}
|
|
@@ -59,3 +64,12 @@ export class ConfigModule {
|
|
|
59
64
|
};
|
|
60
65
|
}
|
|
61
66
|
}
|
|
67
|
+
|
|
68
|
+
export function registerAs<T extends Record<string, any> = Record<string, any>>(
|
|
69
|
+
token: string,
|
|
70
|
+
configFactory: () => T,
|
|
71
|
+
) {
|
|
72
|
+
const factory = () => configFactory();
|
|
73
|
+
Object.defineProperty(factory, 'KEY', { value: token, writable: false });
|
|
74
|
+
return factory;
|
|
75
|
+
}
|
|
@@ -2,23 +2,37 @@ import { Injectable } from '../core/decorators.ts';
|
|
|
2
2
|
|
|
3
3
|
@Injectable()
|
|
4
4
|
export class ConfigService {
|
|
5
|
-
private readonly env: Record<string,
|
|
5
|
+
private readonly env: Record<string, any> = {};
|
|
6
6
|
|
|
7
|
-
constructor(internalConfig?: Record<string,
|
|
7
|
+
constructor(internalConfig?: Record<string, any>) {
|
|
8
8
|
this.env = internalConfig ?? (process.env as Record<string, string>);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
get<T =
|
|
12
|
-
|
|
11
|
+
get<T = any>(path: string, defaultValue?: T): T {
|
|
12
|
+
let val = this.env[path];
|
|
13
|
+
if (val === undefined && path.includes('.')) {
|
|
14
|
+
const segments = path.split('.');
|
|
15
|
+
let current: any = this.env;
|
|
16
|
+
for (const segment of segments) {
|
|
17
|
+
if (current && typeof current === 'object' && segment in current) {
|
|
18
|
+
current = current[segment];
|
|
19
|
+
} else {
|
|
20
|
+
current = undefined;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
val = current;
|
|
25
|
+
}
|
|
26
|
+
|
|
13
27
|
if (val === undefined) {
|
|
14
28
|
return defaultValue as T;
|
|
15
29
|
}
|
|
16
30
|
if (val === 'true') return true as unknown as T;
|
|
17
31
|
if (val === 'false') return false as unknown as T;
|
|
18
32
|
const num = Number(val);
|
|
19
|
-
if (!isNaN(num) && val.trim() !== '') {
|
|
33
|
+
if (typeof val === 'string' && !isNaN(num) && val.trim() !== '') {
|
|
20
34
|
return num as unknown as T;
|
|
21
35
|
}
|
|
22
|
-
return val as
|
|
36
|
+
return val as T;
|
|
23
37
|
}
|
|
24
38
|
}
|