@venizia/ignis-docs 0.0.6-2 → 0.0.7-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/README.md +125 -388
- package/dist/mcp-server/common/config.d.ts +0 -21
- package/dist/mcp-server/common/config.d.ts.map +1 -1
- package/dist/mcp-server/common/config.js +1 -36
- package/dist/mcp-server/common/config.js.map +1 -1
- package/dist/mcp-server/helpers/docs.helper.d.ts +0 -24
- package/dist/mcp-server/helpers/docs.helper.d.ts.map +1 -1
- package/dist/mcp-server/helpers/docs.helper.js +0 -25
- package/dist/mcp-server/helpers/docs.helper.js.map +1 -1
- package/dist/mcp-server/helpers/github.helper.d.ts +0 -13
- package/dist/mcp-server/helpers/github.helper.d.ts.map +1 -1
- package/dist/mcp-server/helpers/github.helper.js +3 -20
- package/dist/mcp-server/helpers/github.helper.js.map +1 -1
- package/dist/mcp-server/index.js +1 -20
- package/dist/mcp-server/index.js.map +1 -1
- package/dist/mcp-server/tools/base.tool.d.ts +4 -85
- package/dist/mcp-server/tools/base.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/base.tool.js +1 -38
- package/dist/mcp-server/tools/base.tool.js.map +1 -1
- package/dist/mcp-server/tools/docs/get-document-content.tool.d.ts +8 -2
- package/dist/mcp-server/tools/docs/get-document-content.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/docs/get-document-content.tool.js +1 -10
- package/dist/mcp-server/tools/docs/get-document-content.tool.js.map +1 -1
- package/dist/mcp-server/tools/docs/get-document-metadata.tool.d.ts +13 -2
- package/dist/mcp-server/tools/docs/get-document-metadata.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/docs/get-document-metadata.tool.js +1 -10
- package/dist/mcp-server/tools/docs/get-document-metadata.tool.js.map +1 -1
- package/dist/mcp-server/tools/docs/get-package-overview.tool.d.ts +16 -8
- package/dist/mcp-server/tools/docs/get-package-overview.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/docs/get-package-overview.tool.js +2 -25
- package/dist/mcp-server/tools/docs/get-package-overview.tool.js.map +1 -1
- package/dist/mcp-server/tools/docs/list-categories.tool.d.ts +5 -2
- package/dist/mcp-server/tools/docs/list-categories.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/docs/list-categories.tool.js +1 -10
- package/dist/mcp-server/tools/docs/list-categories.tool.js.map +1 -1
- package/dist/mcp-server/tools/docs/list-documents.tool.d.ts +11 -2
- package/dist/mcp-server/tools/docs/list-documents.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/docs/list-documents.tool.js +1 -10
- package/dist/mcp-server/tools/docs/list-documents.tool.js.map +1 -1
- package/dist/mcp-server/tools/docs/search-documents.tool.d.ts +13 -2
- package/dist/mcp-server/tools/docs/search-documents.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/docs/search-documents.tool.js +1 -10
- package/dist/mcp-server/tools/docs/search-documents.tool.js.map +1 -1
- package/dist/mcp-server/tools/github/list-project-files.tool.d.ts +9 -2
- package/dist/mcp-server/tools/github/list-project-files.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/github/list-project-files.tool.js +1 -10
- package/dist/mcp-server/tools/github/list-project-files.tool.js.map +1 -1
- package/dist/mcp-server/tools/github/search-code.tool.d.ts +16 -2
- package/dist/mcp-server/tools/github/search-code.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/github/search-code.tool.js +2 -14
- package/dist/mcp-server/tools/github/search-code.tool.js.map +1 -1
- package/dist/mcp-server/tools/github/verify-dependencies.tool.d.ts +19 -6
- package/dist/mcp-server/tools/github/verify-dependencies.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/github/verify-dependencies.tool.js +2 -19
- package/dist/mcp-server/tools/github/verify-dependencies.tool.js.map +1 -1
- package/dist/mcp-server/tools/github/view-source-file.tool.d.ts +8 -2
- package/dist/mcp-server/tools/github/view-source-file.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/github/view-source-file.tool.js +1 -10
- package/dist/mcp-server/tools/github/view-source-file.tool.js.map +1 -1
- package/dist/mcp-server/tools/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/index.js +0 -2
- package/dist/mcp-server/tools/index.js.map +1 -1
- package/package.json +68 -54
- package/wiki/best-practices/api-usage-examples.md +7 -5
- package/wiki/best-practices/code-style-standards/advanced-patterns.md +1 -1
- package/wiki/best-practices/code-style-standards/constants-configuration.md +1 -1
- package/wiki/best-practices/code-style-standards/control-flow.md +1 -1
- package/wiki/best-practices/code-style-standards/function-patterns.md +1 -1
- package/wiki/best-practices/common-pitfalls.md +1 -1
- package/wiki/best-practices/data-modeling.md +33 -1
- package/wiki/best-practices/error-handling.md +7 -4
- package/wiki/best-practices/performance-optimization.md +1 -1
- package/wiki/best-practices/security-guidelines.md +5 -4
- package/wiki/guides/core-concepts/components-guide.md +1 -1
- package/wiki/guides/core-concepts/controllers.md +14 -8
- package/wiki/guides/core-concepts/persistent/models.md +32 -0
- package/wiki/guides/core-concepts/services.md +2 -1
- package/wiki/guides/get-started/5-minute-quickstart.md +1 -1
- package/wiki/guides/reference/mcp-docs-server.md +0 -134
- package/wiki/guides/tutorials/building-a-crud-api.md +2 -1
- package/wiki/guides/tutorials/complete-installation.md +2 -2
- package/wiki/guides/tutorials/ecommerce-api.md +3 -3
- package/wiki/guides/tutorials/realtime-chat.md +7 -6
- package/wiki/index.md +2 -1
- package/wiki/references/base/components.md +2 -1
- package/wiki/references/base/controllers.md +19 -12
- package/wiki/references/base/middlewares.md +2 -1
- package/wiki/references/base/models.md +11 -2
- package/wiki/references/base/services.md +2 -1
- package/wiki/references/components/authentication/api.md +525 -205
- package/wiki/references/components/authentication/errors.md +502 -105
- package/wiki/references/components/authentication/index.md +388 -75
- package/wiki/references/components/authentication/usage.md +428 -266
- package/wiki/references/components/authorization/api.md +1213 -0
- package/wiki/references/components/authorization/errors.md +387 -0
- package/wiki/references/components/authorization/index.md +712 -0
- package/wiki/references/components/authorization/usage.md +758 -0
- package/wiki/references/components/health-check.md +2 -1
- package/wiki/references/components/index.md +2 -0
- package/wiki/references/components/socket-io/index.md +9 -4
- package/wiki/references/components/socket-io/usage.md +1 -1
- package/wiki/references/components/static-asset/index.md +3 -5
- package/wiki/references/components/swagger.md +2 -1
- package/wiki/references/configuration/environment-variables.md +2 -1
- package/wiki/references/configuration/index.md +2 -1
- package/wiki/references/helpers/error/index.md +1 -1
- package/wiki/references/helpers/index.md +1 -0
- package/wiki/references/helpers/inversion/index.md +1 -1
- package/wiki/references/helpers/kafka/index.md +305 -0
- package/wiki/references/helpers/redis/index.md +2 -9
- package/wiki/references/quick-reference.md +3 -5
- package/wiki/references/utilities/crypto.md +2 -2
- package/wiki/references/utilities/date.md +5 -5
- package/wiki/references/utilities/index.md +3 -11
- package/wiki/references/utilities/jsx.md +4 -2
- package/wiki/references/utilities/module.md +1 -1
- package/wiki/references/utilities/parse.md +4 -4
- package/wiki/references/utilities/performance.md +2 -2
- package/wiki/references/utilities/promise.md +4 -4
- package/wiki/references/utilities/request.md +2 -2
|
@@ -58,7 +58,8 @@ For decorator-based routes, you do not need to explicitly annotate the return ty
|
|
|
58
58
|
The generic `@api` decorator allows you to define a route with a full configuration object. The decorated method will automatically have its `context` parameter and return type inferred and type-checked against the provided route configuration. This ensures strong type safety throughout your API definitions.
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
|
-
import { api, BaseController, controller,
|
|
61
|
+
import { api, BaseController, controller, jsonContent, jsonResponse, z, TRouteContext } from '@venizia/ignis';
|
|
62
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
62
63
|
|
|
63
64
|
const MyRouteConfig = {
|
|
64
65
|
method: 'get',
|
|
@@ -89,7 +90,8 @@ For convenience, `Ignis` provides decorator shortcuts for each HTTP method: Thes
|
|
|
89
90
|
**Example using `@get` and `@post`:**
|
|
90
91
|
|
|
91
92
|
```typescript
|
|
92
|
-
import { get, post, z, jsonContent, jsonResponse, Authentication, TRouteContext
|
|
93
|
+
import { get, post, z, jsonContent, jsonResponse, Authentication, TRouteContext } from '@venizia/ignis';
|
|
94
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
93
95
|
|
|
94
96
|
// Define route configs as const
|
|
95
97
|
const UserRoutes = {
|
|
@@ -153,7 +155,8 @@ const UserRoutes = {
|
|
|
153
155
|
For better organization, you can define all your route configurations in a constant and reference them in your decorators. This approach also allows you to get a typed context for your handler.
|
|
154
156
|
|
|
155
157
|
```typescript
|
|
156
|
-
import { api, BaseController, controller, TRouteContext, jsonContent, jsonResponse
|
|
158
|
+
import { api, BaseController, controller, TRouteContext, jsonContent, jsonResponse } from '@venizia/ignis';
|
|
159
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
157
160
|
import { z } from 'hono/zod-openapi';
|
|
158
161
|
|
|
159
162
|
const RouteConfigs = {
|
|
@@ -264,7 +267,8 @@ request: {
|
|
|
264
267
|
The `defineRouteConfigs` function is a simple helper for creating a typed object containing multiple route configurations. This is particularly useful for organizing all of a controller's route definitions in a single, type-checked constant.
|
|
265
268
|
|
|
266
269
|
```typescript
|
|
267
|
-
import { defineRouteConfigs,
|
|
270
|
+
import { defineRouteConfigs, jsonResponse, jsonContent, z } from '@venizia/ignis';
|
|
271
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
268
272
|
|
|
269
273
|
const RouteConfigs = defineRouteConfigs({
|
|
270
274
|
ROOT: {
|
|
@@ -377,12 +381,14 @@ When resolving authentication for a route, the following priority applies:
|
|
|
377
381
|
### Authentication Examples
|
|
378
382
|
|
|
379
383
|
```typescript
|
|
384
|
+
import { Authentication, ControllerFactory } from '@venizia/ignis';
|
|
385
|
+
|
|
380
386
|
// 1. JWT auth on ALL routes
|
|
381
387
|
const UserController = ControllerFactory.defineCrudController({
|
|
382
388
|
entity: UserEntity,
|
|
383
389
|
repository: { name: 'UserRepository' },
|
|
384
390
|
controller: { name: 'UserController', basePath: '/users' },
|
|
385
|
-
authStrategies: [
|
|
391
|
+
authStrategies: [Authentication.STRATEGY_JWT],
|
|
386
392
|
});
|
|
387
393
|
|
|
388
394
|
// 2. JWT auth on all, but skip for public read endpoints
|
|
@@ -390,7 +396,7 @@ const ProductController = ControllerFactory.defineCrudController({
|
|
|
390
396
|
entity: ProductEntity,
|
|
391
397
|
repository: { name: 'ProductRepository' },
|
|
392
398
|
controller: { name: 'ProductController', basePath: '/products' },
|
|
393
|
-
authStrategies: [
|
|
399
|
+
authStrategies: [Authentication.STRATEGY_JWT],
|
|
394
400
|
routes: {
|
|
395
401
|
find: { skipAuth: true },
|
|
396
402
|
findById: { skipAuth: true },
|
|
@@ -404,9 +410,9 @@ const ArticleController = ControllerFactory.defineCrudController({
|
|
|
404
410
|
repository: { name: 'ArticleRepository' },
|
|
405
411
|
controller: { name: 'ArticleController', basePath: '/articles' },
|
|
406
412
|
routes: {
|
|
407
|
-
create: { authStrategies: [
|
|
408
|
-
updateById: { authStrategies: [
|
|
409
|
-
deleteById: { authStrategies: [
|
|
413
|
+
create: { authStrategies: [Authentication.STRATEGY_JWT] },
|
|
414
|
+
updateById: { authStrategies: [Authentication.STRATEGY_JWT] },
|
|
415
|
+
deleteById: { authStrategies: [Authentication.STRATEGY_JWT] },
|
|
410
416
|
},
|
|
411
417
|
});
|
|
412
418
|
|
|
@@ -415,7 +421,7 @@ const OrderController = ControllerFactory.defineCrudController({
|
|
|
415
421
|
entity: OrderEntity,
|
|
416
422
|
repository: { name: 'OrderRepository' },
|
|
417
423
|
controller: { name: 'OrderController', basePath: '/orders' },
|
|
418
|
-
authStrategies: [
|
|
424
|
+
authStrategies: [Authentication.STRATEGY_JWT],
|
|
419
425
|
routes: {
|
|
420
426
|
find: {
|
|
421
427
|
skipAuth: true,
|
|
@@ -432,6 +438,7 @@ const OrderController = ControllerFactory.defineCrudController({
|
|
|
432
438
|
### Route Customization Examples
|
|
433
439
|
|
|
434
440
|
```typescript
|
|
441
|
+
import { Authentication, ControllerFactory } from '@venizia/ignis';
|
|
435
442
|
import { z } from '@hono/zod-openapi';
|
|
436
443
|
|
|
437
444
|
// Custom request body for create
|
|
@@ -453,7 +460,7 @@ const UserController = ControllerFactory.defineCrudController({
|
|
|
453
460
|
entity: UserEntity,
|
|
454
461
|
repository: { name: 'UserRepository' },
|
|
455
462
|
controller: { name: 'UserController', basePath: '/users' },
|
|
456
|
-
authStrategies: [
|
|
463
|
+
authStrategies: [Authentication.STRATEGY_JWT],
|
|
457
464
|
routes: {
|
|
458
465
|
// Public read endpoints
|
|
459
466
|
find: {
|
|
@@ -473,7 +480,7 @@ const UserController = ControllerFactory.defineCrudController({
|
|
|
473
480
|
|
|
474
481
|
// Delete requires JWT auth (uses default schema)
|
|
475
482
|
deleteById: {
|
|
476
|
-
authStrategies: [
|
|
483
|
+
authStrategies: [Authentication.STRATEGY_JWT],
|
|
477
484
|
},
|
|
478
485
|
},
|
|
479
486
|
});
|
|
@@ -294,7 +294,8 @@ app.use(requestSpy.value());
|
|
|
294
294
|
#### Accessing Request ID
|
|
295
295
|
|
|
296
296
|
```typescript
|
|
297
|
-
import { RequestSpyMiddleware, get,
|
|
297
|
+
import { RequestSpyMiddleware, get, jsonResponse, TRouteContext, z } from '@venizia/ignis';
|
|
298
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
298
299
|
|
|
299
300
|
const ExampleConfig = {
|
|
300
301
|
method: HTTP.Methods.GET,
|
|
@@ -32,7 +32,7 @@ Fundamental building block wrapping a Drizzle ORM schema.
|
|
|
32
32
|
| **Schema Encapsulation** | Holds Drizzle `pgTable` schema for consistent repository access |
|
|
33
33
|
| **Metadata** | Works with `@model` decorator to mark database entities |
|
|
34
34
|
| **Schema Generation** | Uses `drizzle-zod` to generate Zod schemas (`SELECT`, `CREATE`, `UPDATE`) |
|
|
35
|
-
| **Static Properties** | Supports static `schema`, `relations`, and `
|
|
35
|
+
| **Static Properties** | Supports static `schema`, `relations`, `TABLE_NAME`, and `AUTHORIZATION_SUBJECT` |
|
|
36
36
|
| **Convenience** | Includes `toObject()` and `toJSON()` methods |
|
|
37
37
|
|
|
38
38
|
### The `@model` Decorator
|
|
@@ -49,6 +49,10 @@ The `@model` decorator marks a class as a database entity and configures its beh
|
|
|
49
49
|
settings?: {
|
|
50
50
|
hiddenProperties?: string[], // Properties to exclude from query results
|
|
51
51
|
defaultFilter?: TFilter, // Filter applied to all repository queries
|
|
52
|
+
authorize?: { // Authorization settings
|
|
53
|
+
principal: string, // Authorization subject name
|
|
54
|
+
[extra: string | symbol]: any, // Extensible metadata
|
|
55
|
+
},
|
|
52
56
|
}
|
|
53
57
|
})
|
|
54
58
|
```
|
|
@@ -60,6 +64,8 @@ The `@model` decorator marks a class as a database entity and configures its beh
|
|
|
60
64
|
| `skipMigrate` | `boolean` | Skip this model during schema migrations |
|
|
61
65
|
| `settings.hiddenProperties` | `string[]` | Array of property names to exclude from all repository query results |
|
|
62
66
|
| `settings.defaultFilter` | `TFilter` | Filter automatically applied to all repository queries (see [Default Filter](/references/base/filter-system/default-filter)) |
|
|
67
|
+
| `settings.authorize` | `IModelAuthorizeSettings` | Authorization settings — declares the model's authorization principal (see [Authorization](/references/components/authorization/usage#model-based-resource-references)) |
|
|
68
|
+
| `settings.authorize.principal` | `string` | The authorization subject name for this model. Auto-populates `AUTHORIZATION_SUBJECT` static property |
|
|
63
69
|
|
|
64
70
|
### Hidden Properties
|
|
65
71
|
|
|
@@ -233,6 +239,7 @@ export class User extends BaseEntity<typeof userTable> {
|
|
|
233
239
|
| `schema` | `TTableSchemaWithId` | Drizzle table schema defined with `pgTable()` |
|
|
234
240
|
| `relations` | `TValueOrResolver<Array<TRelationConfig>>` | Relation definitions (can be a function for lazy loading) |
|
|
235
241
|
| `TABLE_NAME` | `string \| undefined` | Optional table name (defaults to class name if not set) |
|
|
242
|
+
| `AUTHORIZATION_SUBJECT` | `string \| undefined` | Authorization principal name. Auto-populated from `@model` settings `authorize.principal` |
|
|
236
243
|
|
|
237
244
|
### IEntity Interface
|
|
238
245
|
|
|
@@ -269,6 +276,7 @@ export class BaseEntity<Schema extends TTableSchemaWithId = TTableSchemaWithId>
|
|
|
269
276
|
static schema: TTableSchemaWithId;
|
|
270
277
|
static relations?: TValueOrResolver<Array<TRelationConfig>>;
|
|
271
278
|
static TABLE_NAME?: string; // Optional, defaults to class name
|
|
279
|
+
static AUTHORIZATION_SUBJECT?: string; // Auto-set by @model decorator from authorize.principal
|
|
272
280
|
|
|
273
281
|
// Static singleton for schemaFactory - shared across all instances
|
|
274
282
|
// Performance optimization: avoids creating new factory per entity
|
|
@@ -902,7 +910,8 @@ console.log(result);
|
|
|
902
910
|
**Use case:** API endpoint that accepts snake_case but works with camelCase internally
|
|
903
911
|
|
|
904
912
|
```typescript
|
|
905
|
-
import { BaseController, controller, snakeToCamel
|
|
913
|
+
import { BaseController, controller, snakeToCamel } from '@venizia/ignis';
|
|
914
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
906
915
|
import { z } from '@hono/zod-openapi';
|
|
907
916
|
|
|
908
917
|
const createUserSchema = snakeToCamel({
|
|
@@ -64,7 +64,8 @@ Services are the core of your application's logic. They act as a bridge between
|
|
|
64
64
|
### Example
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
|
-
import { BaseService, inject
|
|
67
|
+
import { BaseService, inject } from '@venizia/ignis';
|
|
68
|
+
import { getError } from '@venizia/ignis-helpers';
|
|
68
69
|
import { UserRepository } from '../repositories/user.repository';
|
|
69
70
|
import { TUser } from '../models/entities';
|
|
70
71
|
|