@open-rlb/nestjs-amqp 1.0.27 → 2.0.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 +572 -169
- package/amqp-lib/amqp/connection.d.ts +1 -1
- package/common/errors.d.ts +13 -0
- package/common/errors.js +26 -0
- package/common/errors.js.map +1 -0
- package/common/flatten.util.d.ts +1 -0
- package/common/flatten.util.js +29 -0
- package/common/flatten.util.js.map +1 -0
- package/common/index.d.ts +3 -0
- package/common/index.js +20 -0
- package/common/index.js.map +1 -0
- package/common/pagination.model.d.ts +6 -0
- package/common/pagination.model.js +3 -0
- package/common/pagination.model.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/modules/acl/acl.module.d.ts +5 -0
- package/modules/acl/acl.module.js +36 -0
- package/modules/acl/acl.module.js.map +1 -0
- package/modules/acl/cache/acl-cache.service.d.ts +15 -0
- package/modules/acl/cache/acl-cache.service.js +98 -0
- package/modules/acl/cache/acl-cache.service.js.map +1 -0
- package/modules/acl/cache/cache-store.d.ts +6 -0
- package/modules/acl/cache/cache-store.js +3 -0
- package/modules/acl/cache/cache-store.js.map +1 -0
- package/modules/acl/config/acl.config.d.ts +8 -0
- package/modules/acl/config/acl.config.js +3 -0
- package/modules/acl/config/acl.config.js.map +1 -0
- package/modules/acl/const.d.ts +17 -0
- package/modules/acl/const.js +21 -0
- package/modules/acl/const.js.map +1 -0
- package/modules/acl/index.d.ts +11 -0
- package/modules/acl/index.js +28 -0
- package/modules/acl/index.js.map +1 -0
- package/modules/acl/models.d.ts +19 -0
- package/modules/acl/models.js +3 -0
- package/modules/acl/models.js.map +1 -0
- package/modules/acl/repository/acl-action.repository.d.ts +11 -0
- package/modules/acl/repository/acl-action.repository.js +7 -0
- package/modules/acl/repository/acl-action.repository.js.map +1 -0
- package/modules/acl/repository/acl-grant.repository.d.ts +11 -0
- package/modules/acl/repository/acl-grant.repository.js +7 -0
- package/modules/acl/repository/acl-grant.repository.js.map +1 -0
- package/modules/acl/repository/acl-role.repository.d.ts +10 -0
- package/modules/acl/repository/acl-role.repository.js +7 -0
- package/modules/acl/repository/acl-role.repository.js.map +1 -0
- package/modules/acl/services/acl-management.service.d.ts +26 -0
- package/modules/acl/services/acl-management.service.js +202 -0
- package/modules/acl/services/acl-management.service.js.map +1 -0
- package/modules/acl/services/acl.service.d.ts +11 -0
- package/modules/acl/services/acl.service.js +63 -0
- package/modules/acl/services/acl.service.js.map +1 -0
- package/modules/broker/broker.module.d.ts +1 -7
- package/modules/broker/broker.module.js +1 -27
- package/modules/broker/broker.module.js.map +1 -1
- package/modules/broker/services/broker.service.js +2 -2
- package/modules/broker/services/broker.service.js.map +1 -1
- package/modules/gateway-admin/config/gateway-admin.config.d.ts +3 -0
- package/modules/gateway-admin/config/gateway-admin.config.js +3 -0
- package/modules/gateway-admin/config/gateway-admin.config.js.map +1 -0
- package/modules/gateway-admin/const.d.ts +18 -0
- package/modules/gateway-admin/const.js +22 -0
- package/modules/gateway-admin/const.js.map +1 -0
- package/modules/gateway-admin/gateway-admin.module.d.ts +5 -0
- package/modules/gateway-admin/gateway-admin.module.js +35 -0
- package/modules/gateway-admin/gateway-admin.module.js.map +1 -0
- package/modules/gateway-admin/index.d.ts +11 -0
- package/modules/gateway-admin/index.js +28 -0
- package/modules/gateway-admin/index.js.map +1 -0
- package/modules/gateway-admin/models.d.ts +22 -0
- package/modules/gateway-admin/models.js +3 -0
- package/modules/gateway-admin/models.js.map +1 -0
- package/modules/gateway-admin/repository/auth-provider.repository.d.ts +15 -0
- package/modules/gateway-admin/repository/auth-provider.repository.js +7 -0
- package/modules/gateway-admin/repository/auth-provider.repository.js.map +1 -0
- package/modules/gateway-admin/repository/http-metric.repository.d.ts +7 -0
- package/modules/gateway-admin/repository/http-metric.repository.js +7 -0
- package/modules/gateway-admin/repository/http-metric.repository.js.map +1 -0
- package/modules/gateway-admin/repository/http-path.repository.d.ts +15 -0
- package/modules/gateway-admin/repository/http-path.repository.js +7 -0
- package/modules/gateway-admin/repository/http-path.repository.js.map +1 -0
- package/modules/gateway-admin/services/gateway-auth.service.d.ts +14 -0
- package/modules/gateway-admin/services/gateway-auth.service.js +100 -0
- package/modules/gateway-admin/services/gateway-auth.service.js.map +1 -0
- package/modules/gateway-admin/services/gateway-metrics.service.d.ts +11 -0
- package/modules/gateway-admin/services/gateway-metrics.service.js +59 -0
- package/modules/gateway-admin/services/gateway-metrics.service.js.map +1 -0
- package/modules/gateway-admin/services/gateway-path.service.d.ts +14 -0
- package/modules/gateway-admin/services/gateway-path.service.js +106 -0
- package/modules/gateway-admin/services/gateway-path.service.js.map +1 -0
- package/modules/gateway-admin/util/path-order.d.ts +3 -0
- package/modules/gateway-admin/util/path-order.js +36 -0
- package/modules/gateway-admin/util/path-order.js.map +1 -0
- package/modules/proxy/config/path-definition.config.d.ts +14 -1
- package/modules/proxy/proxy.module.d.ts +15 -2
- package/modules/proxy/proxy.module.js +24 -4
- package/modules/proxy/proxy.module.js.map +1 -1
- package/modules/proxy/services/http-auth-handler.service.d.ts +6 -0
- package/modules/proxy/services/http-auth-handler.service.js +48 -24
- package/modules/proxy/services/http-auth-handler.service.js.map +1 -1
- package/modules/proxy/services/http-handler.service.d.ts +5 -1
- package/modules/proxy/services/http-handler.service.js +79 -10
- package/modules/proxy/services/http-handler.service.js.map +1 -1
- package/modules/proxy/services/jwt.service.d.ts +3 -0
- package/modules/proxy/services/jwt.service.js +66 -9
- package/modules/proxy/services/jwt.service.js.map +1 -1
- package/modules/proxy/services/websocket.service.d.ts +33 -6
- package/modules/proxy/services/websocket.service.js +250 -82
- package/modules/proxy/services/websocket.service.js.map +1 -1
- package/package.json +29 -28
- package/schematics/nest-add/files/skills/rlb-amqp/SKILL.md +59 -0
- package/schematics/nest-add/files/skills/rlb-amqp/references/config-schema.md +214 -0
- package/schematics/nest-add/files/skills/rlb-amqp/references/gotchas.md +95 -0
- package/schematics/nest-add/files/skills/rlb-amqp-add-action/SKILL.md +102 -0
- package/schematics/nest-add/files/skills/rlb-amqp-add-route/SKILL.md +61 -0
- package/schematics/nest-add/files/skills/rlb-amqp-add-ws-event/SKILL.md +93 -0
- package/schematics/nest-add/files/skills/rlb-amqp-scaffold/SKILL.md +160 -0
- package/schematics/nest-add/index.js +82 -49
- package/schematics/nest-add/index.js.map +1 -1
- package/schematics/nest-add/index.ts +113 -68
- package/schematics/nest-add/init.schema.d.ts +2 -0
- package/schematics/nest-add/init.schema.ts +11 -1
- package/schematics/nest-add/schema.json +25 -12
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rlb-amqp-scaffold
|
|
3
|
+
description: Bootstrap a new microservice or gateway using @open-rlb/nestjs-amqp. Use when the user wants to start a new service, set up the AppModule/main.ts wiring, create the YAML config loader, or generate a starter config.yaml for an AMQP microservice and/or an HTTP+WebSocket gateway. Generates the full module wiring and a minimal-but-correct config.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scaffold a @open-rlb/nestjs-amqp service
|
|
7
|
+
|
|
8
|
+
Read first:
|
|
9
|
+
- `.claude/skills/rlb-amqp/references/config-schema.md`
|
|
10
|
+
- `.claude/skills/rlb-amqp/references/gotchas.md`
|
|
11
|
+
|
|
12
|
+
Decide the role: a **microservice** (only `@BrokerAction` handlers), a **gateway**
|
|
13
|
+
(HTTP/WS exposure), or **both** in one app. Generate only the pieces needed.
|
|
14
|
+
|
|
15
|
+
## 1. `src/config/config.loader.ts`
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { readFileSync } from 'fs';
|
|
19
|
+
import * as yaml from 'js-yaml';
|
|
20
|
+
import { join } from 'path';
|
|
21
|
+
|
|
22
|
+
const YAML_CONFIG_FILENAME = 'config/config.yaml';
|
|
23
|
+
export default () =>
|
|
24
|
+
yaml.load(readFileSync(join(process.cwd(), YAML_CONFIG_FILENAME), 'utf8')) as Record<string, any>;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
(`js-yaml` is a dependency of the config loader; ensure it's installed.)
|
|
28
|
+
|
|
29
|
+
## 2. `src/app.module.ts`
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { HttpModule } from '@nestjs/axios';
|
|
33
|
+
import { Module } from '@nestjs/common';
|
|
34
|
+
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
35
|
+
import { AppConfig, BrokerModule, BrokerTopic, GatewayConfig, ProxyModule } from '@open-rlb/nestjs-amqp';
|
|
36
|
+
import { RabbitMQConfig } from '@open-rlb/nestjs-amqp/amqp-lib/config/rabbitmq.config';
|
|
37
|
+
import { HandlerAuthConfig } from '@open-rlb/nestjs-amqp/modules/broker/config/handler-auth.config';
|
|
38
|
+
import yamlConfig from './config/config.loader';
|
|
39
|
+
// import { MyActionService } from './my-action.service';
|
|
40
|
+
|
|
41
|
+
@Module({
|
|
42
|
+
imports: [
|
|
43
|
+
ConfigModule.forRoot({ isGlobal: true, load: [yamlConfig] }),
|
|
44
|
+
BrokerModule.forRootAsync({
|
|
45
|
+
imports: [ConfigModule],
|
|
46
|
+
inject: [ConfigService],
|
|
47
|
+
useFactory: async (config: ConfigService) => ({
|
|
48
|
+
options: config.get<RabbitMQConfig>('broker'),
|
|
49
|
+
topics: config.get<BrokerTopic[]>('topics'),
|
|
50
|
+
appOptions: config.get<AppConfig>('app'),
|
|
51
|
+
}),
|
|
52
|
+
}),
|
|
53
|
+
HttpModule,
|
|
54
|
+
// Gateway: auth-providers + gateway config live in ProxyModule (NOT BrokerModule).
|
|
55
|
+
ProxyModule.forRootAsync({
|
|
56
|
+
imports: [ConfigModule],
|
|
57
|
+
inject: [ConfigService],
|
|
58
|
+
useFactory: (config: ConfigService) => ({
|
|
59
|
+
authOptions: config.get<HandlerAuthConfig[]>('auth-providers'),
|
|
60
|
+
gatewayOptions: config.get<GatewayConfig>('gateway'),
|
|
61
|
+
}),
|
|
62
|
+
providers: [
|
|
63
|
+
// { provide: RLB_GTW_ACL_ROLE_SERVICE, useClass: MyAclService }, // only if using `roles`
|
|
64
|
+
],
|
|
65
|
+
}),
|
|
66
|
+
],
|
|
67
|
+
providers: [/* MyActionService */],
|
|
68
|
+
})
|
|
69
|
+
export class AppModule {}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
> Omit `ProxyModule`/`HttpModule` for a pure microservice with no HTTP/WS gateway.
|
|
73
|
+
|
|
74
|
+
## 3. `src/main.ts`
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { NestFactory } from '@nestjs/core';
|
|
78
|
+
import { WsAdapter } from '@nestjs/platform-ws';
|
|
79
|
+
import { AppModule } from './app.module';
|
|
80
|
+
|
|
81
|
+
async function bootstrap() {
|
|
82
|
+
const app = await NestFactory.create(AppModule, { rawBody: true }); // rawBody needed if any path uses parseRaw
|
|
83
|
+
app.useWebSocketAdapter(new WsAdapter(app)); // only if using the WS gateway
|
|
84
|
+
await app.listen(3000, '0.0.0.0');
|
|
85
|
+
}
|
|
86
|
+
bootstrap();
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 4. `config/config.yaml` (starter)
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
app:
|
|
93
|
+
port: 3000
|
|
94
|
+
host: 0.0.0.0
|
|
95
|
+
environment: development
|
|
96
|
+
|
|
97
|
+
auth-providers: []
|
|
98
|
+
|
|
99
|
+
broker:
|
|
100
|
+
uri: "amqp://guest:guest@localhost:5672/"
|
|
101
|
+
defaultRpcTimeout: 10000
|
|
102
|
+
defaultSubscribeErrorBehavior: ack
|
|
103
|
+
connectionManagerOptions:
|
|
104
|
+
heartbeatIntervalInSeconds: 60
|
|
105
|
+
reconnectTimeInSeconds: 60
|
|
106
|
+
connectionOptions:
|
|
107
|
+
clientProperties:
|
|
108
|
+
connection_name: my-service # REQUIRED for broadcast/WebSocket
|
|
109
|
+
credentials: { mechanism: PLAIN, username: guest, password: guest }
|
|
110
|
+
exchanges:
|
|
111
|
+
- name: my-ex
|
|
112
|
+
type: direct
|
|
113
|
+
createExchangeIfNotExists: true
|
|
114
|
+
options: { durable: true }
|
|
115
|
+
queues:
|
|
116
|
+
- name: my-rpc-q
|
|
117
|
+
exchange: my-ex
|
|
118
|
+
routingKey: my.rpc
|
|
119
|
+
createQueueIfNotExists: true
|
|
120
|
+
options: { durable: true }
|
|
121
|
+
|
|
122
|
+
topics:
|
|
123
|
+
- name: my-rpc
|
|
124
|
+
mode: rpc
|
|
125
|
+
queue: my-rpc-q
|
|
126
|
+
|
|
127
|
+
gateway:
|
|
128
|
+
mode: gateway
|
|
129
|
+
paths:
|
|
130
|
+
- name: ping
|
|
131
|
+
method: GET
|
|
132
|
+
path: /ping
|
|
133
|
+
dataSource: query
|
|
134
|
+
topic: my-rpc
|
|
135
|
+
action: ping
|
|
136
|
+
mode: rpc
|
|
137
|
+
events: []
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 5. Sample handler (optional)
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import { Injectable } from '@nestjs/common';
|
|
144
|
+
import { BrokerAction, BrokerParam } from '@open-rlb/nestjs-amqp';
|
|
145
|
+
|
|
146
|
+
@Injectable()
|
|
147
|
+
export class MyActionService {
|
|
148
|
+
@BrokerAction('my-rpc', 'ping', 'rpc')
|
|
149
|
+
async ping(@BrokerParam('body-full') data: any) {
|
|
150
|
+
return { pong: true, echo: data };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Verify
|
|
156
|
+
- topic/queue/exchange names line up (gotchas 5–7); `connection_name` set if needed (8).
|
|
157
|
+
- `npm run build`, start the app with a reachable RabbitMQ, hit `/ping`.
|
|
158
|
+
|
|
159
|
+
After scaffolding, use `rlb-amqp-add-action` / `rlb-amqp-add-route` / `rlb-amqp-add-ws-event`
|
|
160
|
+
to grow the service.
|
|
@@ -1,27 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.main = main;
|
|
4
|
-
const core_1 = require("@angular-devkit/core");
|
|
5
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
5
|
const jsonc_parser_1 = require("jsonc-parser");
|
|
7
6
|
const path_1 = require("path");
|
|
8
7
|
const formatting_1 = require("../utils/formatting");
|
|
9
8
|
const name_parser_1 = require("../utils/name.parser");
|
|
10
9
|
const source_root_helpers_1 = require("../utils/source-root.helpers");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
function brokerImportLine(gateway) {
|
|
11
|
+
const broker = gateway
|
|
12
|
+
? "import { AppConfig, BrokerModule, BrokerTopic, GatewayConfig, HandlerAuthConfig, ProxyModule, RabbitMQConfig } from '@open-rlb/nestjs-amqp';"
|
|
13
|
+
: "import { AppConfig, BrokerModule, BrokerTopic, RabbitMQConfig } from '@open-rlb/nestjs-amqp';";
|
|
14
|
+
const config = "\nimport { ConfigModule, ConfigService } from '@nestjs/config';";
|
|
15
|
+
const http = gateway ? "\nimport { HttpModule } from '@nestjs/axios';" : '';
|
|
16
|
+
return broker + config + http;
|
|
17
|
+
}
|
|
18
|
+
function brokerForRootAsync() {
|
|
19
|
+
return `BrokerModule.forRootAsync({
|
|
14
20
|
imports: [ConfigModule],
|
|
15
21
|
inject: [ConfigService],
|
|
16
22
|
useFactory: async (configService: ConfigService) => ({
|
|
17
23
|
options: configService.get<RabbitMQConfig>('broker')!,
|
|
18
24
|
topics: configService.get<BrokerTopic[]>('topics')!,
|
|
19
25
|
appOptions: configService.get<AppConfig>('app'),
|
|
20
|
-
gatewayOptions: configService.get<GatewayConfig>('gateway'),
|
|
21
|
-
authOptions: configService.get<HandlerAuthConfig[]>('auth-providers'),
|
|
22
26
|
})
|
|
23
27
|
})`;
|
|
24
|
-
|
|
28
|
+
}
|
|
29
|
+
function proxyForRootAsync() {
|
|
30
|
+
return `ProxyModule.forRootAsync({
|
|
31
|
+
imports: [ConfigModule],
|
|
32
|
+
inject: [ConfigService],
|
|
33
|
+
useFactory: (configService: ConfigService) => ({
|
|
34
|
+
authOptions: configService.get<HandlerAuthConfig[]>('auth-providers'),
|
|
35
|
+
gatewayOptions: configService.get<GatewayConfig>('gateway'),
|
|
36
|
+
}),
|
|
37
|
+
providers: [],
|
|
38
|
+
})`;
|
|
39
|
+
}
|
|
40
|
+
const CONFIG_YAML_BASE = `
|
|
25
41
|
app:
|
|
26
42
|
port: 80
|
|
27
43
|
host: 0.0.0.0
|
|
@@ -67,9 +83,13 @@ topics:
|
|
|
67
83
|
exchange: example.fanout
|
|
68
84
|
routingKey: "example.topic"
|
|
69
85
|
mode: event
|
|
70
|
-
|
|
86
|
+
`;
|
|
87
|
+
const CONFIG_YAML_GATEWAY = `
|
|
71
88
|
gateway:
|
|
72
89
|
events: []
|
|
90
|
+
ws:
|
|
91
|
+
heartbeatIntervalMs: 30000
|
|
92
|
+
# Auth is declared per-event (events[].auth / requireAuth / roles / scopeClaim).
|
|
73
93
|
paths:
|
|
74
94
|
- name: example-path
|
|
75
95
|
method: POST
|
|
@@ -79,15 +99,21 @@ gateway:
|
|
|
79
99
|
action: example-action
|
|
80
100
|
mode: event
|
|
81
101
|
`;
|
|
102
|
+
function configYaml(gateway) {
|
|
103
|
+
return gateway ? CONFIG_YAML_BASE.trimEnd() + '\n' + CONFIG_YAML_GATEWAY : CONFIG_YAML_BASE;
|
|
104
|
+
}
|
|
82
105
|
function main(options) {
|
|
83
106
|
options = transform(options);
|
|
107
|
+
const gateway = options.gateway !== false;
|
|
108
|
+
const skills = options.skills !== false;
|
|
84
109
|
return (tree, context) => {
|
|
85
110
|
return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
86
111
|
(0, source_root_helpers_1.mergeSourceRoot)(options),
|
|
87
|
-
addBrokerModuleToAppModule(),
|
|
88
|
-
updateConfigYaml(),
|
|
112
|
+
addBrokerModuleToAppModule(gateway),
|
|
113
|
+
updateConfigYaml(gateway),
|
|
114
|
+
gateway ? configureMainForGateway() : (0, schematics_1.noop)(),
|
|
89
115
|
updatePackageJson(options),
|
|
90
|
-
(0, schematics_1.
|
|
116
|
+
skills ? copySkills() : (0, schematics_1.noop)(),
|
|
91
117
|
]))(tree, context);
|
|
92
118
|
};
|
|
93
119
|
}
|
|
@@ -102,42 +128,25 @@ function transform(source) {
|
|
|
102
128
|
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(source.specFileSuffix || 'spec');
|
|
103
129
|
return target;
|
|
104
130
|
}
|
|
105
|
-
function
|
|
106
|
-
return (
|
|
107
|
-
(0, schematics_1.applyTemplates)({
|
|
108
|
-
classify: core_1.strings.classify,
|
|
109
|
-
dasherize: core_1.strings.dasherize,
|
|
110
|
-
name: options.name,
|
|
111
|
-
}),
|
|
112
|
-
renameDotfiles,
|
|
113
|
-
(0, schematics_1.move)((0, path_1.normalize)('./')),
|
|
114
|
-
])(context);
|
|
131
|
+
function copySkills() {
|
|
132
|
+
return (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files/skills'), [(0, schematics_1.move)((0, path_1.normalize)('.claude/skills'))]), schematics_1.MergeStrategy.Overwrite);
|
|
115
133
|
}
|
|
116
|
-
|
|
117
|
-
if (entry.path.includes('/__dot')) {
|
|
118
|
-
const newPath = (0, path_1.normalize)(entry.path.replace('/__dot', '/.'));
|
|
119
|
-
return {
|
|
120
|
-
content: entry.content,
|
|
121
|
-
path: newPath,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
return entry;
|
|
125
|
-
});
|
|
126
|
-
function updateConfigYaml() {
|
|
134
|
+
function updateConfigYaml(gateway) {
|
|
127
135
|
return (tree) => {
|
|
128
136
|
const CONFIG_PATH = 'config/config.yaml';
|
|
137
|
+
const block = configYaml(gateway);
|
|
129
138
|
if (!tree.exists(CONFIG_PATH)) {
|
|
130
|
-
tree.create(CONFIG_PATH,
|
|
139
|
+
tree.create(CONFIG_PATH, block.trimStart());
|
|
131
140
|
return tree;
|
|
132
141
|
}
|
|
133
142
|
const existing = tree.read(CONFIG_PATH).toString('utf-8');
|
|
134
|
-
const SECTION_KEYS = ['app:', 'auth-providers:', 'broker:', 'topics:', 'gateway:'];
|
|
143
|
+
const SECTION_KEYS = ['app:', 'auth-providers:', 'broker:', 'topics:', ...(gateway ? ['gateway:'] : [])];
|
|
135
144
|
let toAppend = '';
|
|
136
145
|
for (const key of SECTION_KEYS) {
|
|
137
146
|
if (!existing.includes(key)) {
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
140
|
-
toAppend += '\n' +
|
|
147
|
+
const section = extractYamlSection(block, key);
|
|
148
|
+
if (section) {
|
|
149
|
+
toAppend += '\n' + section;
|
|
141
150
|
}
|
|
142
151
|
}
|
|
143
152
|
}
|
|
@@ -156,7 +165,7 @@ function extractYamlSection(yaml, sectionKey) {
|
|
|
156
165
|
const sectionLines = endIdx === -1 ? lines.slice(startIdx) : lines.slice(startIdx, endIdx);
|
|
157
166
|
return sectionLines.join('\n').trimEnd();
|
|
158
167
|
}
|
|
159
|
-
function addBrokerModuleToAppModule() {
|
|
168
|
+
function addBrokerModuleToAppModule(gateway) {
|
|
160
169
|
return (tree) => {
|
|
161
170
|
const candidatePaths = [
|
|
162
171
|
'/src/app.module.ts',
|
|
@@ -169,7 +178,7 @@ function addBrokerModuleToAppModule() {
|
|
|
169
178
|
modulePath = findFileInTree(tree, 'app.module.ts');
|
|
170
179
|
}
|
|
171
180
|
if (!modulePath) {
|
|
172
|
-
console.warn('[
|
|
181
|
+
console.warn('[nest-add] app.module.ts non trovato: BrokerModule non aggiunto.');
|
|
173
182
|
return tree;
|
|
174
183
|
}
|
|
175
184
|
const rawContent = tree.read(modulePath);
|
|
@@ -181,16 +190,48 @@ function addBrokerModuleToAppModule() {
|
|
|
181
190
|
const importInsertPos = findLastImportEndIndex(content);
|
|
182
191
|
content =
|
|
183
192
|
content.slice(0, importInsertPos) +
|
|
184
|
-
'\n' +
|
|
193
|
+
'\n' + brokerImportLine(gateway) +
|
|
185
194
|
content.slice(importInsertPos);
|
|
186
195
|
}
|
|
187
196
|
if (!content.includes('BrokerModule.forRootAsync')) {
|
|
188
|
-
|
|
197
|
+
if (gateway) {
|
|
198
|
+
content = insertIntoImportsArray(content, proxyForRootAsync());
|
|
199
|
+
content = insertIntoImportsArray(content, 'HttpModule');
|
|
200
|
+
}
|
|
201
|
+
content = insertIntoImportsArray(content, brokerForRootAsync());
|
|
189
202
|
}
|
|
190
203
|
tree.overwrite(modulePath, content);
|
|
191
204
|
return tree;
|
|
192
205
|
};
|
|
193
206
|
}
|
|
207
|
+
function configureMainForGateway() {
|
|
208
|
+
return (tree) => {
|
|
209
|
+
const candidatePaths = ['/src/main.ts', '/app/main.ts', 'src/main.ts', 'app/main.ts'];
|
|
210
|
+
const mainPath = candidatePaths.find(p => tree.exists(p)) || findFileInTree(tree, 'main.ts');
|
|
211
|
+
if (!mainPath) {
|
|
212
|
+
console.warn('[nest-add] main.ts non trovato: abilita manualmente rawBody e WsAdapter.');
|
|
213
|
+
return tree;
|
|
214
|
+
}
|
|
215
|
+
let content = tree.read(mainPath).toString('utf-8');
|
|
216
|
+
if (content.includes('WsAdapter')) {
|
|
217
|
+
return tree;
|
|
218
|
+
}
|
|
219
|
+
const pos = findLastImportEndIndex(content);
|
|
220
|
+
content = content.slice(0, pos) + "\nimport { WsAdapter } from '@nestjs/platform-ws';" + content.slice(pos);
|
|
221
|
+
const m = content.match(/const\s+(\w+)\s*=\s*await\s+NestFactory\.create\(\s*([A-Za-z0-9_]+)\s*(,\s*\{[^}]*\})?\s*\)\s*;?/);
|
|
222
|
+
if (m) {
|
|
223
|
+
const appVar = m[1];
|
|
224
|
+
const moduleArg = m[2];
|
|
225
|
+
const replacement = `const ${appVar} = await NestFactory.create(${moduleArg}, { rawBody: true });\n ${appVar}.useWebSocketAdapter(new WsAdapter(${appVar}));`;
|
|
226
|
+
content = content.replace(m[0], replacement);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
console.warn('[nest-add] NestFactory.create() non trovato in main.ts: aggiungi { rawBody: true } e useWebSocketAdapter manualmente.');
|
|
230
|
+
}
|
|
231
|
+
tree.overwrite(mainPath, content);
|
|
232
|
+
return tree;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
194
235
|
function insertIntoImportsArray(source, moduleEntry) {
|
|
195
236
|
const importsArrayRegex = /imports\s*:\s*\[/;
|
|
196
237
|
const match = importsArrayRegex.exec(source);
|
|
@@ -269,12 +310,4 @@ function updateNpmScripts(scripts, _options) {
|
|
|
269
310
|
return;
|
|
270
311
|
}
|
|
271
312
|
}
|
|
272
|
-
function findImportsEndpoint(contentLines) {
|
|
273
|
-
const reversedContent = Array.from(contentLines).reverse();
|
|
274
|
-
const reverseImports = reversedContent.filter(line => line.match(/\} from ('|")/));
|
|
275
|
-
if (reverseImports.length <= 0) {
|
|
276
|
-
return 0;
|
|
277
|
-
}
|
|
278
|
-
return contentLines.indexOf(reverseImports[0]);
|
|
279
|
-
}
|
|
280
313
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/rlb-nestjs-amqp/src/schematics/nest-add/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/rlb-nestjs-amqp/src/schematics/nest-add/index.ts"],"names":[],"mappings":";;AA+HA,oBAgBC;AA/ID,2DAAmJ;AACnJ,+CAAqC;AACrC,+BAAiC;AACjC,oDAAkE;AAClE,sDAA4D;AAC5D,sEAA+D;AAS/D,SAAS,gBAAgB,CAAC,OAAgB;IAGxC,MAAM,MAAM,GAAG,OAAO;QACpB,CAAC,CAAC,8IAA8I;QAChJ,CAAC,CAAC,+FAA+F,CAAC;IACpG,MAAM,MAAM,GAAG,iEAAiE,CAAC;IACjF,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,+CAA+C,CAAC,CAAC,CAAC,E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