@venizia/ignis-docs 0.0.1 → 0.0.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/package.json +2 -2
- package/wiki/changelogs/2025-12-26-nested-relations-and-generics.md +86 -0
- package/wiki/changelogs/2025-12-26-transaction-support.md +57 -0
- package/wiki/changelogs/index.md +3 -1
- package/wiki/changelogs/planned-schema-migrator.md +561 -0
- package/wiki/get-started/best-practices/code-style-standards.md +651 -10
- package/wiki/get-started/best-practices/performance-optimization.md +11 -2
- package/wiki/get-started/core-concepts/components.md +59 -42
- package/wiki/get-started/core-concepts/persistent.md +43 -47
- package/wiki/references/base/components.md +515 -31
- package/wiki/references/base/controllers.md +85 -18
- package/wiki/references/base/datasources.md +78 -5
- package/wiki/references/base/repositories.md +92 -6
- package/wiki/references/helpers/index.md +1 -0
- package/wiki/references/helpers/types.md +151 -0
- package/wiki/changelogs/planned-transaction-support.md +0 -216
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-docs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Documentation and MCP Server for Ignis Framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ignis",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"@braintree/sanitize-url": "^7.1.1",
|
|
112
112
|
"@types/bun": "^1.3.4",
|
|
113
113
|
"@types/glob": "^8.1.0",
|
|
114
|
-
"@venizia/dev-configs": "^0.0.
|
|
114
|
+
"@venizia/dev-configs": "^0.0.4",
|
|
115
115
|
"eslint": "^9.36.0",
|
|
116
116
|
"glob": "^10.4.2",
|
|
117
117
|
"prettier": "^3.6.2",
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Nested Relations & Generic Types
|
|
3
|
+
description: Added support for deep nested inclusions and generic return types in repositories
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Changelog - 2025-12-26
|
|
7
|
+
|
|
8
|
+
## Nested Relations Support & Generic Repository Types
|
|
9
|
+
|
|
10
|
+
This update introduces support for deeply nested relation queries in repositories and enables stronger type safety via generic return types.
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
- **Nested Inclusions**: `include` filters now work recursively to any depth.
|
|
15
|
+
- **Generic Repository Methods**: `find<R>`, `findOne<R>`, etc. now support custom return types.
|
|
16
|
+
- **DrizzleFilterBuilder Decoupling**: Decoupled filter builder from MetadataRegistry for cleaner architecture.
|
|
17
|
+
|
|
18
|
+
## New Features
|
|
19
|
+
|
|
20
|
+
### Nested Relations Support
|
|
21
|
+
|
|
22
|
+
**File:** `packages/core/src/base/repositories/operators/filter.ts`
|
|
23
|
+
|
|
24
|
+
**Problem:** Previously, the `DrizzleFilterBuilder` could only resolve relations for the root entity. Nested includes (e.g., `include: [{ relation: 'a', scope: { include: [{ relation: 'b' }] } }]`) failed because it didn't know the schema of relation 'a'.
|
|
25
|
+
|
|
26
|
+
**Solution:** The builder now accepts a `relationResolver` function (injected from the Repository) which allows it to dynamically lookup schemas and relations for any entity during recursive traversal.
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
// Now works recursively!
|
|
30
|
+
const result = await repo.findOne({
|
|
31
|
+
filter: {
|
|
32
|
+
include: [{
|
|
33
|
+
relation: 'orders',
|
|
34
|
+
scope: {
|
|
35
|
+
include: [{ relation: 'items' }] // Level 2
|
|
36
|
+
}
|
|
37
|
+
}]
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Generic Repository Methods
|
|
43
|
+
|
|
44
|
+
**File:** `packages/core/src/base/repositories/common/types.ts`
|
|
45
|
+
|
|
46
|
+
**Problem:** Repository methods like `findOne` were hardcoded to return the base `DataObject`. When using `include`, the return type didn't reflect the added relations, forcing users to use `as any` or unsafe casts.
|
|
47
|
+
|
|
48
|
+
**Solution:** All read and write methods now accept a generic type parameter `<R>` which defaults to the entity's schema but can be overridden.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
// Define expected shape
|
|
52
|
+
type UserWithPosts = User & { posts: Post[] };
|
|
53
|
+
|
|
54
|
+
// Type-safe call
|
|
55
|
+
const user = await userRepo.findOne<UserWithPosts>({
|
|
56
|
+
filter: { include: [{ relation: 'posts' }] }
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// TypeScript knows 'posts' exists!
|
|
60
|
+
console.log(user?.posts.length);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Benefits:**
|
|
64
|
+
- Stronger type safety in application code.
|
|
65
|
+
- Reduces need for `as any` casting.
|
|
66
|
+
- Better IDE auto-completion.
|
|
67
|
+
|
|
68
|
+
## Files Changed
|
|
69
|
+
|
|
70
|
+
### Core Package (`packages/core`)
|
|
71
|
+
|
|
72
|
+
| File | Changes |
|
|
73
|
+
|------|---------|
|
|
74
|
+
| `src/base/repositories/common/types.ts` | Added generic `<R>` to all repository interface methods |
|
|
75
|
+
| `src/base/repositories/core/base.ts` | Implemented `getRelationResolver` and updated abstract signatures |
|
|
76
|
+
| `src/base/repositories/core/readable.ts` | Updated `find`, `findOne`, `findById` to support generics |
|
|
77
|
+
| `src/base/repositories/core/persistable.ts` | Updated `create`, `update`, `delete` methods to support generics |
|
|
78
|
+
| `src/base/repositories/operators/filter.ts` | Added `relationResolver` support for recursive includes |
|
|
79
|
+
|
|
80
|
+
## Migration Guide
|
|
81
|
+
|
|
82
|
+
### No Breaking Changes
|
|
83
|
+
|
|
84
|
+
This update is fully backward compatible.
|
|
85
|
+
- Existing calls to repository methods will continue to work (using the default `DataObject` return type).
|
|
86
|
+
- The new generic type parameter is optional.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Transaction Support
|
|
3
|
+
description: Explicit transaction support for atomic operations across repositories
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Changelog - 2025-12-26
|
|
7
|
+
|
|
8
|
+
## Transaction Support
|
|
9
|
+
|
|
10
|
+
Added explicit transaction support to the repository layer, enabling atomic operations across multiple services and repositories.
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
- **Explicit Transactions**: `beginTransaction()` method on repositories.
|
|
15
|
+
- **Isolation Levels**: Support for `READ COMMITTED`, `REPEATABLE READ`, and `SERIALIZABLE`.
|
|
16
|
+
- **Pass-through Context**: Transaction objects can be passed via `options`.
|
|
17
|
+
|
|
18
|
+
## New Features
|
|
19
|
+
|
|
20
|
+
### Repository Transactions
|
|
21
|
+
|
|
22
|
+
**File:** `packages/core/src/base/repositories/core/base.ts`
|
|
23
|
+
|
|
24
|
+
**Problem:** Previously, transactions relied on Drizzle's callback API, which made it difficult to share a transaction context across different services or decoupled components.
|
|
25
|
+
|
|
26
|
+
**Solution:** Introduced explicit `ITransaction` objects managed by the repository/datasource.
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
const tx = await repo.beginTransaction();
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
await repo.create({ data: {...}, options: { transaction: tx } });
|
|
33
|
+
await otherRepo.create({ data: {...}, options: { transaction: tx } });
|
|
34
|
+
|
|
35
|
+
await tx.commit();
|
|
36
|
+
} catch (err) {
|
|
37
|
+
await tx.rollback();
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Files Changed
|
|
42
|
+
|
|
43
|
+
### Core Package (`packages/core`)
|
|
44
|
+
|
|
45
|
+
| File | Changes |
|
|
46
|
+
|------|---------|
|
|
47
|
+
| `src/base/repositories/core/base.ts` | Added `beginTransaction` and transaction handling logic |
|
|
48
|
+
| `src/base/repositories/core/readable.ts` | Updated read methods to respect transaction context |
|
|
49
|
+
| `src/base/repositories/core/persistable.ts` | Updated write methods to respect transaction context |
|
|
50
|
+
| `src/base/datasources/common/types.ts` | Added `ITransaction`, `ITransactionOptions`, and `IsolationLevels` |
|
|
51
|
+
| `src/base/datasources/base.ts` | Implemented `beginTransaction` on `BaseDataSource` |
|
|
52
|
+
|
|
53
|
+
## Migration Guide
|
|
54
|
+
|
|
55
|
+
### No Breaking Changes
|
|
56
|
+
|
|
57
|
+
This is an additive feature. Existing code using standard CRUD methods will continue to work without modification (using implicit auto-commit transactions).
|
package/wiki/changelogs/index.md
CHANGED
|
@@ -11,12 +11,14 @@ This section tracks the history of significant changes, refactors, and updates t
|
|
|
11
11
|
|
|
12
12
|
| Feature | Description | Priority |
|
|
13
13
|
|---------|-------------|----------|
|
|
14
|
-
| [
|
|
14
|
+
| [Schema Migrator](./planned-schema-migrator) | LoopBack 4-style auto schema migration without Drizzle Kit | High |
|
|
15
15
|
|
|
16
16
|
## Recent Changes
|
|
17
17
|
|
|
18
18
|
| Date | Title | Type |
|
|
19
19
|
|------|-------|------|
|
|
20
|
+
| 2025-12-26 | [Transaction Support](./2025-12-26-transaction-support) | Enhancement |
|
|
21
|
+
| 2025-12-26 | [Nested Relations & Generic Types](./2025-12-26-nested-relations-and-generics) | Enhancement |
|
|
20
22
|
| 2025-12-18 | [Performance Optimizations](./2025-12-18-performance-optimizations) | Enhancement |
|
|
21
23
|
| 2025-12-18 | [Repository Validation & Security](./2025-12-18-repository-validation-security) | Breaking Change, Security |
|
|
22
24
|
| 2025-12-17 | [Inversion of Control Refactor](./2025-12-17-refactor) | Refactor |
|