@venizia/ignis-docs 0.0.8-1 → 0.0.8-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 +13 -13
- package/wiki/best-practices/error-handling.md +19 -4
- package/wiki/extensions/components/authorization/api.md +239 -376
- package/wiki/extensions/components/authorization/errors.md +52 -43
- package/wiki/extensions/components/authorization/index.md +127 -65
- package/wiki/extensions/components/authorization/usage.md +198 -98
- package/wiki/guides/migrations/scoped-rbac-migration.md +300 -0
- package/wiki/references/base/filter-system/default-filter.md +6 -3
- package/wiki/references/base/filter-system/fields-order-pagination.md +26 -0
- package/wiki/references/base/middlewares.md +36 -27
- package/wiki/references/base/models.md +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-docs",
|
|
3
|
-
"version": "0.0.8-
|
|
3
|
+
"version": "0.0.8-3",
|
|
4
4
|
"description": "Interactive documentation site and MCP (Model Context Protocol) server for the Ignis Framework. Includes a VitePress-powered documentation site with guides, API references, and best practices. Ships an MCP server (CLI: ignis-docs-mcp) with 11 tools for AI assistants to search docs, browse source code, verify dependencies, and access real-time framework knowledge. Built with Mastra MCP SDK and Fuse.js fuzzy search.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -115,28 +115,28 @@
|
|
|
115
115
|
"prepublishOnly": "bun run mcp:rebuild"
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@mastra/core": "^1.
|
|
119
|
-
"@mastra/mcp": "^1.
|
|
120
|
-
"cytoscape": "^3.33.
|
|
118
|
+
"@mastra/core": "^1.36.0",
|
|
119
|
+
"@mastra/mcp": "^1.8.0",
|
|
120
|
+
"cytoscape": "^3.33.4",
|
|
121
121
|
"cytoscape-cose-bilkent": "^4.1.0",
|
|
122
122
|
"dayjs": "^1.11.20",
|
|
123
123
|
"debug": "^4.4.3",
|
|
124
124
|
"fast-glob": "^3.3.3",
|
|
125
|
-
"fuse.js": "^7.
|
|
125
|
+
"fuse.js": "^7.3.0",
|
|
126
126
|
"gray-matter": "^4.0.3",
|
|
127
127
|
"zod": "^4.3.6"
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
130
|
"@braintree/sanitize-url": "^7.1.2",
|
|
131
|
-
"@types/bun": "^1.3.
|
|
132
|
-
"@venizia/dev-configs": "^0.0.7-
|
|
133
|
-
"eslint": "^10.
|
|
134
|
-
"prettier": "^3.8.
|
|
135
|
-
"tsc-alias": "^1.8.
|
|
136
|
-
"tsx": "^4.
|
|
137
|
-
"typescript": "^6.0.
|
|
131
|
+
"@types/bun": "^1.3.14",
|
|
132
|
+
"@venizia/dev-configs": "^0.0.7-3",
|
|
133
|
+
"eslint": "^10.4.0",
|
|
134
|
+
"prettier": "^3.8.3",
|
|
135
|
+
"tsc-alias": "^1.8.17",
|
|
136
|
+
"tsx": "^4.22.3",
|
|
137
|
+
"typescript": "^6.0.3",
|
|
138
138
|
"vitepress": "^1.6.4",
|
|
139
139
|
"vitepress-plugin-mermaid": "^2.0.17",
|
|
140
|
-
"vue": "^3.5.
|
|
140
|
+
"vue": "^3.5.34"
|
|
141
141
|
}
|
|
142
142
|
}
|
|
@@ -60,7 +60,7 @@ Use the correct status code for each error type:
|
|
|
60
60
|
| 503 | `RS_5.ServiceUnavailable` | Service temporarily down |
|
|
61
61
|
|
|
62
62
|
:::tip Automatic Database Error Handling
|
|
63
|
-
Database constraint
|
|
63
|
+
Database errors in SQLSTATE class `22` (data exception) and `23` (integrity constraint — unique, foreign key, not null, check, exclusion) are automatically converted to HTTP 400 by the global error middleware. You don't need to catch these manually. Other classes (e.g. syntax / undefined column) stay 500, and production responses are sanitized — see [Repository Layer Errors](#repository-layer-errors).
|
|
64
64
|
:::
|
|
65
65
|
|
|
66
66
|
## 3. Error Handling Patterns
|
|
@@ -148,7 +148,9 @@ export class UserController extends BaseRestController {
|
|
|
148
148
|
|
|
149
149
|
### Repository Layer Errors
|
|
150
150
|
|
|
151
|
-
Database constraint
|
|
151
|
+
Database errors in SQLSTATE class `22` (data exception) and `23` (integrity constraint — unique, foreign key, not null, check, exclusion) are **automatically handled** by the global error middleware and return HTTP 400. Codes outside those classes (e.g. class `42` undefined column — an application/SQL bug) correctly stay 500.
|
|
152
|
+
|
|
153
|
+
**Non-production** returns the full driver context for debugging:
|
|
152
154
|
|
|
153
155
|
```json
|
|
154
156
|
{
|
|
@@ -158,6 +160,14 @@ Database constraint violations (unique, foreign key, not null, check) are **auto
|
|
|
158
160
|
}
|
|
159
161
|
```
|
|
160
162
|
|
|
163
|
+
:::warning Production sanitizes database internals
|
|
164
|
+
In production the message is the **base message only** — `Detail:` (which echoes row values like emails), `Table:`, and `Constraint:` are stripped, and `details.stack`/`details.cause` are omitted. Unexpected (non-client) database errors and connection failures return a generic `"Internal Server Error"`, so SQL, schema names, and connection host/port never leak. Use `requestId` + server logs to diagnose.
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{ "message": "Unique constraint violation", "statusCode": 400, "requestId": "abc123" }
|
|
168
|
+
```
|
|
169
|
+
:::
|
|
170
|
+
|
|
161
171
|
You don't need to wrap repository calls in try-catch for constraint errors. If you need custom error messages, you can still handle them explicitly:
|
|
162
172
|
|
|
163
173
|
```typescript
|
|
@@ -240,7 +250,9 @@ All errors should follow a consistent format:
|
|
|
240
250
|
interface ErrorResponse {
|
|
241
251
|
statusCode: number;
|
|
242
252
|
message: string;
|
|
253
|
+
messageCode?: string; // stable, localizable code (validation: from params.code or the raw Zod code)
|
|
243
254
|
requestId: string;
|
|
255
|
+
extra?: Record<string, unknown>; // structured context attached via getError(...)
|
|
244
256
|
details?: {
|
|
245
257
|
cause?: Array<{
|
|
246
258
|
path: string;
|
|
@@ -271,16 +283,19 @@ interface ErrorResponse {
|
|
|
271
283
|
}
|
|
272
284
|
|
|
273
285
|
// 422 Validation Error
|
|
286
|
+
// `message`/`messageCode` come from the first failing issue — its `params.code` if the schema set
|
|
287
|
+
// one, otherwise the raw Zod code (e.g. `invalid_type`, `too_small`). The full list stays in `details.cause`.
|
|
274
288
|
{
|
|
275
289
|
"statusCode": 422,
|
|
276
|
-
"message": "
|
|
290
|
+
"message": "Invalid email format",
|
|
291
|
+
"messageCode": "user.email.invalid",
|
|
277
292
|
"requestId": "abc123",
|
|
278
293
|
"details": {
|
|
279
294
|
"cause": [
|
|
280
295
|
{
|
|
281
296
|
"path": "email",
|
|
282
297
|
"message": "Invalid email format",
|
|
283
|
-
"code": "
|
|
298
|
+
"code": "custom"
|
|
284
299
|
}
|
|
285
300
|
]
|
|
286
301
|
}
|