@kanjijs/core 0.2.0-beta.16 → 0.2.0-beta.18
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 +7 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -14,8 +14,10 @@ It provides the decorators used to define APIs and the internal storage mechanis
|
|
|
14
14
|
- **`@Use(...middlewares)`**: Registers Hono-compatible middleware for a route or controller.
|
|
15
15
|
- **`@Module({ ... })`**: Defines a module with `imports`, `controllers`, and `providers`.
|
|
16
16
|
- **`@Inject(token)`**: Token-based dependency injection.
|
|
17
|
+
- **`@Body()`, `@Query()`, `@Param()`, `@Headers()`**: Parameter decorators for fine-grained metadata (used by platform adapters).
|
|
17
18
|
|
|
18
19
|
### Request Context (AsyncLocalStorage)
|
|
20
|
+
|
|
19
21
|
Kanjijs Core includes a built-in `kanjijsContext` (based on Node.js AsyncLocalStorage) to track request state globally without prop drilling. It enables access to `requestId` anywhere in the stack.
|
|
20
22
|
|
|
21
23
|
```typescript
|
|
@@ -24,8 +26,11 @@ const reqId = getRequestId();
|
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
### Dependency Injection
|
|
29
|
+
|
|
27
30
|
**KanjijsIoC**: A lightweight, platform-agnostic IoC container embedded in Core. It handles singleton resolution and dependency injection for your modules and controllers.
|
|
28
31
|
|
|
32
|
+
**Strict Mode Compatible**: The DI container now supports strict Token typing (`Token<T>`) and robustly handles `Function` vs `Constructor` type narrowing, ensuring compatibility with strict TypeScript configurations (`strict: true`).
|
|
33
|
+
|
|
29
34
|
### Metadata Storage
|
|
30
35
|
|
|
31
36
|
We use a `WeakMap`-based `MetadataStorage` singleton to keep the memory footprint minimal and ensure metadata is garbage collected if the controller class is no longer referenced.
|
|
@@ -39,8 +44,8 @@ const routes = MetadataStorage.getRoutes(ControllerClass.prototype);
|
|
|
39
44
|
|
|
40
45
|
Kanjijs Core defines the standard exceptions used across the framework.
|
|
41
46
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
47
|
+
- **`HttpException`**: Base class for HTTP errors.
|
|
48
|
+
- **`ExceptionFilter`**: Interface for implementing custom exception filters.
|
|
44
49
|
|
|
45
50
|
```typescript
|
|
46
51
|
import { HttpException } from "@kanjijs/core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanjijs/core",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"test": "bun test"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@kanjijs/common": "^0.2.0-beta.
|
|
18
|
-
"@kanjijs/contracts": "^0.2.0-beta.
|
|
17
|
+
"@kanjijs/common": "^0.2.0-beta.18",
|
|
18
|
+
"@kanjijs/contracts": "^0.2.0-beta.18",
|
|
19
19
|
"reflect-metadata": "^0.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|