@venizia/ignis-docs 0.2.0 → 0.2.1-1
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 +14 -14
- package/content/best-practices/api-usage-examples.md +39 -19
- package/content/best-practices/architectural-patterns.md +24 -13
- package/content/best-practices/architecture-decisions.md +29 -16
- package/content/best-practices/code-style-standards/advanced-patterns.md +43 -31
- package/content/best-practices/code-style-standards/constants-configuration.md +19 -4
- package/content/best-practices/code-style-standards/control-flow.md +33 -1
- package/content/best-practices/code-style-standards/documentation.md +28 -8
- package/content/best-practices/code-style-standards/function-patterns.md +15 -4
- package/content/best-practices/code-style-standards/index.md +7 -2
- package/content/best-practices/code-style-standards/naming-conventions.md +27 -3
- package/content/best-practices/code-style-standards/route-definitions.md +9 -5
- package/content/best-practices/code-style-standards/tooling.md +14 -1
- package/content/best-practices/code-style-standards/type-safety.md +39 -6
- package/content/best-practices/common-pitfalls.md +59 -35
- package/content/best-practices/contribution-workflow.md +8 -4
- package/content/best-practices/data-modeling.md +78 -62
- package/content/best-practices/deployment-strategies.md +56 -19
- package/content/best-practices/error-handling.md +247 -153
- package/content/best-practices/index.md +6 -0
- package/content/best-practices/performance-optimization.md +26 -13
- package/content/best-practices/security-guidelines.md +35 -9
- package/content/best-practices/testing-strategies.md +7 -2
- package/content/best-practices/troubleshooting-tips.md +27 -17
- package/content/extensions/components/api-reference.md +109 -323
- package/content/extensions/components/authentication/api.md +489 -602
- package/content/extensions/components/authentication/errors.md +135 -498
- package/content/extensions/components/authentication/index.md +89 -801
- package/content/extensions/components/authentication/usage.md +231 -955
- package/content/extensions/components/authorization/api.md +991 -644
- package/content/extensions/components/authorization/errors.md +204 -208
- package/content/extensions/components/authorization/getting-started.md +227 -0
- package/content/extensions/components/authorization/index.md +88 -795
- package/content/extensions/components/authorization/usage.md +219 -528
- package/content/extensions/components/health-check.md +77 -243
- package/content/extensions/components/index.md +24 -90
- package/content/extensions/components/mail/api.md +553 -285
- package/content/extensions/components/mail/errors.md +76 -62
- package/content/extensions/components/mail/index.md +111 -463
- package/content/extensions/components/mail/usage.md +139 -173
- package/content/extensions/components/request-tracker.md +70 -173
- package/content/extensions/components/socket-io/api.md +462 -785
- package/content/extensions/components/socket-io/errors.md +49 -51
- package/content/extensions/components/socket-io/index.md +69 -372
- package/content/extensions/components/socket-io/usage.md +212 -105
- package/content/extensions/components/static-asset/api.md +461 -141
- package/content/extensions/components/static-asset/errors.md +121 -53
- package/content/extensions/components/static-asset/index.md +84 -606
- package/content/extensions/components/static-asset/usage.md +184 -299
- package/content/extensions/components/template/index.md +3 -3
- package/content/extensions/components/websocket/api.md +311 -404
- package/content/extensions/components/websocket/errors.md +47 -56
- package/content/extensions/components/websocket/index.md +75 -407
- package/content/extensions/components/websocket/usage.md +120 -338
- package/content/extensions/helpers/cron/index.md +52 -160
- package/content/extensions/helpers/crypto/index.md +67 -480
- package/content/extensions/helpers/crypto/reference.md +528 -0
- package/content/extensions/helpers/env/index.md +64 -178
- package/content/extensions/helpers/error/index.md +286 -196
- package/content/extensions/helpers/index.md +61 -47
- package/content/extensions/helpers/inversion/index.md +76 -550
- package/content/extensions/helpers/inversion/reference.md +530 -0
- package/content/extensions/helpers/kafka/admin.md +23 -3
- package/content/extensions/helpers/kafka/compile-binary.md +83 -52
- package/content/extensions/helpers/kafka/consumer.md +65 -28
- package/content/extensions/helpers/kafka/examples.md +46 -253
- package/content/extensions/helpers/kafka/index.md +55 -617
- package/content/extensions/helpers/kafka/producer.md +156 -22
- package/content/extensions/helpers/kafka/schema-registry.md +59 -79
- package/content/extensions/helpers/logger/hf-logger.md +220 -0
- package/content/extensions/helpers/logger/index.md +78 -552
- package/content/extensions/helpers/logger/pino.md +105 -0
- package/content/extensions/helpers/logger/reference.md +937 -0
- package/content/extensions/helpers/network/api.md +276 -195
- package/content/extensions/helpers/network/index.md +87 -524
- package/content/extensions/helpers/queue/index.md +80 -897
- package/content/extensions/helpers/queue/reference.md +494 -0
- package/content/extensions/helpers/redis/index.md +86 -640
- package/content/extensions/helpers/redis/reference.md +784 -0
- package/content/extensions/helpers/secrets/index.md +136 -0
- package/content/extensions/helpers/socket-io/api.md +325 -204
- package/content/extensions/helpers/socket-io/index.md +79 -429
- package/content/extensions/helpers/storage/api.md +584 -464
- package/content/extensions/helpers/storage/index.md +80 -573
- package/content/extensions/helpers/types/index.md +75 -495
- package/content/extensions/helpers/types/reference.md +689 -0
- package/content/extensions/helpers/uid/index.md +176 -189
- package/content/extensions/helpers/websocket/api.md +366 -214
- package/content/extensions/helpers/websocket/index.md +68 -503
- package/content/extensions/helpers/worker-thread/index.md +62 -396
- package/content/extensions/helpers/worker-thread/reference.md +428 -0
- package/content/extensions/index.md +38 -39
- package/content/extensions/src-details/mcp-server.md +96 -548
- package/content/guides/core-concepts/persistent/datasources.md +2 -2
- package/content/guides/core-concepts/persistent/index.md +5 -1
- package/content/guides/core-concepts/persistent/models.md +1 -1
- package/content/guides/core-concepts/persistent/pglite.md +218 -0
- package/content/guides/core-concepts/persistent/postgres-drivers.md +21 -15
- package/content/guides/core-concepts/persistent/search-meilisearch.md +22 -12
- package/content/guides/core-concepts/persistent/search-typesense.md +28 -16
- package/content/guides/core-concepts/persistent/sqlite.md +296 -0
- package/content/guides/core-concepts/persistent/transactions.md +12 -11
- package/content/guides/core-concepts/secrets-vault.md +177 -0
- package/content/guides/core-concepts/services.md +1 -1
- package/content/guides/get-started/5-minute-quickstart.md +59 -206
- package/content/guides/get-started/philosophy.md +135 -670
- package/content/guides/get-started/setup.md +53 -74
- package/content/guides/migrations/redis-helpers-migration.md +5 -4
- package/content/guides/migrations/scoped-rbac-migration.md +5 -5
- package/content/guides/migrations/unified-connectors-migration.md +8 -7
- package/content/guides/tutorials/ecommerce-api.md +3 -8
- package/content/guides/tutorials/realtime-chat.md +1 -1
- package/content/references/base/application.md +64 -22
- package/content/references/base/components.md +3 -3
- package/content/references/base/connectors.md +79 -136
- package/content/references/base/controllers.md +12 -12
- package/content/references/base/datasources-reference.md +600 -0
- package/content/references/base/datasources.md +84 -444
- package/content/references/base/dependency-injection.md +25 -46
- package/content/references/base/filter-system/application-usage.md +95 -123
- package/content/references/base/filter-system/array-operators.md +33 -43
- package/content/references/base/filter-system/comparison-operators.md +55 -63
- package/content/references/base/filter-system/default-filter.md +144 -350
- package/content/references/base/filter-system/fields-order-pagination.md +116 -148
- package/content/references/base/filter-system/index.md +114 -253
- package/content/references/base/filter-system/json-filtering.md +52 -181
- package/content/references/base/filter-system/list-operators.md +28 -44
- package/content/references/base/filter-system/logical-operators.md +69 -114
- package/content/references/base/filter-system/null-operators.md +41 -98
- package/content/references/base/filter-system/pattern-matching.md +48 -51
- package/content/references/base/filter-system/quick-reference.md +93 -196
- package/content/references/base/filter-system/range-operators.md +22 -38
- package/content/references/base/filter-system/tips.md +70 -133
- package/content/references/base/filter-system/use-cases.md +173 -232
- package/content/references/base/grpc-controllers.md +53 -17
- package/content/references/base/index.md +5 -3
- package/content/references/base/middlewares.md +43 -28
- package/content/references/base/models-reference.md +886 -0
- package/content/references/base/models.md +81 -1452
- package/content/references/base/providers.md +8 -8
- package/content/references/base/repositories/advanced.md +281 -419
- package/content/references/base/repositories/index.md +84 -644
- package/content/references/base/repositories/mixins.md +25 -21
- package/content/references/base/repositories/relations.md +194 -375
- package/content/references/base/repositories/soft-deletable.md +67 -55
- package/content/references/base/secrets.md +267 -0
- package/content/references/base/services.md +8 -6
- package/content/references/configuration/environment-variables.md +73 -21
- package/content/references/configuration/index.md +51 -31
- package/content/references/index.md +1 -1
- package/content/references/quick-reference.md +3 -16
- package/content/references/utilities/crypto.md +35 -76
- package/content/references/utilities/date.md +33 -73
- package/content/references/utilities/duration.md +85 -0
- package/content/references/utilities/index.md +6 -2
- package/content/references/utilities/jsx-reference.md +298 -0
- package/content/references/utilities/jsx.md +82 -525
- package/content/references/utilities/module.md +81 -61
- package/content/references/utilities/parse.md +34 -64
- package/content/references/utilities/performance.md +33 -58
- package/content/references/utilities/promise.md +28 -62
- package/content/references/utilities/request.md +58 -218
- package/content/references/utilities/retry.md +139 -0
- package/content/references/utilities/schema.md +43 -137
- package/content/references/utilities/statuses-reference.md +361 -0
- package/content/references/utilities/statuses.md +63 -667
- package/dist/mcp-server/index.js +0 -0
- package/dist/mcp-server/tools/github/list-project-files.tool.d.ts +1 -1
- 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 +3 -3
- package/dist/mcp-server/tools/github/search-code.tool.js +1 -1
- package/dist/mcp-server/tools/github/verify-dependencies.tool.js +1 -1
- package/dist/mcp-server/tools/github/view-source-file.tool.js +1 -1
- package/package.json +24 -23
|
@@ -1,59 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Set Up Your Development Environment
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Get your machine ready to build with IGNIS: a runtime, a database, and an editor. This guide
|
|
4
|
+
covers macOS, Linux, and Windows through WSL2.
|
|
4
5
|
|
|
5
6
|
## Requirements
|
|
6
7
|
|
|
7
|
-
| Tool | Version | Required |
|
|
8
|
-
|
|
9
|
-
| **Bun** | >= 1.3 | Yes |
|
|
10
|
-
| **
|
|
11
|
-
| **
|
|
12
|
-
| **VS Code** | Latest | Recommended | Best IDE experience with extensions |
|
|
8
|
+
| Tool | Version | Required | Why |
|
|
9
|
+
|------|---------|----------|-----|
|
|
10
|
+
| **Bun** | >= 1.3 | Yes | Installs packages and runs every build; IGNIS never uses npm, yarn, or pnpm |
|
|
11
|
+
| **PostgreSQL** | >= 14 | Yes | Primary database; the repository system assumes Drizzle + `pg` |
|
|
12
|
+
| **VS Code** | Latest | Optional | Best editor support, through ESLint and Prettier extensions |
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
> IGNIS apps can also run on Node.js 18+ in production, through `@hono/node-server`. That is a
|
|
15
|
+
> deployment choice, not a setup choice - Bun still installs packages and runs every command in
|
|
16
|
+
> this guide.
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
## Preconditions
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
curl -fsSL https://bun.sh/install | bash
|
|
21
|
-
|
|
22
|
-
# Windows (use WSL2)
|
|
23
|
-
# First install WSL2: wsl --install
|
|
24
|
-
# Then run the curl command above in WSL
|
|
20
|
+
- A terminal with permission to install packages (`sudo` on Linux, admin rights on Windows).
|
|
21
|
+
- On Windows, WSL2 installed (`wsl --install`). Run every command in this guide inside WSL2.
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
bun --version # Should be 1.3+
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Node.js (Alternative)
|
|
23
|
+
## Step 1: Install Bun
|
|
31
24
|
|
|
32
25
|
```bash
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
curl -fsSL https://bun.sh/install | bash
|
|
27
|
+
```
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
|
38
|
-
sudo apt-get install -y nodejs
|
|
29
|
+
On Windows, run this command inside WSL2.
|
|
39
30
|
|
|
40
|
-
|
|
41
|
-
# Download from https://nodejs.org/
|
|
31
|
+
Reload your shell, then confirm the version:
|
|
42
32
|
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
```bash
|
|
34
|
+
bun --version # >= 1.3
|
|
45
35
|
```
|
|
46
36
|
|
|
47
|
-
## Install PostgreSQL
|
|
37
|
+
## Step 2: Install PostgreSQL
|
|
38
|
+
|
|
39
|
+
Install and start the server for your OS.
|
|
48
40
|
|
|
49
|
-
|
|
41
|
+
macOS:
|
|
50
42
|
|
|
51
43
|
```bash
|
|
52
44
|
brew install postgresql@14
|
|
53
45
|
brew services start postgresql@14
|
|
54
46
|
```
|
|
55
47
|
|
|
56
|
-
|
|
48
|
+
Ubuntu/Debian:
|
|
57
49
|
|
|
58
50
|
```bash
|
|
59
51
|
sudo apt-get update
|
|
@@ -61,11 +53,11 @@ sudo apt-get install postgresql-14
|
|
|
61
53
|
sudo service postgresql start
|
|
62
54
|
```
|
|
63
55
|
|
|
64
|
-
|
|
56
|
+
Windows: download the installer from
|
|
57
|
+
[postgresql.org/download/windows](https://www.postgresql.org/download/windows/), or install
|
|
58
|
+
inside WSL2 with the Ubuntu/Debian commands above.
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
### Create Database
|
|
60
|
+
Then create a database for local development:
|
|
69
61
|
|
|
70
62
|
```bash
|
|
71
63
|
# macOS
|
|
@@ -73,29 +65,20 @@ psql postgres -c "CREATE DATABASE my_app_db;"
|
|
|
73
65
|
|
|
74
66
|
# Linux (Ubuntu/Debian)
|
|
75
67
|
sudo -u postgres psql -c "CREATE DATABASE my_app_db;"
|
|
76
|
-
|
|
77
|
-
# Verify
|
|
78
|
-
psql my_app_db -c "SELECT 1;" # Should return 1
|
|
79
68
|
```
|
|
80
69
|
|
|
81
|
-
##
|
|
70
|
+
## Step 3: Configure Your Editor (Optional)
|
|
82
71
|
|
|
83
|
-
|
|
72
|
+
Install the extensions that match IGNIS' ESLint and Prettier setup:
|
|
84
73
|
|
|
85
74
|
```bash
|
|
86
|
-
# Essential
|
|
87
75
|
code --install-extension dbaeumer.vscode-eslint
|
|
88
76
|
code --install-extension esbenp.prettier-vscode
|
|
89
|
-
|
|
90
|
-
# Recommended
|
|
91
77
|
code --install-extension usernamehw.errorlens
|
|
92
78
|
code --install-extension humao.rest-client
|
|
93
|
-
code --install-extension prisma.prisma # Works with Drizzle too
|
|
94
79
|
```
|
|
95
80
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Create `.vscode/settings.json`:
|
|
81
|
+
Create `.vscode/settings.json` in your project:
|
|
99
82
|
|
|
100
83
|
```json
|
|
101
84
|
{
|
|
@@ -107,51 +90,47 @@ Create `.vscode/settings.json`:
|
|
|
107
90
|
}
|
|
108
91
|
```
|
|
109
92
|
|
|
110
|
-
## Verify Setup
|
|
93
|
+
## Verify Your Setup
|
|
111
94
|
|
|
112
95
|
```bash
|
|
113
|
-
bun --version
|
|
114
|
-
psql
|
|
96
|
+
bun --version # >= 1.3
|
|
97
|
+
psql my_app_db -c "SELECT 1;" # returns 1
|
|
115
98
|
```
|
|
116
99
|
|
|
100
|
+
Both commands must succeed before you continue.
|
|
101
|
+
|
|
117
102
|
## Troubleshooting
|
|
118
103
|
|
|
119
|
-
### Bun not found after install
|
|
104
|
+
### Bun command not found after install
|
|
105
|
+
|
|
106
|
+
Add Bun to your shell profile, then reload it:
|
|
120
107
|
|
|
121
108
|
```bash
|
|
122
|
-
# Add to ~/.bashrc or ~/.zshrc
|
|
123
109
|
export BUN_INSTALL="$HOME/.bun"
|
|
124
110
|
export PATH="$BUN_INSTALL/bin:$PATH"
|
|
125
|
-
|
|
126
|
-
# Then reload
|
|
127
|
-
source ~/.bashrc # or ~/.zshrc
|
|
111
|
+
source ~/.bashrc # or ~/.zshrc
|
|
128
112
|
```
|
|
129
113
|
|
|
130
|
-
### PostgreSQL permission denied
|
|
114
|
+
### PostgreSQL: permission denied for database
|
|
115
|
+
|
|
116
|
+
Run the command as the `postgres` user:
|
|
131
117
|
|
|
132
118
|
```bash
|
|
133
|
-
# Linux: Use sudo -u postgres
|
|
134
119
|
sudo -u postgres psql -c "CREATE DATABASE my_app_db;"
|
|
135
|
-
|
|
136
|
-
# macOS: Check if PostgreSQL is running
|
|
137
|
-
brew services list | grep postgresql
|
|
138
120
|
```
|
|
139
121
|
|
|
140
|
-
### PostgreSQL connection refused
|
|
122
|
+
### PostgreSQL: connection refused
|
|
123
|
+
|
|
124
|
+
Check that the server is running, then start it:
|
|
141
125
|
|
|
142
126
|
```bash
|
|
143
|
-
# Check if running
|
|
144
127
|
pg_isready
|
|
145
128
|
|
|
146
|
-
#
|
|
147
|
-
#
|
|
148
|
-
brew services start postgresql@14
|
|
149
|
-
|
|
150
|
-
# Linux
|
|
151
|
-
sudo service postgresql start
|
|
129
|
+
brew services start postgresql@14 # macOS
|
|
130
|
+
sudo service postgresql start # Linux
|
|
152
131
|
```
|
|
153
132
|
|
|
154
|
-
##
|
|
133
|
+
## See Also
|
|
155
134
|
|
|
156
|
-
- [5-Minute Quickstart](./5-minute-quickstart.md) -
|
|
157
|
-
- [Complete Installation](../tutorials/complete-installation.md) -
|
|
135
|
+
- [5-Minute Quickstart](./5-minute-quickstart.md) - build your first API
|
|
136
|
+
- [Complete Installation](../tutorials/complete-installation.md) - full project setup
|
|
@@ -99,15 +99,16 @@ function useRedis(connection: IRedisHelper) { /* ... */ }
|
|
|
99
99
|
|
|
100
100
|
### instanceof checks and concrete bindings
|
|
101
101
|
|
|
102
|
-
Use the
|
|
102
|
+
Use the `isRedisHelper` brand check (you cannot `instanceof` an interface, and `instanceof` against
|
|
103
|
+
the base class answers `false` for a helper built by a second installed copy of the package):
|
|
103
104
|
|
|
104
105
|
```typescript
|
|
105
106
|
// Before
|
|
106
107
|
if (connection instanceof DefaultRedisHelper) { /* ... */ }
|
|
107
108
|
|
|
108
109
|
// After
|
|
109
|
-
import {
|
|
110
|
-
if (connection
|
|
110
|
+
import { isRedisHelper } from '@venizia/ignis-helpers';
|
|
111
|
+
if (isRedisHelper(connection)) { /* ... */ }
|
|
111
112
|
```
|
|
112
113
|
|
|
113
114
|
### Options type rename
|
|
@@ -155,7 +156,7 @@ If you wrapped `subscribe(...)` in a `try/catch` expecting it to throw, that bra
|
|
|
155
156
|
|
|
156
157
|
These are new and do not break anything:
|
|
157
158
|
|
|
158
|
-
- **`RedisSentinelHelper`** - Redis Sentinel topology with automatic failover. See the [Redis Helper reference](/extensions/helpers/redis/) (Sentinel section).
|
|
159
|
+
- **`RedisSentinelHelper`** - Redis Sentinel topology with automatic failover. See the [Redis Helper full reference](/extensions/helpers/redis/reference#construction-sentinel) (Sentinel section).
|
|
159
160
|
- **`createRedisHelper({ mode })`** - a factory that builds the right helper from `RedisModes.SINGLE | CLUSTER | SENTINEL`, so you can pick a topology from config.
|
|
160
161
|
- **`RedisModes`** and **`RedisSentinelRoles`** - const-classes for the enumerable mode/role strings, with matching `TRedisMode` / `TRedisSentinelRole` types.
|
|
161
162
|
- **Expanded data API** - key lifecycle and counters (`exists`, `expire`, `expireAt`, `ttl`, `persist`, `incr`, `decr`, `incrBy`, `decrBy`), hash completion (`hGet`, `hDel`, `hExists`, `hKeys`, `hVals`, `hIncrBy`, `hLen`), sets (`sAdd`, `sRem`, `sMembers`, `sIsMember`, `sCard`), and lists (`lPush`, `rPush`, `lPop`, `rPop`, `lRange`, `lLen`).
|
|
@@ -47,18 +47,18 @@ Both are described below with exact before/after.
|
|
|
47
47
|
|
|
48
48
|
When you bump ignis, these stop compiling/working:
|
|
49
49
|
|
|
50
|
-
1. **`packages/core/src/security/application-casbin-adapter.ts`**
|
|
50
|
+
1. **`packages/core-server/src/security/application-casbin-adapter.ts`**
|
|
51
51
|
- `extends DrizzleCasbinAdapter` → class removed.
|
|
52
52
|
- `import { DrizzleCasbinAdapter, IDrizzleCasbinAdapterOptions, ICasbinPolicyFilter } from '@venizia/ignis'` → first two removed; `ICasbinPolicyFilter` still exists but its **shape changed**.
|
|
53
53
|
- `filter.principalValue` / `filter.principalType` → now `filter.principal.id` / `filter.principal.type`.
|
|
54
54
|
- `CasbinRuleVariants.GROUP` / `CasbinRuleVariants.POLICY` → removed.
|
|
55
55
|
- `this.entities.role.principalType` / `this.entities.permission.principalType` → `entities` no longer provided by the base.
|
|
56
56
|
|
|
57
|
-
2. **`packages/core/src/repositories/public/policy-definition.repository.ts`**
|
|
57
|
+
2. **`packages/core-server/src/repositories/public/policy-definition.repository.ts`**
|
|
58
58
|
- Many `eq(pd.variant, CasbinRuleVariants.GROUP)` / `.POLICY` → constant removed. This file is the
|
|
59
59
|
biggest single breakage surface outside the adapter.
|
|
60
60
|
|
|
61
|
-
3. **`packages/core/src/application/verifier.ts`** (enforcer registration)
|
|
61
|
+
3. **`packages/core-server/src/application/verifier.ts`** (enforcer registration)
|
|
62
62
|
- The Redis-absent fallback uses `CasbinEnforcerCachedDrivers.IN_MEMORY` → removed. You must pick
|
|
63
63
|
Redis or `{ use: false }`.
|
|
64
64
|
|
|
@@ -78,7 +78,7 @@ your `group`/`policy` variant values, and all bespoke logic (global roles, HQ-ow
|
|
|
78
78
|
Own these strings locally so you are decoupled from ignis's casbin-prefix enum:
|
|
79
79
|
|
|
80
80
|
```ts
|
|
81
|
-
// packages/core/src/security/policy-variant.ts
|
|
81
|
+
// packages/core-server/src/security/policy-variant.ts
|
|
82
82
|
export class PolicyDefinitionVariant {
|
|
83
83
|
/** user→role assignment + user→merchant membership rows. */
|
|
84
84
|
static readonly GROUP = 'group';
|
|
@@ -292,7 +292,7 @@ the bespoke adapter and gain resource/action/domain hierarchies for free.
|
|
|
292
292
|
|
|
293
293
|
## 7. Reference - current nx-seller wiring (before)
|
|
294
294
|
|
|
295
|
-
For context, the current registration (`packages/core/src/application/verifier.ts`) uses:
|
|
295
|
+
For context, the current registration (`packages/core-server/src/application/verifier.ts`) uses:
|
|
296
296
|
`ApplicationCasbinAdapter` (subclass of removed `DrizzleCasbinAdapter`), `CASBIN_RBAC_MODEL` (flat
|
|
297
297
|
`g + p`, exact `r.obj == p.obj`), a Redis-or-in-memory `cached`, `domainMatching { roleDefinition: 'g',
|
|
298
298
|
fn: keyMatch }`, and a `normalizePayloadFn` mapping subject/domain via
|
|
@@ -7,7 +7,7 @@ description: What changed in @venizia/ignis 0.0.11-0 / @venizia/ignis-helpers 0.
|
|
|
7
7
|
|
|
8
8
|
**Target audience:** the BANA (nx-seller) team, and any application upgrading from `@venizia/ignis@0.0.10-x` / `@venizia/ignis-helpers@0.0.9-x`.
|
|
9
9
|
|
|
10
|
-
**Verification status:** every step below was validated against a full copy of BANA's `packages/core` source compiled against the release tarballs
|
|
10
|
+
**Verification status:** every step below was validated against a full copy of BANA's `packages/core-server` source compiled against the release tarballs. The migration ends at **zero compile errors**. The search branch was additionally validated end to end against a live 3-node Typesense cluster.
|
|
11
11
|
|
|
12
12
|
## What changed (summary)
|
|
13
13
|
|
|
@@ -15,8 +15,9 @@ IGNIS core was restructured around ONE engine-neutral repository family:
|
|
|
15
15
|
|
|
16
16
|
- `src/base` now holds a single `AbstractRepository` / `AbstractDataSource` / `AbstractEntity` family. Every engine implements it under `src/connectors/{postgres,typesense}`.
|
|
17
17
|
- Postgres remains re-exported from the root barrel - **your imports keep working unchanged**. Every connector is also addressable explicitly: `@venizia/ignis/postgres`, `@venizia/ignis/typesense` (typesense is subpath-only; its client is an optional peer).
|
|
18
|
-
- Canonical class names are the paradigm-family names (`BaseRelationalDataSource`, `BaseRelationalEntity`, `DefaultRelationalRepository`, ...)
|
|
19
|
-
-
|
|
18
|
+
- Canonical class names are the paradigm-family names (`BaseRelationalDataSource`, `BaseRelationalEntity`, `DefaultRelationalRepository`, ...). The engine name appears only at the concrete datasource (`TypesenseDataSource`) and the query dialect (`PostgresQueryOperators`).
|
|
19
|
+
- The historical names (`BaseDataSource`, `BaseEntity`, `BasePostgresDataSource`, `BasePostgresEntity`, `RDBQueryOperators`, `DefaultCRUDRepository`, ...) all keep resolving from the same import paths. Most are alias re-exports of the SAME classes; the five repository names (`PostgresBaseRepository`, `ReadableRepository`, `PersistableRepository`, `DefaultCRUDRepository`, `SoftDeletableRepository`) are Postgres subclasses of the neutral chain, so they are distinct class objects from their neutral parents. `instanceof`, metadata, and bindings are unaffected. No action required.
|
|
20
|
+
- New capabilities model: `dataSource.getCapabilities()` and a standardized NotSupported error (HTTP 501, `normalized.code` `core.not_supported`) for engine gaps (e.g. transactions on search engines).
|
|
20
21
|
- New engine: the **Typesense search branch** (`BaseSearchEntity`, `defineSearchCollection`, typed `TSearchDocument`, `DefaultSearchRepository`). It does not affect existing postgres code.
|
|
21
22
|
|
|
22
23
|
## Required migrations (in order)
|
|
@@ -38,7 +39,7 @@ grep -rl 'ITransaction\|IExtraOptions' packages/*/src --include='*.ts' \
|
|
|
38
39
|
| xargs sed -i 's/\bITransaction\b/IDatabaseTransaction/g; s/\bIExtraOptions\b/IDatabaseExtraOptions/g'
|
|
39
40
|
```
|
|
40
41
|
|
|
41
|
-
Note: `options?.transaction?.connector` inside `DefaultCRUDRepository` (alias of `DefaultRelationalRepository`) subclasses needs NO change
|
|
42
|
+
Note: `options?.transaction?.connector` inside `DefaultCRUDRepository` (alias of `DefaultRelationalRepository`) subclasses needs NO change. The postgres tiers now default their options generic to `IDatabaseExtraOptions`, so that path stays typed automatically.
|
|
42
43
|
|
|
43
44
|
### 2. `applicationEnvironment.get` - options object
|
|
44
45
|
|
|
@@ -68,7 +69,7 @@ New helpers: `toDelimitedArray(input, separator?)` (split + trim + drop empties)
|
|
|
68
69
|
|
|
69
70
|
### 3. Purge stale TypeScript build info
|
|
70
71
|
|
|
71
|
-
The package's `exports` map changed
|
|
72
|
+
The package's `exports` map changed. Stale incremental caches replay phantom diagnostics for unchanged files - a page of bogus "missing property" errors while new files compile clean:
|
|
72
73
|
|
|
73
74
|
```bash
|
|
74
75
|
find . -name '*.tsbuildinfo' -not -path '*/node_modules/*' -delete
|
|
@@ -78,7 +79,7 @@ Run this once after the version bump, before trusting the first `tsc` run.
|
|
|
78
79
|
|
|
79
80
|
### 4. Auth endpoint error contract (only if you assert on it)
|
|
80
81
|
|
|
81
|
-
The three auth endpoints backed by unimplemented service methods (`refreshToken`, `getUserInformation`) now return the standardized NotSupported error: HTTP 501 with
|
|
82
|
+
The three auth endpoints backed by unimplemented service methods (`refreshToken`, `getUserInformation`) now return the standardized NotSupported error: HTTP 501 with `normalized.code` `core.not_supported` and message `[AuthController] <feature> is not supported.`. Previously this was a plain `Method not implemented`. BANA was scanned: no code asserts on the old string - listed for completeness.
|
|
82
83
|
|
|
83
84
|
## Strongly recommended (not compile-blocking)
|
|
84
85
|
|
|
@@ -109,5 +110,5 @@ All IGNIS examples now declare these explicitly.
|
|
|
109
110
|
|
|
110
111
|
- No import-path changes: root-barrel imports of `BaseDataSource`, `BaseEntity`, `DefaultCRUDRepository`, decorators, etc. all keep working (dual-door export model + compatibility aliases).
|
|
111
112
|
- No repository/generic signature changes: `DefaultCRUDRepository<Schema, DataObject, PersistObject, ...>` call sites are unchanged (a 4th options generic was APPENDED with a default).
|
|
112
|
-
- No runtime behavior changes on the postgres path: the whole pre-existing RDB behavior suite runs unchanged inside the release gates
|
|
113
|
+
- No runtime behavior changes on the postgres path: the whole pre-existing RDB behavior suite runs unchanged inside the release gates. Every behavior delta was verified to have no trigger inside BANA (`@model` tableName divergence: 0 occurrences; message-string assertions: 0).
|
|
113
114
|
- Nothing search-related: BANA imports zero search symbols today.
|
|
@@ -526,12 +526,11 @@ export class OrderRepository extends DefaultCRUDRepository<typeof Order.schema>
|
|
|
526
526
|
|
|
527
527
|
```typescript
|
|
528
528
|
// src/services/product.service.ts
|
|
529
|
-
import {
|
|
529
|
+
import { inject } from '@venizia/ignis';
|
|
530
530
|
import { BaseService } from '@venizia/ignis';
|
|
531
531
|
import { ProductRepository } from '../repositories/product.repository';
|
|
532
532
|
import { getError } from '@venizia/ignis-helpers';
|
|
533
533
|
|
|
534
|
-
@injectable({})
|
|
535
534
|
export class ProductService extends BaseService {
|
|
536
535
|
constructor(
|
|
537
536
|
@inject({ key: 'repositories.ProductRepository' })
|
|
@@ -595,7 +594,7 @@ export class ProductService extends BaseService {
|
|
|
595
594
|
|
|
596
595
|
```typescript
|
|
597
596
|
// src/services/cart.service.ts
|
|
598
|
-
import {
|
|
597
|
+
import { inject } from '@venizia/ignis';
|
|
599
598
|
import { BaseService } from '@venizia/ignis';
|
|
600
599
|
import { CartRepository } from '../repositories/cart.repository';
|
|
601
600
|
import { ProductService } from './product.service';
|
|
@@ -606,7 +605,6 @@ interface ICartItem {
|
|
|
606
605
|
quantity: number;
|
|
607
606
|
}
|
|
608
607
|
|
|
609
|
-
@injectable({})
|
|
610
608
|
export class CartService extends BaseService {
|
|
611
609
|
constructor(
|
|
612
610
|
@inject({ key: 'repositories.CartRepository' })
|
|
@@ -733,7 +731,7 @@ export class CartService extends BaseService {
|
|
|
733
731
|
|
|
734
732
|
```typescript
|
|
735
733
|
// src/services/order.service.ts
|
|
736
|
-
import {
|
|
734
|
+
import { inject } from '@venizia/ignis';
|
|
737
735
|
import { BaseService } from '@venizia/ignis';
|
|
738
736
|
import { OrderRepository } from '../repositories/order.repository';
|
|
739
737
|
import { CartService } from './cart.service';
|
|
@@ -758,7 +756,6 @@ interface ICreateOrderInput {
|
|
|
758
756
|
billingAddress?: IOrderAddress;
|
|
759
757
|
}
|
|
760
758
|
|
|
761
|
-
@injectable({})
|
|
762
759
|
export class OrderService extends BaseService {
|
|
763
760
|
constructor(
|
|
764
761
|
@inject({ key: 'repositories.OrderRepository' })
|
|
@@ -906,12 +903,10 @@ export class OrderService extends BaseService {
|
|
|
906
903
|
|
|
907
904
|
```typescript
|
|
908
905
|
// src/services/payment.service.ts
|
|
909
|
-
import { injectable } from '@venizia/ignis';
|
|
910
906
|
import { BaseService } from '@venizia/ignis';
|
|
911
907
|
import Stripe from 'stripe';
|
|
912
908
|
import { applicationEnvironment } from '@venizia/ignis-helpers';
|
|
913
909
|
|
|
914
|
-
@injectable({})
|
|
915
910
|
export class PaymentService extends BaseService {
|
|
916
911
|
private _stripe: Stripe;
|
|
917
912
|
|
|
@@ -973,7 +973,7 @@ export class ChatService extends BaseService {
|
|
|
973
973
|
```
|
|
974
974
|
|
|
975
975
|
> [!IMPORTANT]
|
|
976
|
-
> **Lazy getter pattern**: `SocketIOServerHelper` is bound via a post-start hook, so it's not available during DI construction. The `private get socketIOHelper()` getter resolves it lazily on first access. See [
|
|
976
|
+
> **Lazy getter pattern**: `SocketIOServerHelper` is bound via a post-start hook, so it's not available during DI construction. The `private get socketIOHelper()` getter resolves it lazily on first access. See [Send a message from a service](/extensions/components/socket-io/#send-a-message-from-a-service) for details.
|
|
977
977
|
|
|
978
978
|
## 6. Application Setup
|
|
979
979
|
|
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Application Reference
|
|
3
|
-
description: Technical reference for AbstractApplication and BaseApplication
|
|
3
|
+
description: Technical reference for the four application layers - AbstractApplication, RestApplication, ServerApplication and BaseApplication
|
|
4
4
|
difficulty: beginner
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Deep Dive: Application
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Extend `BaseApplication`. The three classes above it exist so a host that cannot open a socket - a browser Worker, a test harness - can still serve the same controllers.
|
|
10
10
|
|
|
11
11
|
**Files:**
|
|
12
|
-
- `packages/
|
|
13
|
-
- `packages/
|
|
14
|
-
- `packages/core/src/base/applications/
|
|
12
|
+
- `packages/kernel/src/base/applications/abstract.ts`
|
|
13
|
+
- `packages/kernel/src/base/applications/rest.ts`
|
|
14
|
+
- `packages/core-server/src/base/applications/server.ts`
|
|
15
|
+
- `packages/core-server/src/base/applications/base.ts`
|
|
16
|
+
- `packages/kernel/src/base/applications/types.ts`
|
|
15
17
|
|
|
16
18
|
## Quick Reference
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
|
21
|
-
|
|
20
|
+
Each layer adds one capability. The first two ship from `@venizia/ignis-kernel` and touch no node builtin; the last two ship from `@venizia/ignis`.
|
|
21
|
+
|
|
22
|
+
| Class | Adds | Key Methods |
|
|
23
|
+
|-------|------|-------------|
|
|
24
|
+
| **AbstractApplication** | config, lifecycle hooks, the DI container | `init()`, `registerPostStartHook()`, `registerPostStopHook()` |
|
|
25
|
+
| **RestApplication** | the two `OpenAPIHono` routers | `getServer()`, `getRootRouter()`, `inspectRoutes()` |
|
|
26
|
+
| **ServerApplication** | the socket | `start()`, `stop()`, `getServerHost()`, `getServerPort()`, `getServerAddress()` |
|
|
27
|
+
| **BaseApplication** | resource registration, secrets, boot | `component()`, `controller()`, `service()`, `repository()`, `dataSource()`, `boot()`, `validateEnvs()` |
|
|
28
|
+
|
|
29
|
+
> [!NOTE]
|
|
30
|
+
> Every symbol still resolves from `@venizia/ignis` - `packages/core-server` re-exports the kernel wholesale. The split changed no import path.
|
|
22
31
|
|
|
23
32
|
## `AbstractApplication`
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
Config, lifecycle and the container. No router, no server. Extends `Container`.
|
|
26
35
|
|
|
27
36
|
```typescript
|
|
28
|
-
abstract class AbstractApplication
|
|
29
|
-
AppEnv extends Env = Env,
|
|
30
|
-
AppSchema extends Schema = {},
|
|
31
|
-
BasePath extends string = '/',
|
|
32
|
-
> extends Container implements IApplication<AppEnv, AppSchema, BasePath>
|
|
37
|
+
abstract class AbstractApplication extends Container
|
|
33
38
|
```
|
|
34
39
|
|
|
35
40
|
### Constructor
|
|
@@ -39,10 +44,47 @@ constructor(opts: { scope: string; config: IApplicationConfigs })
|
|
|
39
44
|
```
|
|
40
45
|
|
|
41
46
|
The constructor:
|
|
42
|
-
1. Merges the provided config with defaults
|
|
43
|
-
2.
|
|
44
|
-
3. Sets `
|
|
45
|
-
|
|
47
|
+
1. Merges the provided config with defaults, taking host and port from `getEnvServerHost()` / `getEnvServerPort()` and falling back to `localhost:3000`
|
|
48
|
+
2. Resolves `asyncContext.enable` from `getDefaultAsyncContextEnabled()`
|
|
49
|
+
3. Sets `projectRoot` from `getProjectRoot()`
|
|
50
|
+
|
|
51
|
+
Port `0` survives that merge on purpose - it asks the operating system for an ephemeral port.
|
|
52
|
+
|
|
53
|
+
The constructor binds nothing. `registerCoreBindings()` runs from `init()`, and `init()` is not called for you - see [Lifecycle](#lifecycle) below.
|
|
54
|
+
|
|
55
|
+
### The four constructor hooks
|
|
56
|
+
|
|
57
|
+
`getEnvServerHost()`, `getEnvServerPort()`, `getDefaultAsyncContextEnabled()` and `getProjectRoot()` return `undefined`, `undefined`, `false` and `''` here. `ServerApplication` overrides all four to restore server behaviour - `process.env.HOST`, `process.env.PORT`, `true`, and `process.cwd()`. The kernel layers read no `process`, because a browser Worker has none.
|
|
58
|
+
|
|
59
|
+
> [!WARNING]
|
|
60
|
+
> All four run inside this constructor, before any subclass field is assigned. An override must return a literal or read module-level state only. Reading `this.something` from one yields `undefined`, silently. `getProjectRoot()` is the one applications most often override - keep it free of instance state.
|
|
61
|
+
|
|
62
|
+
## `RestApplication`
|
|
63
|
+
|
|
64
|
+
Adds the routers, and nothing that opens a socket.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
abstract class RestApplication<
|
|
68
|
+
AppEnv extends Env = Env,
|
|
69
|
+
AppSchema extends Schema = {},
|
|
70
|
+
BasePath extends string = '/',
|
|
71
|
+
> extends AbstractApplication
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
It builds the two `OpenAPIHono` instances - the main server and the `rootRouter` - and binds them as `APPLICATION_SERVER` and `APPLICATION_ROOT_ROUTER`.
|
|
75
|
+
|
|
76
|
+
## `ServerApplication`
|
|
77
|
+
|
|
78
|
+
Adds `start()`, `stop()` and the runtime detection that picks `Bun.serve` or `@hono/node-server`.
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
abstract class ServerApplication<
|
|
82
|
+
AppEnv extends Env = Env,
|
|
83
|
+
AppSchema extends Schema = {},
|
|
84
|
+
BasePath extends string = '/',
|
|
85
|
+
> extends RestApplication<AppEnv, AppSchema, BasePath>
|
|
86
|
+
implements IApplication<AppEnv, AppSchema, BasePath>
|
|
87
|
+
```
|
|
46
88
|
5. Auto-detects the runtime (Bun or Node.js)
|
|
47
89
|
|
|
48
90
|
### Key Features
|
|
@@ -120,11 +162,11 @@ protected server:
|
|
|
120
162
|
|
|
121
163
|
## `BaseApplication`
|
|
122
164
|
|
|
123
|
-
Extends `
|
|
165
|
+
Extends `ServerApplication` with concrete lifecycle implementations, resource registration, secrets hydration and boot support. Implements `IRestApplication` and `IBootableApplication`. This is the class your application extends.
|
|
124
166
|
|
|
125
167
|
```typescript
|
|
126
168
|
abstract class BaseApplication
|
|
127
|
-
extends
|
|
169
|
+
extends ServerApplication
|
|
128
170
|
implements IRestApplication, IBootableApplication
|
|
129
171
|
```
|
|
130
172
|
|
|
@@ -266,7 +308,7 @@ graph TD
|
|
|
266
308
|
|
|
267
309
|
Automatically registers these default middlewares during `initialize()`:
|
|
268
310
|
|
|
269
|
-
1. **Error handler** (`
|
|
311
|
+
1. **Error handler** (`AppErrorMiddleware`) - with optional `rootKey` from `configs.error.rootKey`
|
|
270
312
|
2. **Async context storage** (`contextStorage`) - enabled by default via `configs.asyncContext.enable`
|
|
271
313
|
3. **Not-found handler** (`notFoundHandler`)
|
|
272
314
|
4. **RequestTrackerComponent** - assigns `x-request-id` to every request, includes request body parsing
|
|
@@ -8,7 +8,7 @@ difficulty: advanced
|
|
|
8
8
|
|
|
9
9
|
Technical reference for `BaseComponent`-the foundation for creating reusable, pluggable features in IGNIS. Components are powerful containers that can group together multiple providers, services, controllers, repositories, and even entire mini-applications into a single, redistributable module.
|
|
10
10
|
|
|
11
|
-
**File:** `packages/core/src/base/components/base.ts`
|
|
11
|
+
**File:** `packages/core-server/src/base/components/base.ts`
|
|
12
12
|
|
|
13
13
|
## Quick Reference
|
|
14
14
|
|
|
@@ -379,7 +379,7 @@ If gRPC controllers are discovered but the `'grpc'` transport is not in the `tra
|
|
|
379
379
|
|
|
380
380
|
### `RestComponent`
|
|
381
381
|
|
|
382
|
-
**File:** `packages/core/src/components/controller/rest/rest.component.ts`
|
|
382
|
+
**File:** `packages/core-server/src/components/controller/rest/rest.component.ts`
|
|
383
383
|
|
|
384
384
|
Discovers all controller bindings tagged with `BindingNamespaces.CONTROLLER`, skips any whose metadata has `transport === ControllerTransports.GRPC`, and configures the rest as REST controllers.
|
|
385
385
|
|
|
@@ -422,7 +422,7 @@ export class RestBindingKeys {
|
|
|
422
422
|
|
|
423
423
|
### `GrpcComponent`
|
|
424
424
|
|
|
425
|
-
**File:** `packages/core/src/components/controller/grpc/grpc.component.ts`
|
|
425
|
+
**File:** `packages/core-server/src/components/controller/grpc/grpc.component.ts`
|
|
426
426
|
|
|
427
427
|
Discovers all controller bindings tagged with `BindingNamespaces.CONTROLLER`, skips any whose metadata does **not** have `transport === ControllerTransports.GRPC`, and configures gRPC controllers.
|
|
428
428
|
|