@open-rlb/nestjs-amqp 2.0.2 → 2.0.4
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 +6 -8
- package/common/errors.d.ts +2 -0
- package/common/errors.js +4 -1
- package/common/errors.js.map +1 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/index.js.map +1 -1
- package/modules/acl/cache/acl-cache.service.d.ts +2 -2
- package/modules/acl/cache/acl-cache.service.js +6 -6
- package/modules/acl/cache/acl-cache.service.js.map +1 -1
- package/modules/acl/config/acl.config.d.ts +0 -1
- package/modules/acl/const.d.ts +5 -2
- package/modules/acl/const.js +5 -2
- package/modules/acl/const.js.map +1 -1
- package/modules/acl/models.d.ts +9 -0
- package/modules/acl/repository/acl-action.repository.d.ts +10 -0
- package/modules/acl/repository/acl-action.repository.js.map +1 -1
- package/modules/acl/repository/acl-grant.repository.d.ts +4 -1
- package/modules/acl/repository/acl-grant.repository.js.map +1 -1
- package/modules/acl/repository/acl-role.repository.d.ts +10 -0
- package/modules/acl/repository/acl-role.repository.js.map +1 -1
- package/modules/acl/services/acl-management.service.d.ts +8 -6
- package/modules/acl/services/acl-management.service.js +78 -48
- package/modules/acl/services/acl-management.service.js.map +1 -1
- package/modules/acl/services/acl.service.d.ts +11 -3
- package/modules/acl/services/acl.service.js +103 -11
- package/modules/acl/services/acl.service.js.map +1 -1
- package/modules/broker/broker.module.d.ts +4 -1
- package/modules/broker/broker.module.js +17 -1
- package/modules/broker/broker.module.js.map +1 -1
- package/modules/broker/config/decorator-paths.d.ts +1 -0
- package/modules/broker/config/decorator-paths.js +35 -0
- package/modules/broker/config/decorator-paths.js.map +1 -0
- package/modules/broker/config/handler-auth.config.d.ts +2 -2
- package/modules/broker/config/route-discovery.config.d.ts +8 -0
- package/modules/broker/config/route-discovery.config.js +3 -0
- package/modules/broker/config/route-discovery.config.js.map +1 -0
- package/modules/broker/const.d.ts +3 -0
- package/modules/broker/const.js +4 -1
- package/modules/broker/const.js.map +1 -1
- package/modules/broker/decorators/broker-action.decorator.d.ts +15 -2
- package/modules/broker/decorators/broker-action.decorator.js +4 -4
- package/modules/broker/decorators/broker-action.decorator.js.map +1 -1
- package/modules/broker/index.d.ts +3 -0
- package/modules/broker/index.js +3 -0
- package/modules/broker/index.js.map +1 -1
- package/modules/broker/services/metadata-scanner.service.d.ts +1 -0
- package/modules/broker/services/metadata-scanner.service.js +28 -4
- package/modules/broker/services/metadata-scanner.service.js.map +1 -1
- package/modules/broker/services/route-discovery-publisher.service.d.ts +13 -0
- package/modules/broker/services/route-discovery-publisher.service.js +64 -0
- package/modules/broker/services/route-discovery-publisher.service.js.map +1 -0
- package/modules/gateway-admin/const.d.ts +2 -0
- package/modules/gateway-admin/const.js +2 -0
- package/modules/gateway-admin/const.js.map +1 -1
- package/modules/gateway-admin/gateway-admin.module.js +2 -1
- package/modules/gateway-admin/gateway-admin.module.js.map +1 -1
- package/modules/gateway-admin/index.d.ts +4 -0
- package/modules/gateway-admin/index.js +4 -0
- package/modules/gateway-admin/index.js.map +1 -1
- package/modules/gateway-admin/models.d.ts +49 -0
- package/modules/gateway-admin/repository/http-metric.repository.d.ts +4 -1
- package/modules/gateway-admin/repository/http-metric.repository.js.map +1 -1
- package/modules/gateway-admin/repository/http-path.repository.d.ts +5 -0
- package/modules/gateway-admin/repository/http-path.repository.js +6 -0
- package/modules/gateway-admin/repository/http-path.repository.js.map +1 -1
- package/modules/gateway-admin/repository/route-sync-log.repository.d.ts +5 -0
- package/modules/gateway-admin/repository/route-sync-log.repository.js +7 -0
- package/modules/gateway-admin/repository/route-sync-log.repository.js.map +1 -0
- package/modules/gateway-admin/services/gateway-metrics.service.d.ts +3 -1
- package/modules/gateway-admin/services/gateway-metrics.service.js +53 -0
- package/modules/gateway-admin/services/gateway-metrics.service.js.map +1 -1
- package/modules/gateway-admin/services/gateway-path.service.d.ts +1 -0
- package/modules/gateway-admin/services/gateway-path.service.js +16 -1
- package/modules/gateway-admin/services/gateway-path.service.js.map +1 -1
- package/modules/gateway-admin/services/route-sync.service.d.ts +19 -0
- package/modules/gateway-admin/services/route-sync.service.js +137 -0
- package/modules/gateway-admin/services/route-sync.service.js.map +1 -0
- package/modules/gateway-admin/util/route-diff.d.ts +27 -0
- package/modules/gateway-admin/util/route-diff.js +44 -0
- package/modules/gateway-admin/util/route-diff.js.map +1 -0
- package/modules/gateway-admin/util/route-manifest.d.ts +7 -0
- package/modules/gateway-admin/util/route-manifest.js +34 -0
- package/modules/gateway-admin/util/route-manifest.js.map +1 -0
- package/modules/proxy/index.d.ts +1 -0
- package/modules/proxy/index.js +1 -0
- package/modules/proxy/index.js.map +1 -1
- package/modules/proxy/services/acl.service.d.ts +2 -1
- package/modules/proxy/services/http-auth-handler.service.d.ts +1 -1
- package/modules/proxy/services/http-auth-handler.service.js +29 -34
- package/modules/proxy/services/http-auth-handler.service.js.map +1 -1
- package/modules/proxy/services/http-handler.service.d.ts +3 -1
- package/modules/proxy/services/http-handler.service.js +50 -19
- package/modules/proxy/services/http-handler.service.js.map +1 -1
- package/modules/proxy/services/metrics-hook.d.ts +15 -0
- package/modules/proxy/services/metrics-hook.js +5 -0
- package/modules/proxy/services/metrics-hook.js.map +1 -0
- package/modules/proxy/services/websocket.service.js +4 -1
- package/modules/proxy/services/websocket.service.js.map +1 -1
- package/package.json +1 -1
- package/schematics/nest-add/files/skills/rlb-amqp/references/config-schema.md +4 -3
- package/schematics/nest-add/files/skills/rlb-amqp/references/gotchas.md +14 -5
- package/schematics/nest-add/files/skills/rlb-amqp-add-route/SKILL.md +5 -2
- package/modules/remote-config/index.d.ts +0 -2
- package/modules/remote-config/index.js +0 -19
- package/modules/remote-config/index.js.map +0 -1
- package/modules/remote-config/remote-config.module.d.ts +0 -2
- package/modules/remote-config/remote-config.module.js +0 -22
- package/modules/remote-config/remote-config.module.js.map +0 -1
- package/modules/remote-config/remote-config.service.d.ts +0 -12
- package/modules/remote-config/remote-config.service.js +0 -68
- package/modules/remote-config/remote-config.service.js.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OnApplicationBootstrap } from '@nestjs/common';
|
|
2
|
+
import { AmqpConnection } from '../../../amqp-lib';
|
|
3
|
+
import { RouteDiscoveryConfig } from '../config/route-discovery.config';
|
|
4
|
+
import { AutoDiscoveryService } from './auto-discovery.service';
|
|
5
|
+
export declare class RouteDiscoveryPublisherService implements OnApplicationBootstrap {
|
|
6
|
+
private readonly amqp;
|
|
7
|
+
private readonly autoDiscovery;
|
|
8
|
+
private readonly config?;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
constructor(amqp: AmqpConnection, autoDiscovery: AutoDiscoveryService, config?: RouteDiscoveryConfig);
|
|
11
|
+
onApplicationBootstrap(): Promise<void>;
|
|
12
|
+
publish(): Promise<boolean>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var RouteDiscoveryPublisherService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.RouteDiscoveryPublisherService = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const amqp_lib_1 = require("../../../amqp-lib");
|
|
19
|
+
const decorator_paths_1 = require("../config/decorator-paths");
|
|
20
|
+
const const_1 = require("../const");
|
|
21
|
+
const auto_discovery_service_1 = require("./auto-discovery.service");
|
|
22
|
+
let RouteDiscoveryPublisherService = RouteDiscoveryPublisherService_1 = class RouteDiscoveryPublisherService {
|
|
23
|
+
constructor(amqp, autoDiscovery, config) {
|
|
24
|
+
this.amqp = amqp;
|
|
25
|
+
this.autoDiscovery = autoDiscovery;
|
|
26
|
+
this.config = config;
|
|
27
|
+
this.logger = new common_1.Logger(RouteDiscoveryPublisherService_1.name);
|
|
28
|
+
}
|
|
29
|
+
async onApplicationBootstrap() {
|
|
30
|
+
if (!this.config?.serviceName || this.config.publishOnBoot === false)
|
|
31
|
+
return;
|
|
32
|
+
await this.publish();
|
|
33
|
+
}
|
|
34
|
+
async publish() {
|
|
35
|
+
const service = this.config?.serviceName;
|
|
36
|
+
if (!service) {
|
|
37
|
+
this.logger.error('[route-discovery] routeDiscovery.serviceName is required to publish; skipped.');
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const routes = (0, decorator_paths_1.buildPathDefinitionsFromMeta)(this.autoDiscovery?.meta || {});
|
|
41
|
+
const manifest = { service, routes };
|
|
42
|
+
try {
|
|
43
|
+
await this.amqp.channel.assertExchange(const_1.ROUTE_DISCOVERY_EXCHANGE, 'fanout', { durable: true });
|
|
44
|
+
await this.amqp.channel.assertQueue(const_1.ROUTE_SYNC_QUEUE, { durable: true, exclusive: false, autoDelete: false });
|
|
45
|
+
await this.amqp.channel.bindQueue(const_1.ROUTE_SYNC_QUEUE, const_1.ROUTE_DISCOVERY_EXCHANGE, '');
|
|
46
|
+
const ok = await this.amqp.publish(const_1.ROUTE_DISCOVERY_EXCHANGE, '', manifest, { persistent: true });
|
|
47
|
+
this.logger.log(`[route-discovery] published manifest for '${service}': ${routes.length} route(s)`);
|
|
48
|
+
return ok;
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
this.logger.error(`[route-discovery] publish failed: ${e?.message}`);
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.RouteDiscoveryPublisherService = RouteDiscoveryPublisherService;
|
|
57
|
+
exports.RouteDiscoveryPublisherService = RouteDiscoveryPublisherService = RouteDiscoveryPublisherService_1 = __decorate([
|
|
58
|
+
(0, common_1.Injectable)(),
|
|
59
|
+
__param(2, (0, common_1.Optional)()),
|
|
60
|
+
__param(2, (0, common_1.Inject)(const_1.RLB_ROUTE_DISCOVERY_OPTIONS)),
|
|
61
|
+
__metadata("design:paramtypes", [amqp_lib_1.AmqpConnection,
|
|
62
|
+
auto_discovery_service_1.AutoDiscoveryService, Object])
|
|
63
|
+
], RouteDiscoveryPublisherService);
|
|
64
|
+
//# sourceMappingURL=route-discovery-publisher.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-discovery-publisher.service.js","sourceRoot":"","sources":["../../../../libs/rlb-nestjs-amqp/src/modules/broker/services/route-discovery-publisher.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA8F;AAC9F,gDAAmD;AACnD,+DAAyE;AAEzE,oCAAmG;AACnG,qEAAgE;AAYzD,IAAM,8BAA8B,sCAApC,MAAM,8BAA8B;IAGzC,YACmB,IAAoB,EACpB,aAAmC,EACH,MAA8C;QAF9E,SAAI,GAAJ,IAAI,CAAgB;QACpB,kBAAa,GAAb,aAAa,CAAsB;QACc,WAAM,GAAN,MAAM,CAAuB;QALhF,WAAM,GAAG,IAAI,eAAM,CAAC,gCAA8B,CAAC,IAAI,CAAC,CAAC;IAMtE,CAAC;IAEL,KAAK,CAAC,sBAAsB;QAC1B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,IAAI,IAAI,C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AAM,CAAC,KAAK,CAAC,qCAAsC,CAAW,EAAE,OAAO,EAAE,CAAC,CAAC;YAChF,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF,CAAA;AArCY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;IAOR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,mCAA2B,CAAC,CAAA;qCAFzB,yBAAc;QACL,6CAAoB;GAL3C,8BAA8B,CAqC1C"}
|
|
@@ -15,4 +15,6 @@ export declare const GW_ADMIN_ACTIONS: {
|
|
|
15
15
|
readonly authExport: "gw-auth-export";
|
|
16
16
|
readonly metricsTrack: "gw-metrics-track";
|
|
17
17
|
readonly metricsGet: "gw-metrics-get";
|
|
18
|
+
readonly metricsSeries: "gw-metrics-series";
|
|
19
|
+
readonly metricsPoints: "gw-metrics-points";
|
|
18
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/const.ts"],"names":[],"mappings":";;;AAEa,QAAA,mBAAmB,GAAG,mBAAmB,CAAC;AAE1C,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAE9C,QAAA,gBAAgB,GAAG;IAC9B,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,cAAc;IACxB,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,cAAc;IACxB,UAAU,EAAE,gBAAgB;IAC5B,YAAY,EAAE,kBAAkB;IAChC,UAAU,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/const.ts"],"names":[],"mappings":";;;AAEa,QAAA,mBAAmB,GAAG,mBAAmB,CAAC;AAE1C,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAE9C,QAAA,gBAAgB,GAAG;IAC9B,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,cAAc;IACxB,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,aAAa;IACtB,QAAQ,EAAE,cAAc;IACxB,UAAU,EAAE,gBAAgB;IAC5B,YAAY,EAAE,kBAAkB;IAChC,UAAU,EAAE,gBAAgB;IAC5B,aAAa,EAAE,mBAAmB;IAClC,aAAa,EAAE,mBAAmB;CAC1B,CAAC"}
|
|
@@ -13,7 +13,8 @@ const const_1 = require("./const");
|
|
|
13
13
|
const gateway_auth_service_1 = require("./services/gateway-auth.service");
|
|
14
14
|
const gateway_metrics_service_1 = require("./services/gateway-metrics.service");
|
|
15
15
|
const gateway_path_service_1 = require("./services/gateway-path.service");
|
|
16
|
-
const
|
|
16
|
+
const route_sync_service_1 = require("./services/route-sync.service");
|
|
17
|
+
const SERVICES = [gateway_path_service_1.GatewayPathService, gateway_auth_service_1.GatewayAuthService, gateway_metrics_service_1.GatewayMetricsService, route_sync_service_1.RouteSyncService];
|
|
17
18
|
const MODULE_EXPORTS = [gateway_path_service_1.GatewayPathService, gateway_auth_service_1.GatewayAuthService, gateway_metrics_service_1.GatewayMetricsService];
|
|
18
19
|
let GatewayAdminModule = GatewayAdminModule_1 = class GatewayAdminModule {
|
|
19
20
|
static forRoot(providers, options = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-admin.module.js","sourceRoot":"","sources":["../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/gateway-admin.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAiE;AAEjE,mCAA+C;AAC/C,0EAAqE;AACrE,gFAA2E;AAC3E,0EAAqE;
|
|
1
|
+
{"version":3,"file":"gateway-admin.module.js","sourceRoot":"","sources":["../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/gateway-admin.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAiE;AAEjE,mCAA+C;AAC/C,0EAAqE;AACrE,gFAA2E;AAC3E,0EAAqE;AACrE,sEAAiE;AAEjE,MAAM,QAAQ,GAAe,CAAC,yCAAkB,EAAE,yCAAkB,EAAE,+CAAqB,EAAE,qCAAgB,CAAC,CAAC;AAC/G,MAAM,cAAc,GAAG,CAAC,yCAAkB,EAAE,yCAAkB,EAAE,+CAAqB,CAAC,CAAC;AAGhF,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAK7B,MAAM,CAAC,OAAO,CAAC,SAAqB,EAAE,UAAqC,EAAE;QAC3E,OAAO;YACL,MAAM,EAAE,oBAAkB;YAC1B,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,4BAAoB,EAAE,QAAQ,EAAE,OAAO,EAAE;gBACpD,GAAG,SAAS;gBACZ,GAAG,QAAQ;aACZ;YACD,OAAO,EAAE,cAAc;SACxB,CAAC;IACJ,CAAC;CACF,CAAA;AAhBY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,kBAAkB,CAgB9B"}
|
|
@@ -5,7 +5,11 @@ export * from './models';
|
|
|
5
5
|
export * from './repository/auth-provider.repository';
|
|
6
6
|
export * from './repository/http-metric.repository';
|
|
7
7
|
export * from './repository/http-path.repository';
|
|
8
|
+
export * from './repository/route-sync-log.repository';
|
|
8
9
|
export * from './services/gateway-auth.service';
|
|
9
10
|
export * from './services/gateway-metrics.service';
|
|
10
11
|
export * from './services/gateway-path.service';
|
|
12
|
+
export * from './services/route-sync.service';
|
|
11
13
|
export * from './util/path-order';
|
|
14
|
+
export * from './util/route-diff';
|
|
15
|
+
export * from './util/route-manifest';
|
|
@@ -21,8 +21,12 @@ __exportStar(require("./models"), exports);
|
|
|
21
21
|
__exportStar(require("./repository/auth-provider.repository"), exports);
|
|
22
22
|
__exportStar(require("./repository/http-metric.repository"), exports);
|
|
23
23
|
__exportStar(require("./repository/http-path.repository"), exports);
|
|
24
|
+
__exportStar(require("./repository/route-sync-log.repository"), exports);
|
|
24
25
|
__exportStar(require("./services/gateway-auth.service"), exports);
|
|
25
26
|
__exportStar(require("./services/gateway-metrics.service"), exports);
|
|
26
27
|
__exportStar(require("./services/gateway-path.service"), exports);
|
|
28
|
+
__exportStar(require("./services/route-sync.service"), exports);
|
|
27
29
|
__exportStar(require("./util/path-order"), exports);
|
|
30
|
+
__exportStar(require("./util/route-diff"), exports);
|
|
31
|
+
__exportStar(require("./util/route-manifest"), exports);
|
|
28
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,0CAAwB;AACxB,yDAAuC;AACvC,2CAAyB;AACzB,wEAAsD;AACtD,sEAAoD;AACpD,oEAAkD;AAClD,kEAAgD;AAChD,qEAAmD;AACnD,kEAAgD;AAChD,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,0CAAwB;AACxB,yDAAuC;AACvC,2CAAyB;AACzB,wEAAsD;AACtD,sEAAoD;AACpD,oEAAkD;AAClD,yEAAuD;AACvD,kEAAgD;AAChD,qEAAmD;AACnD,kEAAgD;AAChD,gEAA8C;AAC9C,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC"}
|
|
@@ -17,6 +17,55 @@ export interface TrackCallInput {
|
|
|
17
17
|
name?: string;
|
|
18
18
|
topic?: string;
|
|
19
19
|
action?: string;
|
|
20
|
+
mode?: string;
|
|
20
21
|
status?: number;
|
|
21
22
|
durationMs?: number;
|
|
23
|
+
ts?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface HttpMetricPoint<Id = string> {
|
|
26
|
+
_id?: Id;
|
|
27
|
+
ts: number;
|
|
28
|
+
method: string;
|
|
29
|
+
route: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
topic?: string;
|
|
32
|
+
action?: string;
|
|
33
|
+
mode?: string;
|
|
34
|
+
status?: number;
|
|
35
|
+
durationMs?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface MetricQuery {
|
|
38
|
+
method?: string;
|
|
39
|
+
route?: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
from?: number;
|
|
42
|
+
to?: number;
|
|
43
|
+
limit?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface MetricSeriesQuery extends MetricQuery {
|
|
46
|
+
bucketMs: number;
|
|
47
|
+
}
|
|
48
|
+
export interface MetricSeriesBucket {
|
|
49
|
+
bucketStart: number;
|
|
50
|
+
count: number;
|
|
51
|
+
errorCount: number;
|
|
52
|
+
totalDurationMs: number;
|
|
53
|
+
avgDurationMs: number;
|
|
54
|
+
minDurationMs?: number;
|
|
55
|
+
maxDurationMs?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface RouteSyncLogEntry<Id = string> {
|
|
58
|
+
_id?: Id;
|
|
59
|
+
ts: number;
|
|
60
|
+
service: string;
|
|
61
|
+
level: 'info' | 'warn' | 'error';
|
|
62
|
+
event: string;
|
|
63
|
+
routeKey?: string;
|
|
64
|
+
method?: string;
|
|
65
|
+
path?: string;
|
|
66
|
+
topic?: string;
|
|
67
|
+
action?: string;
|
|
68
|
+
owner?: string;
|
|
69
|
+
conflictWith?: string;
|
|
70
|
+
message?: string;
|
|
22
71
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { HttpMetric, TrackCallInput } from '../models';
|
|
1
|
+
import { HttpMetric, HttpMetricPoint, MetricQuery, MetricSeriesBucket, MetricSeriesQuery, TrackCallInput } from '../models';
|
|
2
2
|
export declare abstract class HttpMetricRepository {
|
|
3
3
|
abstract increment(input: TrackCallInput): Promise<void>;
|
|
4
4
|
abstract list(route?: string): Promise<(HttpMetric & {
|
|
5
5
|
avgDurationMs: number;
|
|
6
6
|
})[]>;
|
|
7
|
+
abstract record(point: HttpMetricPoint): Promise<void>;
|
|
8
|
+
abstract points(query: MetricQuery): Promise<HttpMetricPoint[]>;
|
|
9
|
+
abstract series(query: MetricSeriesQuery): Promise<MetricSeriesBucket[]>;
|
|
7
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-metric.repository.js","sourceRoot":"","sources":["../../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/repository/http-metric.repository.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"http-metric.repository.js","sourceRoot":"","sources":["../../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/repository/http-metric.repository.ts"],"names":[],"mappings":";;;AASA,MAAsB,oBAAoB;CAczC;AAdD,oDAcC"}
|
|
@@ -3,6 +3,8 @@ import { PathDefinition } from '../../proxy/config/path-definition.config';
|
|
|
3
3
|
export type StoredHttpPath = Partial<PathDefinition> & {
|
|
4
4
|
_id?: string;
|
|
5
5
|
enabled?: boolean;
|
|
6
|
+
owner?: string;
|
|
7
|
+
routeKey?: string;
|
|
6
8
|
};
|
|
7
9
|
export declare abstract class HttpPathRepository {
|
|
8
10
|
abstract insert(model: StoredHttpPath): Promise<StoredHttpPath>;
|
|
@@ -12,4 +14,7 @@ export declare abstract class HttpPathRepository {
|
|
|
12
14
|
abstract removeById(id: string): Promise<StoredHttpPath>;
|
|
13
15
|
abstract listEnabled(): Promise<PathDefinition[]>;
|
|
14
16
|
abstract filterPaginated(filter: Record<string, any>, page?: number, limit?: number): Promise<PaginationModel<StoredHttpPath>>;
|
|
17
|
+
abstract filter(filter: Record<string, any>): Promise<StoredHttpPath[]>;
|
|
18
|
+
findByOwner(owner: string): Promise<StoredHttpPath[]>;
|
|
19
|
+
findByRouteKey(routeKey: string): Promise<StoredHttpPath[]>;
|
|
15
20
|
}
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HttpPathRepository = void 0;
|
|
4
4
|
class HttpPathRepository {
|
|
5
|
+
findByOwner(owner) {
|
|
6
|
+
return this.filter({ owner });
|
|
7
|
+
}
|
|
8
|
+
findByRouteKey(routeKey) {
|
|
9
|
+
return this.filter({ routeKey });
|
|
10
|
+
}
|
|
5
11
|
}
|
|
6
12
|
exports.HttpPathRepository = HttpPathRepository;
|
|
7
13
|
//# sourceMappingURL=http-path.repository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-path.repository.js","sourceRoot":"","sources":["../../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/repository/http-path.repository.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"http-path.repository.js","sourceRoot":"","sources":["../../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/repository/http-path.repository.ts"],"names":[],"mappings":";;;AAcA,MAAsB,kBAAkB;IAatC,WAAW,CAAC,KAAa;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAChC,CAAC;IAID,cAAc,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IACnC,CAAC;CACF;AAtBD,gDAsBC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouteSyncLogRepository = void 0;
|
|
4
|
+
class RouteSyncLogRepository {
|
|
5
|
+
}
|
|
6
|
+
exports.RouteSyncLogRepository = RouteSyncLogRepository;
|
|
7
|
+
//# sourceMappingURL=route-sync-log.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-sync-log.repository.js","sourceRoot":"","sources":["../../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/repository/route-sync-log.repository.ts"],"names":[],"mappings":";;;AAMA,MAAsB,sBAAsB;CAG3C;AAHD,wDAGC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpMetric, TrackCallInput } from '../models';
|
|
1
|
+
import { HttpMetric, HttpMetricPoint, MetricSeriesBucket, TrackCallInput } from '../models';
|
|
2
2
|
import { HttpMetricRepository } from '../repository/http-metric.repository';
|
|
3
3
|
export declare class GatewayMetricsService {
|
|
4
4
|
private readonly repo;
|
|
@@ -8,4 +8,6 @@ export declare class GatewayMetricsService {
|
|
|
8
8
|
get(route?: string): Promise<(HttpMetric & {
|
|
9
9
|
avgDurationMs: number;
|
|
10
10
|
})[]>;
|
|
11
|
+
series(bucketMs?: number | string, from?: number | string, to?: number | string, method?: string, route?: string, name?: string): Promise<MetricSeriesBucket[]>;
|
|
12
|
+
points(method?: string, route?: string, from?: number | string, to?: number | string, limit?: number | string): Promise<HttpMetricPoint[]>;
|
|
11
13
|
}
|
|
@@ -28,6 +28,17 @@ let GatewayMetricsService = GatewayMetricsService_1 = class GatewayMetricsServic
|
|
|
28
28
|
if (!input?.method || !input?.route)
|
|
29
29
|
return;
|
|
30
30
|
await this.repo.increment(input);
|
|
31
|
+
await this.repo.record({
|
|
32
|
+
ts: input.ts ?? Date.now(),
|
|
33
|
+
method: input.method,
|
|
34
|
+
route: input.route,
|
|
35
|
+
name: input.name,
|
|
36
|
+
topic: input.topic,
|
|
37
|
+
action: input.action,
|
|
38
|
+
mode: input.mode,
|
|
39
|
+
status: input.status,
|
|
40
|
+
durationMs: input.durationMs,
|
|
41
|
+
});
|
|
31
42
|
}
|
|
32
43
|
catch (error) {
|
|
33
44
|
this.logger.error(error);
|
|
@@ -36,6 +47,25 @@ let GatewayMetricsService = GatewayMetricsService_1 = class GatewayMetricsServic
|
|
|
36
47
|
async get(route) {
|
|
37
48
|
return this.repo.list(route);
|
|
38
49
|
}
|
|
50
|
+
async series(bucketMs, from, to, method, route, name) {
|
|
51
|
+
return this.repo.series({
|
|
52
|
+
bucketMs: Number(bucketMs) || 60_000,
|
|
53
|
+
from: from != null ? Number(from) : undefined,
|
|
54
|
+
to: to != null ? Number(to) : undefined,
|
|
55
|
+
method,
|
|
56
|
+
route,
|
|
57
|
+
name,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async points(method, route, from, to, limit) {
|
|
61
|
+
return this.repo.points({
|
|
62
|
+
method,
|
|
63
|
+
route,
|
|
64
|
+
from: from != null ? Number(from) : undefined,
|
|
65
|
+
to: to != null ? Number(to) : undefined,
|
|
66
|
+
limit: limit != null ? Number(limit) : undefined,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
39
69
|
};
|
|
40
70
|
exports.GatewayMetricsService = GatewayMetricsService;
|
|
41
71
|
__decorate([
|
|
@@ -52,6 +82,29 @@ __decorate([
|
|
|
52
82
|
__metadata("design:paramtypes", [String]),
|
|
53
83
|
__metadata("design:returntype", Promise)
|
|
54
84
|
], GatewayMetricsService.prototype, "get", null);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, broker_1.BrokerAction)(const_1.GATEWAY_ADMIN_TOPIC, const_1.GW_ADMIN_ACTIONS.metricsSeries, 'rpc'),
|
|
87
|
+
__param(0, (0, broker_1.BrokerParam)('body', 'bucketMs')),
|
|
88
|
+
__param(1, (0, broker_1.BrokerParam)('body', 'from')),
|
|
89
|
+
__param(2, (0, broker_1.BrokerParam)('body', 'to')),
|
|
90
|
+
__param(3, (0, broker_1.BrokerParam)('body', 'method')),
|
|
91
|
+
__param(4, (0, broker_1.BrokerParam)('body', 'route')),
|
|
92
|
+
__param(5, (0, broker_1.BrokerParam)('body', 'name')),
|
|
93
|
+
__metadata("design:type", Function),
|
|
94
|
+
__metadata("design:paramtypes", [Object, Object, Object, String, String, String]),
|
|
95
|
+
__metadata("design:returntype", Promise)
|
|
96
|
+
], GatewayMetricsService.prototype, "series", null);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, broker_1.BrokerAction)(const_1.GATEWAY_ADMIN_TOPIC, const_1.GW_ADMIN_ACTIONS.metricsPoints, 'rpc'),
|
|
99
|
+
__param(0, (0, broker_1.BrokerParam)('body', 'method')),
|
|
100
|
+
__param(1, (0, broker_1.BrokerParam)('body', 'route')),
|
|
101
|
+
__param(2, (0, broker_1.BrokerParam)('body', 'from')),
|
|
102
|
+
__param(3, (0, broker_1.BrokerParam)('body', 'to')),
|
|
103
|
+
__param(4, (0, broker_1.BrokerParam)('body', 'limit')),
|
|
104
|
+
__metadata("design:type", Function),
|
|
105
|
+
__metadata("design:paramtypes", [String, String, Object, Object, Object]),
|
|
106
|
+
__metadata("design:returntype", Promise)
|
|
107
|
+
], GatewayMetricsService.prototype, "points", null);
|
|
55
108
|
exports.GatewayMetricsService = GatewayMetricsService = GatewayMetricsService_1 = __decorate([
|
|
56
109
|
(0, common_1.Injectable)(),
|
|
57
110
|
__metadata("design:paramtypes", [http_metric_repository_1.HttpMetricRepository])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-metrics.service.js","sourceRoot":"","sources":["../../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/services/gateway-metrics.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,yCAAyD;AACzD,oCAAiE;AAEjE,iFAA4E;AAGrE,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAGhC,YAA6B,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;QAFtC,WAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAEN,CAAC;
|
|
1
|
+
{"version":3,"file":"gateway-metrics.service.js","sourceRoot":"","sources":["../../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/services/gateway-metrics.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,yCAAyD;AACzD,oCAAiE;AAEjE,iFAA4E;AAGrE,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAGhC,YAA6B,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;QAFtC,WAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAEN,CAAC;IAKtD,AAAN,KAAK,CAAC,KAAK,CAA2B,KAAqB;QACzD,IAAI,CAAC;YACH,IAAI,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,KAAK,EAAE,KAAK;gBAAE,OAAO;YAC5C,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACjC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;gBACrB,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE;gBAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,UAAU,EAAE,KAAK,CAAC,UAAU;aAC7B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAIK,AAAN,KAAK,CAAC,GAAG,CAA+B,KAAc;QACpD,OAAO,IAAI,C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
|
update(id: string, model: StoredHttpPath): Promise<StoredHttpPath>;
|
|
10
|
+
private assertNoRouteConflict;
|
|
10
11
|
remove(id: string): Promise<StoredHttpPath>;
|
|
11
12
|
get(id: string): Promise<StoredHttpPath>;
|
|
12
13
|
list(page?: number, limit?: number): Promise<PaginationModel<StoredHttpPath>>;
|
|
@@ -20,6 +20,7 @@ const broker_1 = require("../../broker");
|
|
|
20
20
|
const const_1 = require("../const");
|
|
21
21
|
const http_path_repository_1 = require("../repository/http-path.repository");
|
|
22
22
|
const path_order_1 = require("../util/path-order");
|
|
23
|
+
const route_manifest_1 = require("../util/route-manifest");
|
|
23
24
|
let GatewayPathService = GatewayPathService_1 = class GatewayPathService {
|
|
24
25
|
constructor(repo) {
|
|
25
26
|
this.repo = repo;
|
|
@@ -34,13 +35,27 @@ let GatewayPathService = GatewayPathService_1 = class GatewayPathService {
|
|
|
34
35
|
throw new common_2.BadRequestError('path is required');
|
|
35
36
|
if (!model?.topic)
|
|
36
37
|
throw new common_2.BadRequestError('topic is required');
|
|
37
|
-
|
|
38
|
+
const routeKey = (0, route_manifest_1.routeKeyOf)(model);
|
|
39
|
+
await this.assertNoRouteConflict(routeKey);
|
|
40
|
+
return this.repo.insert({ ...model, routeKey });
|
|
38
41
|
}
|
|
39
42
|
async update(id, model) {
|
|
40
43
|
if (!id)
|
|
41
44
|
throw new common_2.BadRequestError('id is required');
|
|
45
|
+
if (model?.method && model?.path) {
|
|
46
|
+
const routeKey = (0, route_manifest_1.routeKeyOf)(model);
|
|
47
|
+
await this.assertNoRouteConflict(routeKey, id);
|
|
48
|
+
model = { ...model, routeKey };
|
|
49
|
+
}
|
|
42
50
|
return this.repo.updateById(id, model);
|
|
43
51
|
}
|
|
52
|
+
async assertNoRouteConflict(routeKey, excludeId) {
|
|
53
|
+
const clashes = await this.repo.findByRouteKey(routeKey);
|
|
54
|
+
const conflict = (clashes || []).find((p) => p.enabled !== false && p._id !== excludeId);
|
|
55
|
+
if (conflict) {
|
|
56
|
+
throw new common_2.ConflictError(`A route '${routeKey}' already exists (owner '${conflict.owner ?? 'manual'}', id ${conflict._id}).`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
44
59
|
async remove(id) {
|
|
45
60
|
return this.repo.removeById(id);
|
|
46
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-path.service.js","sourceRoot":"","sources":["../../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/services/gateway-path.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"gateway-path.service.js","sourceRoot":"","sources":["../../../../libs/rlb-nestjs-amqp/src/modules/gateway-admin/services/gateway-path.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,4CAAkF;AAClF,yCAAyD;AAEzD,oCAAiE;AACjE,6EAAwF;AACxF,mDAAgD;AAChD,2DAAoD;AAG7C,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAG7B,YAA6B,IAAwB;QAAxB,SAAI,GAAJ,IAAI,CAAoB;QAFpC,WAAM,GAAG,IAAI,eAAM,CAAC,oBAAkB,CAAC,IAAI,CAAC,CAAC;IAEL,CAAC;IAGpD,AAAN,KAAK,CAAC,MAAM,CAA2B,KAAqB;QAC1D,IAAI,CAAC,KAAK,EAAE,IAAI;YAAE,MAAM,IAAI,wBAAe,CAAC,kBAAkB,CAAC,CAAC;QAChE,IAAI,CAAC,KAAK,EAAE,MAAM;YAAE,MAAM,IAAI,wBAAe,CAAC,oBAAoB,CAAC,CAAC;QACpE,IAAI,CAAC,KAAK,EAAE,IAAI;YAAE,MAAM,IAAI,wBAAe,CAAC,kBAAkB,CAAC,CAAC;QAChE,IAAI,CAAC,KAAK,EAAE,KAAK;YAAE,MAAM,IAAI,wBAAe,CAAC,mBAAmB,CAAC,CAAC;QAClE,MAAM,QAAQ,GAAG,IAAA,2BAAU,EAAC,KAAK,CAAC,CAAC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AI,CAAC,CAAA;;;;6CAEnC;AAGK;IADL,IAAA,qBAAY,EAAC,2BAAmB,EAAE,wBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC;IACxD,WAAA,IAAA,oBAAW,EAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAAiB,WAAA,IAAA,oBAAW,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;;;;8CAEnF;AAIK;IADL,IAAA,qBAAY,EAAC,2BAAmB,EAAE,wBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC;;;;gDAIrE;6BA9DU,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;qCAIwB,yCAAkB;GAH1C,kBAAkB,CA+D9B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OnApplicationBootstrap } from '@nestjs/common';
|
|
2
|
+
import { AmqpConnection } from '../../../amqp-lib';
|
|
3
|
+
import { BrokerService } from '../../broker';
|
|
4
|
+
import { GatewayConfig } from '../../proxy/config/path-definition.config';
|
|
5
|
+
import { HttpPathRepository } from '../repository/http-path.repository';
|
|
6
|
+
import { RouteSyncLogRepository } from '../repository/route-sync-log.repository';
|
|
7
|
+
export declare class RouteSyncService implements OnApplicationBootstrap {
|
|
8
|
+
private readonly amqp;
|
|
9
|
+
private readonly broker;
|
|
10
|
+
private readonly paths;
|
|
11
|
+
private readonly logs;
|
|
12
|
+
private readonly gatewayConfig;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
constructor(amqp: AmqpConnection, broker: BrokerService, paths: HttpPathRepository, logs: RouteSyncLogRepository, gatewayConfig: GatewayConfig);
|
|
15
|
+
onApplicationBootstrap(): Promise<void>;
|
|
16
|
+
private handle;
|
|
17
|
+
private journal;
|
|
18
|
+
private triggerReload;
|
|
19
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var RouteSyncService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.RouteSyncService = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const amqp_lib_1 = require("../../../amqp-lib");
|
|
19
|
+
const broker_1 = require("../../broker");
|
|
20
|
+
const const_1 = require("../../broker/const");
|
|
21
|
+
const http_path_repository_1 = require("../repository/http-path.repository");
|
|
22
|
+
const route_sync_log_repository_1 = require("../repository/route-sync-log.repository");
|
|
23
|
+
const route_diff_1 = require("../util/route-diff");
|
|
24
|
+
const route_manifest_1 = require("../util/route-manifest");
|
|
25
|
+
let RouteSyncService = RouteSyncService_1 = class RouteSyncService {
|
|
26
|
+
constructor(amqp, broker, paths, logs, gatewayConfig) {
|
|
27
|
+
this.amqp = amqp;
|
|
28
|
+
this.broker = broker;
|
|
29
|
+
this.paths = paths;
|
|
30
|
+
this.logs = logs;
|
|
31
|
+
this.gatewayConfig = gatewayConfig;
|
|
32
|
+
this.logger = new common_1.Logger(RouteSyncService_1.name);
|
|
33
|
+
}
|
|
34
|
+
async onApplicationBootstrap() {
|
|
35
|
+
try {
|
|
36
|
+
await this.amqp.channel.assertExchange(const_1.ROUTE_DISCOVERY_EXCHANGE, 'fanout', { durable: true });
|
|
37
|
+
await this.amqp.createSubscriber(async (msg) => { await this.handle(msg); }, {
|
|
38
|
+
queue: const_1.ROUTE_SYNC_QUEUE,
|
|
39
|
+
exchange: const_1.ROUTE_DISCOVERY_EXCHANGE,
|
|
40
|
+
routingKey: '',
|
|
41
|
+
createQueueIfNotExists: true,
|
|
42
|
+
queueOptions: { durable: true, exclusive: false, autoDelete: false },
|
|
43
|
+
}, const_1.ROUTE_SYNC_QUEUE);
|
|
44
|
+
this.logger.log(`[route-sync] listening on '${const_1.ROUTE_SYNC_QUEUE}' (exchange '${const_1.ROUTE_DISCOVERY_EXCHANGE}', competing consumers)`);
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
this.logger.error(`[route-sync] subscribe failed: ${e?.message}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async handle(manifest) {
|
|
51
|
+
try {
|
|
52
|
+
const service = manifest?.service;
|
|
53
|
+
if (!service) {
|
|
54
|
+
this.logger.warn('[route-sync] manifest without `service`; ignored');
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const routes = Array.isArray(manifest.routes) ? manifest.routes : [];
|
|
58
|
+
const existing = await this.paths.findByOwner(service);
|
|
59
|
+
if (routes.length === 0 && existing.length > 0) {
|
|
60
|
+
this.logger.warn(`[route-sync] ${service}: manifest is EMPTY but ${existing.length} route(s) exist for this service → all will be soft-disabled. Verify the publisher is not mis-firing.`);
|
|
61
|
+
}
|
|
62
|
+
const reserved = new Map();
|
|
63
|
+
for (const p of this.gatewayConfig?.paths || [])
|
|
64
|
+
reserved.set((0, route_manifest_1.routeKeyOf)(p), 'yaml');
|
|
65
|
+
for (const r of routes) {
|
|
66
|
+
const key = (0, route_manifest_1.routeKeyOf)(r);
|
|
67
|
+
if (reserved.has(key))
|
|
68
|
+
continue;
|
|
69
|
+
const clashes = await this.paths.findByRouteKey(key);
|
|
70
|
+
const other = (clashes || []).find((c) => (c.owner ?? 'manual') !== service);
|
|
71
|
+
if (other)
|
|
72
|
+
reserved.set(key, other.owner ?? 'manual');
|
|
73
|
+
}
|
|
74
|
+
const diff = (0, route_diff_1.diffRoutes)(service, routes, existing, reserved);
|
|
75
|
+
for (const c of diff.collisions) {
|
|
76
|
+
this.logger.warn(`[route-sync] ${service}: collision on '${c.routeKey}' (owned by '${c.conflictWith}') → skipped`);
|
|
77
|
+
await this.journal({ service, level: 'warn', event: 'collision', routeKey: c.routeKey, method: c.method, path: c.path, conflictWith: c.conflictWith, message: `route '${c.routeKey}' already owned by '${c.conflictWith}'; skipped` });
|
|
78
|
+
}
|
|
79
|
+
for (const inv of diff.invalid) {
|
|
80
|
+
await this.journal({ service, level: 'error', event: 'invalid', message: `invalid route dropped: ${JSON.stringify(inv.route)?.slice(0, 200)}` });
|
|
81
|
+
}
|
|
82
|
+
for (const u of diff.upserts) {
|
|
83
|
+
if (u.existingId)
|
|
84
|
+
await this.paths.updateById(u.existingId, u.model);
|
|
85
|
+
else
|
|
86
|
+
await this.paths.insert(u.model);
|
|
87
|
+
await this.journal({ service, level: 'info', event: u.added ? 'added' : 'updated', routeKey: u.routeKey, method: u.model.method, path: u.model.path, topic: u.model.topic, action: u.model.action });
|
|
88
|
+
}
|
|
89
|
+
for (const d of diff.disables) {
|
|
90
|
+
await this.paths.updateById(d.id, { enabled: false });
|
|
91
|
+
await this.journal({ service, level: 'info', event: 'removed', routeKey: d.routeKey, method: d.method, path: d.path });
|
|
92
|
+
}
|
|
93
|
+
if (diff.changed) {
|
|
94
|
+
await this.triggerReload();
|
|
95
|
+
await this.journal({ service, level: 'info', event: 'reload', message: `${diff.upserts.length} upserted, ${diff.disables.length} removed, ${diff.collisions.length} collision(s)` });
|
|
96
|
+
this.logger.log(`[route-sync] ${service}: ${diff.upserts.length} upserted, ${diff.disables.length} removed, ${diff.collisions.length} collision(s) → reload`);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.logger.log(`[route-sync] ${service}: no route changes (${diff.collisions.length} collision(s))`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
this.logger.error(`[route-sync] handle failed: ${e?.message}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async journal(entry) {
|
|
107
|
+
try {
|
|
108
|
+
await this.logs.insert({ ts: Date.now(), ...entry });
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
this.logger.warn(`[route-sync] journal write failed: ${e?.message}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async triggerReload() {
|
|
115
|
+
const topic = this.gatewayConfig?.reloadTopic;
|
|
116
|
+
if (!topic) {
|
|
117
|
+
this.logger.warn('[route-sync] no gateway.reloadTopic configured; routes persisted but instances will not auto-reload.');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
await this.broker.publishMessage(topic, 'route-sync', {});
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
this.logger.error(`[route-sync] reload broadcast failed: ${e?.message}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
exports.RouteSyncService = RouteSyncService;
|
|
129
|
+
exports.RouteSyncService = RouteSyncService = RouteSyncService_1 = __decorate([
|
|
130
|
+
(0, common_1.Injectable)(),
|
|
131
|
+
__param(4, (0, common_1.Inject)(const_1.RLB_AMQP_GATEWAY_OPTIONS)),
|
|
132
|
+
__metadata("design:paramtypes", [amqp_lib_1.AmqpConnection,
|
|
133
|
+
broker_1.BrokerService,
|
|
134
|
+
http_path_repository_1.HttpPathRepository,
|
|
135
|
+
route_sync_log_repository_1.RouteSyncLogRepository, Object])
|
|
136
|
+
], RouteSyncService);
|
|
137
|
+
//# sourceMappingURL=route-sync.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-sync.service.js","sourceRoot":"","sources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