@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
|
@@ -210,7 +210,7 @@ export class EnvironmentKeys {
|
|
|
210
210
|
|
|
211
211
|
**Usage:**
|
|
212
212
|
```typescript
|
|
213
|
-
import { applicationEnvironment } from '@venizia/ignis';
|
|
213
|
+
import { applicationEnvironment } from '@venizia/ignis-helpers';
|
|
214
214
|
import { EnvironmentKeys } from '@/common/environments';
|
|
215
215
|
|
|
216
216
|
// Correct usage
|
|
@@ -123,7 +123,7 @@ Use the `getError` helper and `HTTP` constants to throw consistent, formatted ex
|
|
|
123
123
|
### Basic Error
|
|
124
124
|
|
|
125
125
|
```typescript
|
|
126
|
-
import { getError, HTTP } from '@venizia/ignis';
|
|
126
|
+
import { getError, HTTP } from '@venizia/ignis-helpers';
|
|
127
127
|
|
|
128
128
|
if (!record) {
|
|
129
129
|
throw getError({
|
|
@@ -125,7 +125,7 @@ async syncData() {
|
|
|
125
125
|
**With the helper utility:**
|
|
126
126
|
|
|
127
127
|
```typescript
|
|
128
|
-
import { executeWithPerformanceMeasure } from '@venizia/ignis';
|
|
128
|
+
import { executeWithPerformanceMeasure } from '@venizia/ignis-helpers';
|
|
129
129
|
|
|
130
130
|
await executeWithPerformanceMeasure({
|
|
131
131
|
logger: this.logger.for('syncData'),
|
|
@@ -66,7 +66,7 @@ export class Application extends BaseApplication {
|
|
|
66
66
|
|
|
67
67
|
- **Bad:**
|
|
68
68
|
```typescript
|
|
69
|
-
import { ApplicationError, getError } from '@venizia/ignis';
|
|
69
|
+
import { ApplicationError, getError } from '@venizia/ignis-helpers';
|
|
70
70
|
|
|
71
71
|
// In a Controller
|
|
72
72
|
async createUser(c: Context) {
|
|
@@ -375,7 +375,39 @@ export class User extends BaseEntity<typeof User.schema> {
|
|
|
375
375
|
|
|
376
376
|
> **Reference:** See [Hidden Properties](../references/base/models.md#hidden-properties) for complete documentation.
|
|
377
377
|
|
|
378
|
-
## 6.
|
|
378
|
+
## 6. Authorization Settings
|
|
379
|
+
|
|
380
|
+
Declare your model's authorization principal in `@model` settings to make the model the single source of truth for permission subjects:
|
|
381
|
+
|
|
382
|
+
```typescript
|
|
383
|
+
@model({
|
|
384
|
+
type: 'entity',
|
|
385
|
+
settings: {
|
|
386
|
+
authorize: { principal: 'user' },
|
|
387
|
+
hiddenProperties: ['password'],
|
|
388
|
+
},
|
|
389
|
+
})
|
|
390
|
+
export class User extends BaseEntity<typeof User.schema> {
|
|
391
|
+
static override schema = pgTable('User', {
|
|
392
|
+
...generateIdColumnDefs({ id: { dataType: 'string' } }),
|
|
393
|
+
email: text('email').notNull(),
|
|
394
|
+
password: text('password'),
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// User.AUTHORIZATION_SUBJECT === 'user' (auto-populated)
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
**Key points:**
|
|
402
|
+
|
|
403
|
+
- `AUTHORIZATION_SUBJECT` is auto-set from `authorize.principal` by the `@model` decorator
|
|
404
|
+
- Use `Model.AUTHORIZATION_SUBJECT` in route configs instead of hardcoded strings
|
|
405
|
+
- Explicit `static AUTHORIZATION_SUBJECT = '...'` on the class takes precedence
|
|
406
|
+
- The `authorize` settings are extensible via index signature for custom metadata
|
|
407
|
+
|
|
408
|
+
> **Reference:** See [Model-Based Resource References](../references/components/authorization/usage#model-based-resource-references) for full authorization integration.
|
|
409
|
+
|
|
410
|
+
## 7. Database Migrations
|
|
379
411
|
|
|
380
412
|
Drizzle Kit handles schema migrations. Follow these best practices for safe migrations.
|
|
381
413
|
|
|
@@ -16,7 +16,7 @@ Comprehensive guide to handling errors gracefully in Ignis applications.
|
|
|
16
16
|
Ignis provides `getError` for creating consistent, structured errors.
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
|
-
import { getError, HTTP } from '@venizia/ignis';
|
|
19
|
+
import { getError, HTTP } from '@venizia/ignis-helpers';
|
|
20
20
|
|
|
21
21
|
// Basic error
|
|
22
22
|
throw getError({
|
|
@@ -68,7 +68,8 @@ Database constraint violations (unique, foreign key, not null, check) are automa
|
|
|
68
68
|
### Service Layer Errors
|
|
69
69
|
|
|
70
70
|
```typescript
|
|
71
|
-
import { BaseService
|
|
71
|
+
import { BaseService } from '@venizia/ignis';
|
|
72
|
+
import { getError, HTTP } from '@venizia/ignis-helpers';
|
|
72
73
|
|
|
73
74
|
export class UserService extends BaseService {
|
|
74
75
|
async createUser(data: TCreateUserRequest): Promise<TUser> {
|
|
@@ -160,7 +161,8 @@ Database constraint violations (unique, foreign key, not null, check) are **auto
|
|
|
160
161
|
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:
|
|
161
162
|
|
|
162
163
|
```typescript
|
|
163
|
-
import { BaseRepository
|
|
164
|
+
import { BaseRepository } from '@venizia/ignis';
|
|
165
|
+
import { getError, HTTP } from '@venizia/ignis-helpers';
|
|
164
166
|
|
|
165
167
|
export class UserRepository extends BaseRepository<typeof User.schema> {
|
|
166
168
|
async createWithCustomError(data: TCreateUser): Promise<TCreateResult<TUser>> {
|
|
@@ -185,7 +187,8 @@ export class UserRepository extends BaseRepository<typeof User.schema> {
|
|
|
185
187
|
Ignis includes a built-in error handler. Customize behavior in your application:
|
|
186
188
|
|
|
187
189
|
```typescript
|
|
188
|
-
import { BaseApplication
|
|
190
|
+
import { BaseApplication } from '@venizia/ignis';
|
|
191
|
+
import { ApplicationError } from '@venizia/ignis-helpers';
|
|
189
192
|
|
|
190
193
|
export class Application extends BaseApplication {
|
|
191
194
|
override setupMiddlewares(): void {
|
|
@@ -7,7 +7,7 @@ Optimize your Ignis application for speed and scalability.
|
|
|
7
7
|
Identify bottlenecks before optimizing:
|
|
8
8
|
|
|
9
9
|
```typescript
|
|
10
|
-
import { executeWithPerformanceMeasure } from '@venizia/ignis';
|
|
10
|
+
import { executeWithPerformanceMeasure } from '@venizia/ignis-helpers';
|
|
11
11
|
|
|
12
12
|
await executeWithPerformanceMeasure({
|
|
13
13
|
logger: this.logger,
|
|
@@ -72,7 +72,8 @@ const SecureRoute = {
|
|
|
72
72
|
|
|
73
73
|
**Access user in protected routes:**
|
|
74
74
|
```typescript
|
|
75
|
-
import { Authentication, IJWTTokenPayload
|
|
75
|
+
import { Authentication, IJWTTokenPayload } from '@venizia/ignis';
|
|
76
|
+
import { ApplicationError, getError } from '@venizia/ignis-helpers';
|
|
76
77
|
|
|
77
78
|
const user = c.get(Authentication.CURRENT_USER) as IJWTTokenPayload;
|
|
78
79
|
if (!user.roles.includes('admin')) {
|
|
@@ -132,7 +133,7 @@ When handling file uploads, prevent **path traversal attacks** and ensure safe f
|
|
|
132
133
|
**Solution:** Use `sanitizeFilename()` to strip dangerous patterns:
|
|
133
134
|
|
|
134
135
|
```typescript
|
|
135
|
-
import { sanitizeFilename } from '@venizia/ignis';
|
|
136
|
+
import { sanitizeFilename } from '@venizia/ignis-helpers';
|
|
136
137
|
|
|
137
138
|
// ❌ DANGEROUS - User-controlled filename
|
|
138
139
|
const unsafeFilename = req.body.filename; // Could be "../../../etc/passwd"
|
|
@@ -154,7 +155,7 @@ fs.writeFileSync(`./uploads/${safeFilename}`, data);
|
|
|
154
155
|
Use `createContentDispositionHeader()` for secure download responses:
|
|
155
156
|
|
|
156
157
|
```typescript
|
|
157
|
-
import { createContentDispositionHeader, sanitizeFilename } from '@venizia/ignis';
|
|
158
|
+
import { createContentDispositionHeader, sanitizeFilename } from '@venizia/ignis-helpers';
|
|
158
159
|
|
|
159
160
|
async downloadFile(c: Context) {
|
|
160
161
|
const filename = sanitizeFilename(c.req.param('filename'));
|
|
@@ -177,7 +178,7 @@ async downloadFile(c: Context) {
|
|
|
177
178
|
Use `parseMultipartBody()` for safe file uploads with automatic sanitization:
|
|
178
179
|
|
|
179
180
|
```typescript
|
|
180
|
-
import { parseMultipartBody } from '@venizia/ignis';
|
|
181
|
+
import { parseMultipartBody } from '@venizia/ignis-helpers';
|
|
181
182
|
|
|
182
183
|
async uploadFile(c: Context) {
|
|
183
184
|
const files = await parseMultipartBody({
|
|
@@ -133,11 +133,11 @@ import {
|
|
|
133
133
|
controller,
|
|
134
134
|
post,
|
|
135
135
|
inject,
|
|
136
|
-
HTTP,
|
|
137
136
|
jsonContent,
|
|
138
137
|
jsonResponse,
|
|
139
138
|
TRouteContext,
|
|
140
139
|
} from '@venizia/ignis';
|
|
140
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
141
141
|
import { z } from '@hono/zod-openapi';
|
|
142
142
|
import { NotificationService } from '../services';
|
|
143
143
|
|
|
@@ -9,7 +9,8 @@ Controllers handle HTTP requests and return responses - they're your API endpoin
|
|
|
9
9
|
Extend `BaseController` and use decorators to define routes:
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
import { BaseController, controller, get, jsonResponse, z
|
|
12
|
+
import { BaseController, controller, get, jsonResponse, z } from '@venizia/ignis';
|
|
13
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
13
14
|
import { Context } from 'hono';
|
|
14
15
|
|
|
15
16
|
@controller({ path: '/users' })
|
|
@@ -70,7 +71,8 @@ The `opts` object contains a `configs` property that defines the route's path, r
|
|
|
70
71
|
For optimal organization and type safety, define your route configurations in a constant with `as const`. This allows TypeScript to precisely infer the types for your request data and expected responses within your handler methods.
|
|
71
72
|
|
|
72
73
|
```typescript
|
|
73
|
-
import { BaseController, controller, get, post,
|
|
74
|
+
import { BaseController, controller, get, post, jsonContent, jsonResponse, TRouteContext } from '@venizia/ignis';
|
|
75
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
74
76
|
import { z } from '@hono/zod-openapi';
|
|
75
77
|
|
|
76
78
|
// Define route configs as const for type inference
|
|
@@ -161,7 +163,8 @@ When using this method, you will override the `binding()` method in your control
|
|
|
161
163
|
Use this method for defining a single API endpoint with all its configurations and handler. It also benefits from type inference when used with `TRouteContext`.
|
|
162
164
|
|
|
163
165
|
```typescript
|
|
164
|
-
import { Authentication,
|
|
166
|
+
import { Authentication, jsonResponse, z, TRouteContext } from '@venizia/ignis';
|
|
167
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
165
168
|
|
|
166
169
|
// ... inside the binding() method
|
|
167
170
|
|
|
@@ -188,7 +191,8 @@ this.defineRoute({
|
|
|
188
191
|
This method offers a fluent API for defining routes, similar to `defineRoute`, but structured for chaining. It also benefits from `TRouteContext` for type safety.
|
|
189
192
|
|
|
190
193
|
```typescript
|
|
191
|
-
import { jsonResponse, z, TRouteContext
|
|
194
|
+
import { jsonResponse, z, TRouteContext } from '@venizia/ignis';
|
|
195
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
192
196
|
|
|
193
197
|
// ... inside the binding() method
|
|
194
198
|
|
|
@@ -309,7 +313,7 @@ this.defineJSXRoute({
|
|
|
309
313
|
|
|
310
314
|
```typescript
|
|
311
315
|
// src/views/pages/home.page.tsx
|
|
312
|
-
import type { FC } from '@venizia/ignis';
|
|
316
|
+
import type { FC } from '@venizia/ignis-helpers';
|
|
313
317
|
import { MainLayout } from '../layouts/main.layout';
|
|
314
318
|
|
|
315
319
|
interface HomePageProps {
|
|
@@ -330,7 +334,7 @@ export const HomePage: FC<HomePageProps> = ({ user }) => {
|
|
|
330
334
|
|
|
331
335
|
```typescript
|
|
332
336
|
// src/views/layouts/main.layout.tsx
|
|
333
|
-
import type { FC, PropsWithChildren } from '@venizia/ignis';
|
|
337
|
+
import type { FC, PropsWithChildren } from '@venizia/ignis-helpers';
|
|
334
338
|
|
|
335
339
|
interface MainLayoutProps {
|
|
336
340
|
title: string;
|
|
@@ -369,7 +373,8 @@ When you define Zod schemas in your route's `request` configuration (whether wit
|
|
|
369
373
|
|
|
370
374
|
```typescript
|
|
371
375
|
import { z } from '@hono/zod-openapi';
|
|
372
|
-
import { jsonContent, put
|
|
376
|
+
import { jsonContent, put } from '@venizia/ignis';
|
|
377
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
373
378
|
|
|
374
379
|
// ... inside a controller class
|
|
375
380
|
|
|
@@ -406,7 +411,8 @@ Using `c.req.valid()` is the recommended way to access request data as it ensure
|
|
|
406
411
|
|
|
407
412
|
```typescript
|
|
408
413
|
import { z } from '@hono/zod-openapi';
|
|
409
|
-
import { jsonContent, put, TRouteContext
|
|
414
|
+
import { jsonContent, put, TRouteContext } from '@venizia/ignis';
|
|
415
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
410
416
|
|
|
411
417
|
// ... inside a controller class
|
|
412
418
|
|
|
@@ -208,6 +208,38 @@ const [fullUser] = await connector
|
|
|
208
208
|
For complete hidden properties documentation, see the [Models Reference](../../../references/base/models.md#hidden-properties).
|
|
209
209
|
:::
|
|
210
210
|
|
|
211
|
+
## Authorization Settings
|
|
212
|
+
|
|
213
|
+
Declare your model's authorization principal directly in `@model` settings. The decorator auto-populates `AUTHORIZATION_SUBJECT` for type-safe references in route configs:
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import { BaseEntity, generateIdColumnDefs, model, AuthorizationActions } from '@venizia/ignis';
|
|
217
|
+
import { pgTable, text } from 'drizzle-orm/pg-core';
|
|
218
|
+
|
|
219
|
+
@model({
|
|
220
|
+
type: 'entity',
|
|
221
|
+
settings: {
|
|
222
|
+
authorize: { principal: 'article' },
|
|
223
|
+
},
|
|
224
|
+
})
|
|
225
|
+
export class Article extends BaseEntity<typeof Article.schema> {
|
|
226
|
+
static override schema = pgTable('Article', {
|
|
227
|
+
...generateIdColumnDefs({ id: { dataType: 'string' } }),
|
|
228
|
+
title: text('title').notNull(),
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Use in route configs — no hardcoded strings
|
|
233
|
+
authorize: {
|
|
234
|
+
action: AuthorizationActions.READ,
|
|
235
|
+
resource: Article.AUTHORIZATION_SUBJECT, // 'article'
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
:::tip
|
|
240
|
+
For full authorization integration details, see the [Authorization Usage Reference](../../../references/components/authorization/usage#model-based-resource-references).
|
|
241
|
+
:::
|
|
242
|
+
|
|
211
243
|
## Model Template
|
|
212
244
|
|
|
213
245
|
```typescript
|
|
@@ -18,7 +18,8 @@ Services contain the core business logic of your application. They orchestrate t
|
|
|
18
18
|
To create a service, you extend the `BaseService` class and inject the repositories or other services it depends on.
|
|
19
19
|
|
|
20
20
|
```typescript
|
|
21
|
-
import { BaseService, inject
|
|
21
|
+
import { BaseService, inject } from '@venizia/ignis';
|
|
22
|
+
import { getError } from '@venizia/ignis-helpers';
|
|
22
23
|
import { ConfigurationRepository } from '../repositories';
|
|
23
24
|
import { UserRepository } from '../repositories';
|
|
24
25
|
import { LoggingService } from './logging.service'; // Example of another service
|
|
@@ -84,11 +84,11 @@ import {
|
|
|
84
84
|
BaseController,
|
|
85
85
|
controller,
|
|
86
86
|
get,
|
|
87
|
-
HTTP,
|
|
88
87
|
IApplicationInfo,
|
|
89
88
|
jsonContent,
|
|
90
89
|
SwaggerComponent,
|
|
91
90
|
} from "@venizia/ignis";
|
|
91
|
+
import { HTTP } from "@venizia/ignis-helpers";
|
|
92
92
|
import { Context } from "hono";
|
|
93
93
|
import appInfo from "./../package.json";
|
|
94
94
|
|
|
@@ -18,7 +18,6 @@ Pick which AI assistant you're using:
|
|
|
18
18
|
| Tool | Best For |
|
|
19
19
|
| ------------------------------------- | ---------------------------------------- |
|
|
20
20
|
| [Claude Code](#claude-code-cli-setup) | Terminal users, developers (Recommended) |
|
|
21
|
-
| [Gemini CLI](#gemini-cli-setup) | Google AI users |
|
|
22
21
|
| [VS Code](#vs-code-setup) | VS Code with MCP extensions |
|
|
23
22
|
| [Cursor](#cursor-setup) | AI-first code editor |
|
|
24
23
|
| [Windsurf](#windsurf-setup) | Codeium's AI editor |
|
|
@@ -244,139 +243,6 @@ Once working, try these queries:
|
|
|
244
243
|
"Show me an example of dependency injection in Ignis"
|
|
245
244
|
```
|
|
246
245
|
|
|
247
|
-
## Gemini CLI Setup
|
|
248
|
-
|
|
249
|
-
> **Important:** As of December 2024, Google's official Gemini CLI has limited MCP support. This setup is **experimental** and may require custom configuration.
|
|
250
|
-
|
|
251
|
-
### Prerequisites
|
|
252
|
-
|
|
253
|
-
1. **Install Google AI CLI tools:**
|
|
254
|
-
|
|
255
|
-
```bash
|
|
256
|
-
# Option 1: Using pip (Python)
|
|
257
|
-
pip install google-generativeai
|
|
258
|
-
|
|
259
|
-
# Option 2: Using Node.js wrapper
|
|
260
|
-
npm install -g @google/generative-ai
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
2. **Get your API key:**
|
|
264
|
-
- Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
|
|
265
|
-
- Create a new API key
|
|
266
|
-
- Save it securely
|
|
267
|
-
|
|
268
|
-
### Setup Steps
|
|
269
|
-
|
|
270
|
-
#### 1. Configure environment
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
# Set your API key
|
|
274
|
-
export GOOGLE_API_KEY="your-api-key-here"
|
|
275
|
-
|
|
276
|
-
# Or add to your shell config (~/.bashrc, ~/.zshrc):
|
|
277
|
-
echo 'export GOOGLE_API_KEY="your-api-key-here"' >> ~/.bashrc
|
|
278
|
-
source ~/.bashrc
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
#### 2. Create MCP config directory
|
|
282
|
-
|
|
283
|
-
```bash
|
|
284
|
-
# Create config directory
|
|
285
|
-
mkdir -p ~/.config/gemini
|
|
286
|
-
|
|
287
|
-
# The config file location:
|
|
288
|
-
# macOS/Linux: ~/.config/gemini/mcp_servers.json
|
|
289
|
-
# Windows: %USERPROFILE%\.config\gemini\mcp_servers.json
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
#### 3. Add MCP Server Configuration
|
|
293
|
-
|
|
294
|
-
Create `~/.config/gemini/mcp_servers.json`:
|
|
295
|
-
|
|
296
|
-
**Recommended: Using npx**
|
|
297
|
-
|
|
298
|
-
```json
|
|
299
|
-
{
|
|
300
|
-
"mcpServers": {
|
|
301
|
-
"ignis-docs": {
|
|
302
|
-
"command": "npx",
|
|
303
|
-
"args": ["-y", "@venizia/ignis-docs"],
|
|
304
|
-
"env": {}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
**Alternative: Global install**
|
|
311
|
-
|
|
312
|
-
```bash
|
|
313
|
-
# First install globally
|
|
314
|
-
npm install -g @venizia/ignis-docs
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
Then configure:
|
|
318
|
-
|
|
319
|
-
```json
|
|
320
|
-
{
|
|
321
|
-
"mcpServers": {
|
|
322
|
-
"ignis-docs": {
|
|
323
|
-
"command": "ignis-docs-mcp",
|
|
324
|
-
"env": {}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
#### 4. Test manually first
|
|
331
|
-
|
|
332
|
-
Before integrating with Gemini, test the MCP server works:
|
|
333
|
-
|
|
334
|
-
```bash
|
|
335
|
-
# Test the MCP server can start
|
|
336
|
-
npx @venizia/ignis-docs
|
|
337
|
-
|
|
338
|
-
# Expected output:
|
|
339
|
-
# "MCP Server listening on stdio..."
|
|
340
|
-
# (Press Ctrl+C to stop)
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
#### 5. Use with Gemini (if supported)
|
|
344
|
-
|
|
345
|
-
**Note:** MCP support in Gemini CLI is limited. Alternative approaches:
|
|
346
|
-
|
|
347
|
-
**Option A: Use Google AI Python SDK with custom MCP wrapper**
|
|
348
|
-
|
|
349
|
-
```python
|
|
350
|
-
# This requires writing custom integration code
|
|
351
|
-
# See: https://github.com/modelcontextprotocol/python-sdk
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
**Option B: Use via Claude Code CLI instead**
|
|
355
|
-
|
|
356
|
-
- Gemini CLI MCP support is experimental
|
|
357
|
-
- Claude Code has better MCP support out of the box
|
|
358
|
-
- Recommendation: Use [Claude Code CLI setup](#claude-code-cli-setup) for Ignis docs
|
|
359
|
-
|
|
360
|
-
#### Troubleshooting
|
|
361
|
-
|
|
362
|
-
**"Command not found: gemini"**
|
|
363
|
-
|
|
364
|
-
- Google doesn't have an official "gemini" CLI command
|
|
365
|
-
- Use `gcloud ai` or Python SDK instead
|
|
366
|
-
- Consider using Claude Code CLI for better MCP support
|
|
367
|
-
|
|
368
|
-
**MCP server not loading**
|
|
369
|
-
|
|
370
|
-
- Gemini CLI MCP support is experimental
|
|
371
|
-
- Check if your Gemini CLI version supports MCP:
|
|
372
|
-
```bash
|
|
373
|
-
gemini --version
|
|
374
|
-
gemini mcp list # If this command doesn't exist, MCP isn't supported
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
**Recommended Alternative:**
|
|
378
|
-
Use Claude Code CLI (see setup above) - it has full MCP support and works reliably.
|
|
379
|
-
|
|
380
246
|
## VS Code Setup
|
|
381
247
|
|
|
382
248
|
VS Code supports MCP through various extensions. The setup process is similar to Microsoft's Playwright MCP integration.
|
|
@@ -647,7 +647,8 @@ For complex validation or business rules, create a Service layer:
|
|
|
647
647
|
|
|
648
648
|
```typescript
|
|
649
649
|
// src/services/todo.service.ts
|
|
650
|
-
import { BaseService, inject
|
|
650
|
+
import { BaseService, inject } from '@venizia/ignis';
|
|
651
|
+
import { getError } from '@venizia/ignis-helpers';
|
|
651
652
|
import { TodoRepository } from '@/repositories/todo.repository';
|
|
652
653
|
|
|
653
654
|
export class TodoService extends BaseService {
|
|
@@ -259,9 +259,9 @@ import {
|
|
|
259
259
|
BaseController,
|
|
260
260
|
controller,
|
|
261
261
|
api,
|
|
262
|
-
HTTP,
|
|
263
262
|
jsonContent,
|
|
264
263
|
} from '@venizia/ignis';
|
|
264
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
265
265
|
import { z } from '@hono/zod-openapi';
|
|
266
266
|
import { Context } from 'hono';
|
|
267
267
|
|
|
@@ -326,7 +326,7 @@ Create `src/index.ts` - this starts your application:
|
|
|
326
326
|
|
|
327
327
|
```typescript
|
|
328
328
|
import { Application, appConfigs } from './application';
|
|
329
|
-
import { LoggerFactory } from '@venizia/ignis';
|
|
329
|
+
import { LoggerFactory } from '@venizia/ignis-helpers';
|
|
330
330
|
|
|
331
331
|
const logger = LoggerFactory.getLogger(['main']);
|
|
332
332
|
|
|
@@ -922,10 +922,10 @@ import {
|
|
|
922
922
|
controller,
|
|
923
923
|
get,
|
|
924
924
|
inject,
|
|
925
|
-
HTTP,
|
|
926
925
|
jsonContent,
|
|
927
926
|
TRouteContext,
|
|
928
927
|
} from '@venizia/ignis';
|
|
928
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
929
929
|
import { ProductService } from '../services/product.service';
|
|
930
930
|
|
|
931
931
|
// Define route configs with PascalCase type and SCREAMING_SNAKE_CASE keys
|
|
@@ -1013,10 +1013,10 @@ import {
|
|
|
1013
1013
|
put,
|
|
1014
1014
|
del,
|
|
1015
1015
|
inject,
|
|
1016
|
-
HTTP,
|
|
1017
1016
|
jsonContent,
|
|
1018
1017
|
TRouteContext,
|
|
1019
1018
|
} from '@venizia/ignis';
|
|
1019
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
1020
1020
|
import { CartService } from '../services/cart.service';
|
|
1021
1021
|
|
|
1022
1022
|
const CartRoutes = {
|
|
@@ -1150,10 +1150,10 @@ import {
|
|
|
1150
1150
|
get,
|
|
1151
1151
|
post,
|
|
1152
1152
|
inject,
|
|
1153
|
-
HTTP,
|
|
1154
1153
|
jsonContent,
|
|
1155
1154
|
TRouteContext,
|
|
1156
1155
|
} from '@venizia/ignis';
|
|
1156
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
1157
1157
|
import { OrderService } from '../services/order.service';
|
|
1158
1158
|
|
|
1159
1159
|
const OrderRoutes = {
|
|
@@ -448,11 +448,10 @@ import {
|
|
|
448
448
|
CoreBindings,
|
|
449
449
|
inject,
|
|
450
450
|
SocketIOBindingKeys,
|
|
451
|
-
SocketIOServerHelper,
|
|
452
451
|
BindingKeys,
|
|
453
452
|
BindingNamespaces,
|
|
454
453
|
} from '@venizia/ignis';
|
|
455
|
-
import { ISocketIOClient, getError } from '@venizia/ignis-helpers';
|
|
454
|
+
import { ISocketIOClient, getError, SocketIOServerHelper } from '@venizia/ignis-helpers';
|
|
456
455
|
import { Socket } from 'socket.io';
|
|
457
456
|
import { MessageRepository } from '../repositories/message.repository';
|
|
458
457
|
import { RoomRepository } from '../repositories/room.repository';
|
|
@@ -938,19 +937,21 @@ The application binds Redis, authentication, and the client connected handler vi
|
|
|
938
937
|
```typescript
|
|
939
938
|
// src/application.ts
|
|
940
939
|
import {
|
|
941
|
-
applicationEnvironment,
|
|
942
940
|
BaseApplication,
|
|
943
941
|
BindingKeys,
|
|
944
942
|
BindingNamespaces,
|
|
945
943
|
IApplicationConfigs,
|
|
946
944
|
IApplicationInfo,
|
|
947
|
-
ISocketIOServerBaseOptions,
|
|
948
|
-
RedisHelper,
|
|
949
945
|
SocketIOBindingKeys,
|
|
950
946
|
SocketIOComponent,
|
|
951
|
-
SocketIOServerHelper,
|
|
952
947
|
ValueOrPromise,
|
|
953
948
|
} from '@venizia/ignis';
|
|
949
|
+
import {
|
|
950
|
+
applicationEnvironment,
|
|
951
|
+
type ISocketIOServerBaseOptions,
|
|
952
|
+
RedisHelper,
|
|
953
|
+
SocketIOServerHelper,
|
|
954
|
+
} from '@venizia/ignis-helpers';
|
|
954
955
|
import { ChatService } from './services/chat.service';
|
|
955
956
|
import { ChatController } from './controllers/chat.controller';
|
|
956
957
|
import { UserRepository } from './repositories/user.repository';
|
package/wiki/index.md
CHANGED
|
@@ -64,7 +64,8 @@ bun add -d typescript @types/bun
|
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
|
-
import { BaseApplication, BaseController, controller, get,
|
|
67
|
+
import { BaseApplication, BaseController, controller, get, jsonContent, SwaggerComponent } from '@venizia/ignis';
|
|
68
|
+
import { HTTP } from '@venizia/ignis-helpers';
|
|
68
69
|
import { z } from '@hono/zod-openapi';
|
|
69
70
|
|
|
70
71
|
// 1. Define your controller
|
|
@@ -306,7 +306,8 @@ export class HealthCheckComponent extends BaseComponent {
|
|
|
306
306
|
|
|
307
307
|
```typescript
|
|
308
308
|
// src/components/auth/authenticate/component.ts
|
|
309
|
-
import { BaseApplication, BaseComponent, inject, CoreBindings, Binding, ValueOrPromise
|
|
309
|
+
import { BaseApplication, BaseComponent, inject, CoreBindings, Binding, ValueOrPromise } from '@venizia/ignis';
|
|
310
|
+
import { getError } from '@venizia/ignis-helpers';
|
|
310
311
|
import { AuthenticateBindingKeys, IAuthenticateOptions, IBasicTokenServiceOptions, IJWTTokenServiceOptions } from './common';
|
|
311
312
|
import { BasicTokenService, JWTTokenService } from './services';
|
|
312
313
|
import { defineAuthController } from './controllers';
|