@venizia/ignis-docs 0.0.5 → 0.0.6-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/package.json +1 -1
- package/wiki/best-practices/architectural-patterns.md +0 -2
- package/wiki/best-practices/architecture-decisions.md +0 -8
- package/wiki/best-practices/code-style-standards/control-flow.md +1 -1
- package/wiki/best-practices/code-style-standards/index.md +0 -1
- package/wiki/best-practices/code-style-standards/tooling.md +0 -3
- package/wiki/best-practices/contribution-workflow.md +12 -12
- package/wiki/best-practices/index.md +4 -14
- package/wiki/best-practices/performance-optimization.md +3 -3
- package/wiki/best-practices/security-guidelines.md +2 -2
- package/wiki/best-practices/troubleshooting-tips.md +1 -1
- package/wiki/guides/core-concepts/application/bootstrapping.md +6 -7
- package/wiki/guides/core-concepts/components-guide.md +1 -1
- package/wiki/guides/core-concepts/components.md +2 -2
- package/wiki/guides/core-concepts/dependency-injection.md +4 -5
- package/wiki/guides/core-concepts/persistent/datasources.md +4 -5
- package/wiki/guides/core-concepts/services.md +1 -1
- package/wiki/guides/get-started/5-minute-quickstart.md +4 -5
- package/wiki/guides/get-started/philosophy.md +12 -24
- package/wiki/guides/index.md +2 -9
- package/wiki/guides/reference/mcp-docs-server.md +13 -13
- package/wiki/guides/tutorials/building-a-crud-api.md +10 -10
- package/wiki/guides/tutorials/complete-installation.md +11 -12
- package/wiki/guides/tutorials/ecommerce-api.md +3 -3
- package/wiki/guides/tutorials/realtime-chat.md +6 -6
- package/wiki/guides/tutorials/testing.md +4 -5
- package/wiki/index.md +8 -14
- package/wiki/references/base/bootstrapping.md +0 -3
- package/wiki/references/base/components.md +2 -2
- package/wiki/references/base/controllers.md +0 -1
- package/wiki/references/base/datasources.md +1 -1
- package/wiki/references/base/dependency-injection.md +2 -2
- package/wiki/references/base/filter-system/default-filter.md +2 -3
- package/wiki/references/base/filter-system/index.md +1 -1
- package/wiki/references/base/filter-system/quick-reference.md +0 -14
- package/wiki/references/base/middlewares.md +0 -8
- package/wiki/references/base/providers.md +0 -9
- package/wiki/references/base/repositories/advanced.md +1 -1
- package/wiki/references/base/repositories/mixins.md +2 -3
- package/wiki/references/base/services.md +0 -1
- package/wiki/references/components/authentication/api.md +444 -0
- package/wiki/references/components/authentication/errors.md +177 -0
- package/wiki/references/components/authentication/index.md +571 -0
- package/wiki/references/components/authentication/usage.md +781 -0
- package/wiki/references/components/health-check.md +292 -103
- package/wiki/references/components/index.md +14 -12
- package/wiki/references/components/mail/api.md +505 -0
- package/wiki/references/components/mail/errors.md +176 -0
- package/wiki/references/components/mail/index.md +535 -0
- package/wiki/references/components/mail/usage.md +404 -0
- package/wiki/references/components/request-tracker.md +229 -25
- package/wiki/references/components/socket-io/api.md +1051 -0
- package/wiki/references/components/socket-io/errors.md +119 -0
- package/wiki/references/components/socket-io/index.md +410 -0
- package/wiki/references/components/socket-io/usage.md +322 -0
- package/wiki/references/components/static-asset/api.md +261 -0
- package/wiki/references/components/static-asset/errors.md +89 -0
- package/wiki/references/components/static-asset/index.md +617 -0
- package/wiki/references/components/static-asset/usage.md +364 -0
- package/wiki/references/components/swagger.md +390 -110
- package/wiki/references/components/template/api-page.md +125 -0
- package/wiki/references/components/template/errors-page.md +100 -0
- package/wiki/references/components/template/index.md +104 -0
- package/wiki/references/components/template/setup-page.md +134 -0
- package/wiki/references/components/template/single-page.md +132 -0
- package/wiki/references/components/template/usage-page.md +127 -0
- package/wiki/references/components/websocket/api.md +508 -0
- package/wiki/references/components/websocket/errors.md +123 -0
- package/wiki/references/components/websocket/index.md +453 -0
- package/wiki/references/components/websocket/usage.md +475 -0
- package/wiki/references/helpers/cron/index.md +224 -0
- package/wiki/references/helpers/crypto/index.md +537 -0
- package/wiki/references/helpers/env/index.md +214 -0
- package/wiki/references/helpers/error/index.md +232 -0
- package/wiki/references/helpers/index.md +16 -15
- package/wiki/references/helpers/inversion/index.md +608 -0
- package/wiki/references/helpers/logger/index.md +600 -0
- package/wiki/references/helpers/network/api.md +986 -0
- package/wiki/references/helpers/network/index.md +620 -0
- package/wiki/references/helpers/queue/index.md +589 -0
- package/wiki/references/helpers/redis/index.md +495 -0
- package/wiki/references/helpers/socket-io/api.md +497 -0
- package/wiki/references/helpers/socket-io/index.md +513 -0
- package/wiki/references/helpers/storage/api.md +705 -0
- package/wiki/references/helpers/storage/index.md +583 -0
- package/wiki/references/helpers/template/index.md +66 -0
- package/wiki/references/helpers/template/single-page.md +126 -0
- package/wiki/references/helpers/testing/index.md +510 -0
- package/wiki/references/helpers/types/index.md +512 -0
- package/wiki/references/helpers/uid/index.md +272 -0
- package/wiki/references/helpers/websocket/api.md +736 -0
- package/wiki/references/helpers/websocket/index.md +574 -0
- package/wiki/references/helpers/worker-thread/index.md +470 -0
- package/wiki/references/index.md +2 -9
- package/wiki/references/quick-reference.md +3 -18
- package/wiki/references/utilities/jsx.md +1 -8
- package/wiki/references/utilities/statuses.md +0 -7
- package/wiki/references/components/authentication.md +0 -476
- package/wiki/references/components/mail.md +0 -687
- package/wiki/references/components/socket-io.md +0 -562
- package/wiki/references/components/static-asset.md +0 -1277
- package/wiki/references/helpers/cron.md +0 -108
- package/wiki/references/helpers/crypto.md +0 -132
- package/wiki/references/helpers/env.md +0 -83
- package/wiki/references/helpers/error.md +0 -97
- package/wiki/references/helpers/inversion.md +0 -176
- package/wiki/references/helpers/logger.md +0 -296
- package/wiki/references/helpers/network.md +0 -396
- package/wiki/references/helpers/queue.md +0 -150
- package/wiki/references/helpers/redis.md +0 -142
- package/wiki/references/helpers/socket-io.md +0 -932
- package/wiki/references/helpers/storage.md +0 -665
- package/wiki/references/helpers/testing.md +0 -133
- package/wiki/references/helpers/types.md +0 -167
- package/wiki/references/helpers/uid.md +0 -167
- package/wiki/references/helpers/worker-thread.md +0 -178
- package/wiki/references/src-details/boot.md +0 -379
- package/wiki/references/src-details/core.md +0 -263
- package/wiki/references/src-details/dev-configs.md +0 -298
- package/wiki/references/src-details/docs.md +0 -71
- package/wiki/references/src-details/helpers.md +0 -211
- package/wiki/references/src-details/index.md +0 -86
- package/wiki/references/src-details/inversion.md +0 -340
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
# Queue Helpers
|
|
2
|
-
|
|
3
|
-
Message queuing and asynchronous task management with BullMQ, MQTT, and in-memory solutions.
|
|
4
|
-
|
|
5
|
-
## Quick Reference
|
|
6
|
-
|
|
7
|
-
| Helper | Type | Use Case | Backed By |
|
|
8
|
-
|--------|------|----------|-----------|
|
|
9
|
-
| **BullMQHelper** | Redis-backed job queue | Background job processing, task queue | BullMQ + Redis |
|
|
10
|
-
| **MQTTClientHelper** | Message broker | Real-time messaging, IoT | MQTT broker |
|
|
11
|
-
| **QueueHelper** | In-memory queue | Sequential tasks, single process | Memory |
|
|
12
|
-
|
|
13
|
-
### BullMQHelper Roles
|
|
14
|
-
|
|
15
|
-
| Role | Purpose | Key Property |
|
|
16
|
-
|------|---------|--------------|
|
|
17
|
-
| `worker` | Process jobs (consumer) | `onWorkerData`, `onWorkerDataCompleted` |
|
|
18
|
-
| `queue` | Add jobs (producer) | `queue.add(name, data)` |
|
|
19
|
-
|
|
20
|
-
### Common Operations
|
|
21
|
-
|
|
22
|
-
| Helper | Subscribe/Consume | Publish/Produce |
|
|
23
|
-
|--------|-------------------|-----------------|
|
|
24
|
-
| **BullMQ** | Create worker role | `queue.add()` |
|
|
25
|
-
| **MQTT** | `subscribe({ topics })` | `publish({ topic, message })` |
|
|
26
|
-
| **In-Memory** | `new QueueHelper({ onMessage })` | `enqueue(payload)` |
|
|
27
|
-
|
|
28
|
-
## BullMQ Helper
|
|
29
|
-
|
|
30
|
-
The `BullMQHelper` provides a robust, Redis-backed message queuing system using the [BullMQ](https://docs.bullmq.io/) library. It's ideal for background job processing and can be configured to act as a job producer (queue) or a job consumer (worker).
|
|
31
|
-
|
|
32
|
-
### Creating a BullMQ Worker
|
|
33
|
-
|
|
34
|
-
To process jobs, you create a `BullMQHelper` with the `worker` role.
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
import { BullMQHelper, RedisHelper } from '@venizia/ignis';
|
|
38
|
-
|
|
39
|
-
const redisConnection = new RedisHelper({
|
|
40
|
-
name: 'redis-queue',
|
|
41
|
-
host: 'localhost',
|
|
42
|
-
port: 6379,
|
|
43
|
-
password: 'password',
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const myWorker = new BullMQHelper({
|
|
47
|
-
queueName: 'my-email-queue',
|
|
48
|
-
identifier: 'email-worker',
|
|
49
|
-
role: 'worker',
|
|
50
|
-
connection: redisConnection.getClient(),
|
|
51
|
-
onWorkerData: async (job) => {
|
|
52
|
-
console.log(`Sending email to ${job.data.email}`);
|
|
53
|
-
// ... email sending logic
|
|
54
|
-
return { status: 'ok' };
|
|
55
|
-
},
|
|
56
|
-
onWorkerDataCompleted: async (job, result) => {
|
|
57
|
-
console.log(`Job ${job.id} completed with result:`, result);
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Creating a BullMQ Queue (Producer)
|
|
63
|
-
|
|
64
|
-
To add jobs to the queue, you create a `BullMQHelper` with the `queue` role.
|
|
65
|
-
|
|
66
|
-
```typescript
|
|
67
|
-
import { BullMQHelper, RedisHelper } from '@venizia/ignis';
|
|
68
|
-
|
|
69
|
-
const redisConnection = new RedisHelper({
|
|
70
|
-
name: 'redis-queue',
|
|
71
|
-
host: 'localhost',
|
|
72
|
-
port: 6379,
|
|
73
|
-
password: 'password',
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
const myQueue = new BullMQHelper({
|
|
77
|
-
queueName: 'my-email-queue',
|
|
78
|
-
identifier: 'email-queue',
|
|
79
|
-
role: 'queue',
|
|
80
|
-
connection: redisConnection.getClient(),
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// Add a job to the queue
|
|
84
|
-
myQueue.queue.add('send-welcome-email', { email: 'test@example.com' });
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## MQTT Helper
|
|
88
|
-
|
|
89
|
-
The `MQTTClientHelper` provides an interface for interacting with an MQTT broker, allowing you to publish and subscribe to topics for real-time messaging.
|
|
90
|
-
|
|
91
|
-
```typescript
|
|
92
|
-
import { MQTTClientHelper } from '@venizia/ignis';
|
|
93
|
-
|
|
94
|
-
const mqttClient = new MQTTClientHelper({
|
|
95
|
-
identifier: 'my-mqtt-client',
|
|
96
|
-
url: 'mqtt://localhost:1883',
|
|
97
|
-
options: {
|
|
98
|
-
username: 'user',
|
|
99
|
-
password: 'password',
|
|
100
|
-
},
|
|
101
|
-
onMessage: ({ topic, message }) => {
|
|
102
|
-
console.log(`Received message on topic ${topic}:`, message.toString());
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// Subscribe to a topic
|
|
107
|
-
mqttClient.subscribe({ topics: ['my-topic'] });
|
|
108
|
-
|
|
109
|
-
// Publish a message
|
|
110
|
-
mqttClient.publish({ topic: 'my-topic', message: 'Hello, MQTT!' });
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## In-Memory Queue Helper
|
|
114
|
-
|
|
115
|
-
The `QueueHelper` provides a simple, in-memory queue for managing sequential tasks within a single application instance. It's useful when you don't need the overhead of an external message broker.
|
|
116
|
-
|
|
117
|
-
```typescript
|
|
118
|
-
import { QueueHelper } from '@venizia/ignis';
|
|
119
|
-
|
|
120
|
-
const myQueue = new QueueHelper<string>({
|
|
121
|
-
identifier: 'my-in-memory-queue',
|
|
122
|
-
onMessage: async ({ queueElement }) => {
|
|
123
|
-
console.log('Processing message:', queueElement.payload);
|
|
124
|
-
// Simulate some work
|
|
125
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
myQueue.enqueue('message 1');
|
|
130
|
-
myQueue.enqueue('message 2');
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
## See Also
|
|
134
|
-
|
|
135
|
-
- **Related Concepts:**
|
|
136
|
-
- [Services](/guides/core-concepts/services) - Background job processing
|
|
137
|
-
|
|
138
|
-
- **Other Helpers:**
|
|
139
|
-
- [Helpers Index](./index) - All available helpers
|
|
140
|
-
- [Cron Helper](./cron) - Scheduled tasks
|
|
141
|
-
- [Redis Helper](./redis) - Redis pub/sub
|
|
142
|
-
|
|
143
|
-
- **References:**
|
|
144
|
-
- [Mail Component](/references/components/mail) - Email queue integration
|
|
145
|
-
|
|
146
|
-
- **External Resources:**
|
|
147
|
-
- [BullMQ Documentation](https://docs.bullmq.io/) - BullMQ queue library
|
|
148
|
-
|
|
149
|
-
- **Best Practices:**
|
|
150
|
-
- [Performance Optimization](/best-practices/performance-optimization) - Queue optimization
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
# Redis Helper
|
|
2
|
-
|
|
3
|
-
Powerful Redis abstraction supporting single instances and clusters via `ioredis`.
|
|
4
|
-
|
|
5
|
-
## Quick Reference
|
|
6
|
-
|
|
7
|
-
| Helper Class | Use Case |
|
|
8
|
-
|--------------|----------|
|
|
9
|
-
| **RedisHelper** | Single Redis instance |
|
|
10
|
-
| **RedisClusterHelper** | Redis cluster |
|
|
11
|
-
| **DefaultRedisHelper** | Base class with unified API |
|
|
12
|
-
|
|
13
|
-
### Supported Operations
|
|
14
|
-
|
|
15
|
-
| Operation | Methods |
|
|
16
|
-
|-----------|---------|
|
|
17
|
-
| **Key-Value** | `set()`, `get()`, `getObject()`, `del()` |
|
|
18
|
-
| **Hashes** | `hset()`, `hget()`, `hgetall()` |
|
|
19
|
-
| **JSON** (RedisJSON) | `jSet()`, `jGet()` (requires RedisJSON module) |
|
|
20
|
-
| **Pub/Sub** | `subscribe()`, `publish()`, `unsubscribe()` |
|
|
21
|
-
| **TTL** | Set expiration on keys |
|
|
22
|
-
|
|
23
|
-
## Creating a Redis Client
|
|
24
|
-
|
|
25
|
-
### Single Instance
|
|
26
|
-
|
|
27
|
-
Use the `RedisHelper` for connecting to a single Redis instance.
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
import { RedisHelper } from '@venizia/ignis';
|
|
31
|
-
|
|
32
|
-
const redisClient = new RedisHelper({
|
|
33
|
-
name: 'my-redis-client',
|
|
34
|
-
host: 'localhost',
|
|
35
|
-
port: 6379,
|
|
36
|
-
password: 'password',
|
|
37
|
-
autoConnect: true,
|
|
38
|
-
maxRetry: 5,
|
|
39
|
-
});
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Redis Cluster
|
|
43
|
-
|
|
44
|
-
Use the `RedisClusterHelper` for connecting to a Redis cluster.
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
import { RedisClusterHelper } from '@venizia/ignis';
|
|
48
|
-
|
|
49
|
-
const redisClusterClient = new RedisClusterHelper({
|
|
50
|
-
name: 'my-redis-cluster',
|
|
51
|
-
nodes: [
|
|
52
|
-
{ host: 'localhost', port: 7000 },
|
|
53
|
-
{ host: 'localhost', port: 7001 },
|
|
54
|
-
// ... other nodes
|
|
55
|
-
],
|
|
56
|
-
});
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Basic Operations
|
|
60
|
-
|
|
61
|
-
The helper provides methods for common Redis commands.
|
|
62
|
-
|
|
63
|
-
### Key-Value
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
// Set a value
|
|
67
|
-
await redisClient.set({ key: 'mykey', value: { a: 1, b: 2 } });
|
|
68
|
-
|
|
69
|
-
// Get a value
|
|
70
|
-
const value = await redisClient.getObject({ key: 'mykey' });
|
|
71
|
-
// => { a: 1, b: 2 }
|
|
72
|
-
|
|
73
|
-
// Delete a key
|
|
74
|
-
await redisClient.del({ keys: ['mykey'] });
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Hashes
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
// Set hash fields
|
|
81
|
-
await redisClient.hset({ key: 'myhash', value: { field1: 'hello', field2: 'world' } });
|
|
82
|
-
|
|
83
|
-
// Get all hash fields
|
|
84
|
-
const hash = await redisClient.hgetall({ key: 'myhash' });
|
|
85
|
-
// => { field1: 'hello', field2: 'world' }
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## RedisJSON
|
|
89
|
-
|
|
90
|
-
If your Redis server has the RedisJSON module installed, you can use the `j*` methods to work with JSON documents.
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
// Set a JSON document
|
|
94
|
-
await redisClient.jSet({ key: 'mydoc', path: '$', value: { a: { b: 1 } } });
|
|
95
|
-
|
|
96
|
-
// Get a part of the document
|
|
97
|
-
const result = await redisClient.jGet({ key: 'mydoc', path: '$.a.b' });
|
|
98
|
-
// => [1]
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Pub/Sub
|
|
102
|
-
|
|
103
|
-
The helper also supports Redis Pub/Sub for real-time messaging.
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
// Subscribe to a topic
|
|
107
|
-
redisClient.subscribe({ topic: 'my-channel' });
|
|
108
|
-
|
|
109
|
-
// Listen for messages (in a separate part of your app)
|
|
110
|
-
redisClient.getClient().on('message', (channel, message) => {
|
|
111
|
-
if (channel === 'my-channel') {
|
|
112
|
-
console.log('Received message:', JSON.parse(message));
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// Publish a message
|
|
117
|
-
await redisClient.publish({
|
|
118
|
-
topics: ['my-channel'],
|
|
119
|
-
payload: { data: 'some important update' },
|
|
120
|
-
});
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## See Also
|
|
124
|
-
|
|
125
|
-
- **Related Concepts:**
|
|
126
|
-
- [Services](/guides/core-concepts/services) - Using Redis in services
|
|
127
|
-
|
|
128
|
-
- **Other Helpers:**
|
|
129
|
-
- [Helpers Index](./index) - All available helpers
|
|
130
|
-
- [Queue Helper](./queue) - BullMQ uses Redis as backend
|
|
131
|
-
|
|
132
|
-
- **References:**
|
|
133
|
-
- [DataSources](/references/base/datasources) - Database connections
|
|
134
|
-
|
|
135
|
-
- **External Resources:**
|
|
136
|
-
- [ioredis Documentation](https://github.com/redis/ioredis) - Redis client library
|
|
137
|
-
- [Redis Commands](https://redis.io/commands/) - Redis command reference
|
|
138
|
-
- [RedisJSON](https://redis.io/docs/stack/json/) - JSON module documentation
|
|
139
|
-
|
|
140
|
-
- **Best Practices:**
|
|
141
|
-
- [Performance Optimization](/best-practices/performance-optimization) - Caching strategies
|
|
142
|
-
- [Security Guidelines](/best-practices/security-guidelines) - Redis security
|