@zorionapp/gg-core 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/package.json +58 -0
- package/src/gg-auth/decorators/protected.decorator.d.ts +9 -0
- package/src/gg-auth/decorators/protected.decorator.js +8 -0
- package/src/gg-auth/decorators/protected.decorator.js.map +1 -0
- package/src/gg-auth/exceptions/merchant-ip-mismatch.exception.d.ts +7 -0
- package/src/gg-auth/exceptions/merchant-ip-mismatch.exception.js +15 -0
- package/src/gg-auth/exceptions/merchant-ip-mismatch.exception.js.map +1 -0
- package/src/gg-auth/exceptions/user-blocked.exception.d.ts +9 -0
- package/src/gg-auth/exceptions/user-blocked.exception.js +17 -0
- package/src/gg-auth/exceptions/user-blocked.exception.js.map +1 -0
- package/src/gg-auth/exceptions/user-inactive.exception.d.ts +9 -0
- package/src/gg-auth/exceptions/user-inactive.exception.js +17 -0
- package/src/gg-auth/exceptions/user-inactive.exception.js.map +1 -0
- package/src/gg-auth/exceptions/user-otp-blocked.exception.d.ts +9 -0
- package/src/gg-auth/exceptions/user-otp-blocked.exception.js +17 -0
- package/src/gg-auth/exceptions/user-otp-blocked.exception.js.map +1 -0
- package/src/gg-auth/exceptions/user-password-blocked.exception.d.ts +9 -0
- package/src/gg-auth/exceptions/user-password-blocked.exception.js +17 -0
- package/src/gg-auth/exceptions/user-password-blocked.exception.js.map +1 -0
- package/src/gg-auth/exceptions/user-password-recovery-blocked.exception.d.ts +9 -0
- package/src/gg-auth/exceptions/user-password-recovery-blocked.exception.js +17 -0
- package/src/gg-auth/exceptions/user-password-recovery-blocked.exception.js.map +1 -0
- package/src/gg-auth/gg-auth.module-options.d.ts +41 -0
- package/src/gg-auth/gg-auth.module-options.js +16 -0
- package/src/gg-auth/gg-auth.module-options.js.map +1 -0
- package/src/gg-auth/gg-auth.module.d.ts +5 -0
- package/src/gg-auth/gg-auth.module.js +68 -0
- package/src/gg-auth/gg-auth.module.js.map +1 -0
- package/src/gg-auth/guards/auth.guard.d.ts +69 -0
- package/src/gg-auth/guards/auth.guard.js +175 -0
- package/src/gg-auth/guards/auth.guard.js.map +1 -0
- package/src/gg-auth/index.d.ts +8 -0
- package/src/gg-auth/index.js +13 -0
- package/src/gg-auth/index.js.map +1 -0
- package/src/gg-auth/injectable-proxy/authorized-merchant.d.ts +10 -0
- package/src/gg-auth/injectable-proxy/authorized-merchant.js +28 -0
- package/src/gg-auth/injectable-proxy/authorized-merchant.js.map +1 -0
- package/src/gg-auth/injectable-proxy/authorized-user.d.ts +24 -0
- package/src/gg-auth/injectable-proxy/authorized-user.js +56 -0
- package/src/gg-auth/injectable-proxy/authorized-user.js.map +1 -0
- package/src/gg-auth/interfaces/authorized.interface.d.ts +5 -0
- package/src/gg-auth/interfaces/authorized.interface.js +3 -0
- package/src/gg-auth/interfaces/authorized.interface.js.map +1 -0
- package/src/gg-auth/services/auth-service.interface.d.ts +4 -0
- package/src/gg-auth/services/auth-service.interface.js +3 -0
- package/src/gg-auth/services/auth-service.interface.js.map +1 -0
- package/src/gg-auth/services/gg-bearer-auth.service.d.ts +39 -0
- package/src/gg-auth/services/gg-bearer-auth.service.js +84 -0
- package/src/gg-auth/services/gg-bearer-auth.service.js.map +1 -0
- package/src/gg-auth/services/gg-merchant-auth.service.d.ts +8 -0
- package/src/gg-auth/services/gg-merchant-auth.service.js +24 -0
- package/src/gg-auth/services/gg-merchant-auth.service.js.map +1 -0
- package/src/gg-auth/utils/get-rpc-user.util.d.ts +3 -0
- package/src/gg-auth/utils/get-rpc-user.util.js +14 -0
- package/src/gg-auth/utils/get-rpc-user.util.js.map +1 -0
- package/src/gg-cache/gg-cache.module.d.ts +4 -0
- package/src/gg-cache/gg-cache.module.js +55 -0
- package/src/gg-cache/gg-cache.module.js.map +1 -0
- package/src/gg-cache/gg-cache.service.d.ts +23 -0
- package/src/gg-cache/gg-cache.service.js +58 -0
- package/src/gg-cache/gg-cache.service.js.map +1 -0
- package/src/gg-cache/index.d.ts +2 -0
- package/src/gg-cache/index.js +6 -0
- package/src/gg-cache/index.js.map +1 -0
- package/src/gg-cache/redis.config.d.ts +6 -0
- package/src/gg-cache/redis.config.js +23 -0
- package/src/gg-cache/redis.config.js.map +1 -0
- package/src/gg-cls/gg-cls.module.d.ts +4 -0
- package/src/gg-cls/gg-cls.module.js +54 -0
- package/src/gg-cls/gg-cls.module.js.map +1 -0
- package/src/gg-cls/index.d.ts +1 -0
- package/src/gg-cls/index.js +5 -0
- package/src/gg-cls/index.js.map +1 -0
- package/src/gg-config/app.config.d.ts +16 -0
- package/src/gg-config/app.config.js +78 -0
- package/src/gg-config/app.config.js.map +1 -0
- package/src/gg-config/gg-config.module-options.d.ts +4 -0
- package/src/gg-config/gg-config.module-options.js +3 -0
- package/src/gg-config/gg-config.module-options.js.map +1 -0
- package/src/gg-config/gg-config.module.d.ts +5 -0
- package/src/gg-config/gg-config.module.js +22 -0
- package/src/gg-config/gg-config.module.js.map +1 -0
- package/src/gg-config/index.d.ts +3 -0
- package/src/gg-config/index.js +7 -0
- package/src/gg-config/index.js.map +1 -0
- package/src/gg-config/validate-config.d.ts +2 -0
- package/src/gg-config/validate-config.js +31 -0
- package/src/gg-config/validate-config.js.map +1 -0
- package/src/gg-core/gg-core-module-options.d.ts +12 -0
- package/src/gg-core/gg-core-module-options.js +3 -0
- package/src/gg-core/gg-core-module-options.js.map +1 -0
- package/src/gg-core/gg-core.middleware.d.ts +8 -0
- package/src/gg-core/gg-core.middleware.js +31 -0
- package/src/gg-core/gg-core.middleware.js.map +1 -0
- package/src/gg-core/gg-core.module.d.ts +9 -0
- package/src/gg-core/gg-core.module.js +58 -0
- package/src/gg-core/gg-core.module.js.map +1 -0
- package/src/gg-core/index.d.ts +2 -0
- package/src/gg-core/index.js +6 -0
- package/src/gg-core/index.js.map +1 -0
- package/src/gg-database/config/db-entities.config.d.ts +5 -0
- package/src/gg-database/config/db-entities.config.js +7 -0
- package/src/gg-database/config/db-entities.config.js.map +1 -0
- package/src/gg-database/config/mikroorm.config.d.ts +9 -0
- package/src/gg-database/config/mikroorm.config.js +38 -0
- package/src/gg-database/config/mikroorm.config.js.map +1 -0
- package/src/gg-database/database.adapter.d.ts +24 -0
- package/src/gg-database/database.adapter.js +50 -0
- package/src/gg-database/database.adapter.js.map +1 -0
- package/src/gg-database/database.connector.d.ts +27 -0
- package/src/gg-database/database.connector.js +54 -0
- package/src/gg-database/database.connector.js.map +1 -0
- package/src/gg-database/index.d.ts +3 -0
- package/src/gg-database/index.js +7 -0
- package/src/gg-database/index.js.map +1 -0
- package/src/gg-database/modules/mikroorm.module.d.ts +37 -0
- package/src/gg-database/modules/mikroorm.module.js +111 -0
- package/src/gg-database/modules/mikroorm.module.js.map +1 -0
- package/src/gg-errors/exception.domain-codes.d.ts +12 -0
- package/src/gg-errors/exception.domain-codes.js +17 -0
- package/src/gg-errors/exception.domain-codes.js.map +1 -0
- package/src/gg-errors/exceptions/gg.exception.d.ts +12 -0
- package/src/gg-errors/exceptions/gg.exception.js +27 -0
- package/src/gg-errors/exceptions/gg.exception.js.map +1 -0
- package/src/gg-errors/gcp-error-event.interface.d.ts +18 -0
- package/src/gg-errors/gcp-error-event.interface.js +3 -0
- package/src/gg-errors/gcp-error-event.interface.js.map +1 -0
- package/src/gg-errors/gcp-error-reporting.service.d.ts +11 -0
- package/src/gg-errors/gcp-error-reporting.service.js +71 -0
- package/src/gg-errors/gcp-error-reporting.service.js.map +1 -0
- package/src/gg-errors/gg-errors-exception.filter.d.ts +9 -0
- package/src/gg-errors/gg-errors-exception.filter.js +26 -0
- package/src/gg-errors/gg-errors-exception.filter.js.map +1 -0
- package/src/gg-errors/gg-errors.module-options.d.ts +8 -0
- package/src/gg-errors/gg-errors.module-options.js +5 -0
- package/src/gg-errors/gg-errors.module-options.js.map +1 -0
- package/src/gg-errors/gg-errors.module.d.ts +5 -0
- package/src/gg-errors/gg-errors.module.js +35 -0
- package/src/gg-errors/gg-errors.module.js.map +1 -0
- package/src/gg-errors/gg-exception.service.d.ts +50 -0
- package/src/gg-errors/gg-exception.service.js +213 -0
- package/src/gg-errors/gg-exception.service.js.map +1 -0
- package/src/gg-errors/index.d.ts +1 -0
- package/src/gg-errors/index.js +5 -0
- package/src/gg-errors/index.js.map +1 -0
- package/src/gg-gcp/gcp-trace-and-profiler.d.ts +1 -0
- package/src/gg-gcp/gcp-trace-and-profiler.js +52 -0
- package/src/gg-gcp/gcp-trace-and-profiler.js.map +1 -0
- package/src/gg-gcp/index.d.ts +1 -0
- package/src/gg-gcp/index.js +5 -0
- package/src/gg-gcp/index.js.map +1 -0
- package/src/gg-healthchecks/gg-healthchecks.controller.d.ts +7 -0
- package/src/gg-healthchecks/gg-healthchecks.controller.js +31 -0
- package/src/gg-healthchecks/gg-healthchecks.controller.js.map +1 -0
- package/src/gg-healthchecks/gg-healthchecks.module.d.ts +4 -0
- package/src/gg-healthchecks/gg-healthchecks.module.js +17 -0
- package/src/gg-healthchecks/gg-healthchecks.module.js.map +1 -0
- package/src/gg-kernel/index.d.ts +2 -0
- package/src/gg-kernel/index.js +6 -0
- package/src/gg-kernel/index.js.map +1 -0
- package/src/gg-kernel/kernel.d.ts +36 -0
- package/src/gg-kernel/kernel.js +86 -0
- package/src/gg-kernel/kernel.js.map +1 -0
- package/src/gg-kernel/service-providers/base-service-provider.d.ts +15 -0
- package/src/gg-kernel/service-providers/base-service-provider.js +25 -0
- package/src/gg-kernel/service-providers/base-service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/global-prefix.service-provider.d.ts +4 -0
- package/src/gg-kernel/service-providers/global-prefix.service-provider.js +17 -0
- package/src/gg-kernel/service-providers/global-prefix.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/helmet.service-provider.d.ts +4 -0
- package/src/gg-kernel/service-providers/helmet.service-provider.js +12 -0
- package/src/gg-kernel/service-providers/helmet.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/index.d.ts +8 -0
- package/src/gg-kernel/service-providers/index.js +12 -0
- package/src/gg-kernel/service-providers/index.js.map +1 -0
- package/src/gg-kernel/service-providers/logger.service-provider.d.ts +8 -0
- package/src/gg-kernel/service-providers/logger.service-provider.js +20 -0
- package/src/gg-kernel/service-providers/logger.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/shutdown-hooks.service-provider.d.ts +7 -0
- package/src/gg-kernel/service-providers/shutdown-hooks.service-provider.js +14 -0
- package/src/gg-kernel/service-providers/shutdown-hooks.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/swagger.service-provider.d.ts +13 -0
- package/src/gg-kernel/service-providers/swagger.service-provider.js +35 -0
- package/src/gg-kernel/service-providers/swagger.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/validation.service-provider.d.ts +10 -0
- package/src/gg-kernel/service-providers/validation.service-provider.js +22 -0
- package/src/gg-kernel/service-providers/validation.service-provider.js.map +1 -0
- package/src/gg-kernel/service-providers/versioning.service-provider.d.ts +10 -0
- package/src/gg-kernel/service-providers/versioning.service-provider.js +17 -0
- package/src/gg-kernel/service-providers/versioning.service-provider.js.map +1 -0
- package/src/gg-logger/gg-logger.module.d.ts +4 -0
- package/src/gg-logger/gg-logger.module.js +48 -0
- package/src/gg-logger/gg-logger.module.js.map +1 -0
- package/src/gg-metrics/gg-metrics.controller.d.ts +3 -0
- package/src/gg-metrics/gg-metrics.controller.js +15 -0
- package/src/gg-metrics/gg-metrics.controller.js.map +1 -0
- package/src/gg-metrics/gg-metrics.module.d.ts +4 -0
- package/src/gg-metrics/gg-metrics.module.js +31 -0
- package/src/gg-metrics/gg-metrics.module.js.map +1 -0
- package/src/gg-metrics/index.d.ts +1 -0
- package/src/gg-metrics/index.js +5 -0
- package/src/gg-metrics/index.js.map +1 -0
- package/src/gg-micro/gg-micro.module.d.ts +5 -0
- package/src/gg-micro/gg-micro.module.js +62 -0
- package/src/gg-micro/gg-micro.module.js.map +1 -0
- package/src/gg-micro/gg-rmq-service.injector.d.ts +19 -0
- package/src/gg-micro/gg-rmq-service.injector.js +29 -0
- package/src/gg-micro/gg-rmq-service.injector.js.map +1 -0
- package/src/gg-micro/gg-rmq.configurator.d.ts +16 -0
- package/src/gg-micro/gg-rmq.configurator.js +34 -0
- package/src/gg-micro/gg-rmq.configurator.js.map +1 -0
- package/src/gg-micro/index.d.ts +4 -0
- package/src/gg-micro/index.js +8 -0
- package/src/gg-micro/index.js.map +1 -0
- package/src/gg-micro/micro.client.d.ts +62 -0
- package/src/gg-micro/micro.client.js +101 -0
- package/src/gg-micro/micro.client.js.map +1 -0
- package/src/gg-micro/rmq.config.d.ts +10 -0
- package/src/gg-micro/rmq.config.js +50 -0
- package/src/gg-micro/rmq.config.js.map +1 -0
- package/src/gg-micro/rmq.connector.d.ts +12 -0
- package/src/gg-micro/rmq.connector.js +25 -0
- package/src/gg-micro/rmq.connector.js.map +1 -0
- package/src/gg-micro/rmq.queue-map.d.ts +2 -0
- package/src/gg-micro/rmq.queue-map.js +24 -0
- package/src/gg-micro/rmq.queue-map.js.map +1 -0
- package/src/gg-throttler/gg-throttler.module-options.d.ts +4 -0
- package/src/gg-throttler/gg-throttler.module-options.js +3 -0
- package/src/gg-throttler/gg-throttler.module-options.js.map +1 -0
- package/src/gg-throttler/gg-throttler.module.d.ts +5 -0
- package/src/gg-throttler/gg-throttler.module.js +24 -0
- package/src/gg-throttler/gg-throttler.module.js.map +1 -0
- package/src/gg-throttler/throttler.guard.d.ts +13 -0
- package/src/gg-throttler/throttler.guard.js +28 -0
- package/src/gg-throttler/throttler.guard.js.map +1 -0
- package/src/index.d.ts +10 -0
- package/src/index.js +14 -0
- package/src/index.js.map +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ConfigType } from '@nestjs/config';
|
|
2
|
+
import { RmqOptions } from '@nestjs/microservices/interfaces/microservice-configuration.interface';
|
|
3
|
+
import { ClientProviderOptions } from '@nestjs/microservices/module/interfaces/clients-module.interface';
|
|
4
|
+
import { GgMicroService } from './gg-rmq-service.injector';
|
|
5
|
+
import { rmqConfig } from './rmq.config';
|
|
6
|
+
export declare class GgRmqConfigurator {
|
|
7
|
+
private readonly service;
|
|
8
|
+
private readonly config;
|
|
9
|
+
constructor(service: GgMicroService, config: ConfigType<typeof rmqConfig>);
|
|
10
|
+
getQueue(): "gg-events-micro" | "gg-wallets-micro" | "gg-rolling-reserve-micro" | "gg-payments-micro" | "gg-payment-providers-micro" | "gg-users-micro" | "gg-antifraud-micro" | "gg-admin-micro" | "gg-notifications-micro" | "gg-scheduler-micro" | "gg-example-micro" | "gg-transfers-micro" | "gg-loyalty-micro";
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated - microservice client now registers with MicroModule.forFeature(serviceName)
|
|
13
|
+
*/
|
|
14
|
+
getClientOptions(): ClientProviderOptions;
|
|
15
|
+
getServerOptions(): RmqOptions;
|
|
16
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GgRmqConfigurator = void 0;
|
|
4
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
5
|
+
const rmq_queue_map_1 = require("./rmq.queue-map");
|
|
6
|
+
class GgRmqConfigurator {
|
|
7
|
+
constructor(service, config) {
|
|
8
|
+
this.service = service;
|
|
9
|
+
this.config = config;
|
|
10
|
+
}
|
|
11
|
+
getQueue() {
|
|
12
|
+
return (0, rmq_queue_map_1.rmqQueueMap)(this.service);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated - microservice client now registers with MicroModule.forFeature(serviceName)
|
|
16
|
+
*/
|
|
17
|
+
getClientOptions() {
|
|
18
|
+
return {
|
|
19
|
+
transport: microservices_1.Transport.RMQ,
|
|
20
|
+
name: this.service,
|
|
21
|
+
options: {
|
|
22
|
+
persistent: true,
|
|
23
|
+
queueOptions: { durable: true },
|
|
24
|
+
urls: [this.config.urlWithAuth],
|
|
25
|
+
queue: (0, rmq_queue_map_1.rmqQueueMap)(this.service),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
getServerOptions() {
|
|
30
|
+
return { transport: microservices_1.Transport.RMQ, options: { urls: [this.config.urlWithAuth], queue: this.getQueue() } };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.GgRmqConfigurator = GgRmqConfigurator;
|
|
34
|
+
//# sourceMappingURL=gg-rmq.configurator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gg-rmq.configurator.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-micro/gg-rmq.configurator.ts"],"names":[],"mappings":";;;AACA,yDAAkD;AAKlD,mDAA8C;AAE9C,MAAa,iBAAiB;IAC5B,YACmB,OAAuB,EACvB,MAAoC;QADpC,YAAO,GAAP,OAAO,CAAgB;QACvB,WAAM,GAAN,MAAM,CAA8B;IACpD,CAAC;IAEG,QAAQ;QACb,OAAO,IAAA,2BAAW,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO;YACL,SAAS,EAAE,yBAAS,CAAC,GAAG;YACxB,IAAI,EAAE,IAAI,CAAC,OAAO;YAClB,OAAO,EAAE;gBACP,UAAU,EAAE,IAAI;gBAChB,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;gBAC/B,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;gBAC/B,KAAK,EAAE,IAAA,2BAAW,EAAC,IAAI,CAAC,OAAO,CAAC;aACjC;SACF,CAAC;IACJ,CAAC;IAEM,gBAAgB;QACrB,OAAO,EAAE,SAAS,EAAE,yBAAS,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC5G,CAAC;CACF;AA7BD,8CA6BC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./gg-rmq-service.injector"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./gg-rmq.configurator"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./micro.client"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./rmq.config"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-micro/index.ts"],"names":[],"mappings":";;;AAAA,oEAA0C;AAC1C,gEAAsC;AACtC,yDAA+B;AAC/B,uDAA6B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { MetaDto } from '@zorionapp/gg-toolkit/dto';
|
|
2
|
+
import { RmqCommand, RmqEvent } from '@zorionapp/gg-toolkit/microservices';
|
|
3
|
+
import { ClientProxy, RmqRecord } from '@nestjs/microservices';
|
|
4
|
+
import { Duration } from 'luxon';
|
|
5
|
+
import { ClsService } from 'nestjs-cls';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { AuthorizedUser } from '../gg-auth';
|
|
8
|
+
export type RmqServiceOptions = {
|
|
9
|
+
priority?: number;
|
|
10
|
+
timeout?: Duration;
|
|
11
|
+
customHeaders?: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
export type ServiceRes<Res> = {
|
|
14
|
+
data: Res;
|
|
15
|
+
meta: MetaDto | null;
|
|
16
|
+
};
|
|
17
|
+
export declare class MicroClient {
|
|
18
|
+
private readonly clientProxy;
|
|
19
|
+
private readonly name;
|
|
20
|
+
private readonly clsService;
|
|
21
|
+
private readonly user?;
|
|
22
|
+
private readonly logger;
|
|
23
|
+
private readonly defaultOptions;
|
|
24
|
+
constructor(clientProxy: ClientProxy, name: string, clsService: ClsService, user?: AuthorizedUser);
|
|
25
|
+
/**
|
|
26
|
+
* Send command to RMQ
|
|
27
|
+
*
|
|
28
|
+
* @param command
|
|
29
|
+
* @param options
|
|
30
|
+
*/
|
|
31
|
+
send<Req, Res>(command: RmqCommand<Req, Res>, options?: RmqServiceOptions): Observable<ServiceRes<Res>>;
|
|
32
|
+
/**
|
|
33
|
+
* Emit RMQ event
|
|
34
|
+
*
|
|
35
|
+
* @param event
|
|
36
|
+
* @param options
|
|
37
|
+
*/
|
|
38
|
+
emit<T>(event: RmqEvent<T>, options?: RmqServiceOptions): Observable<undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* Wrap plain data to Rmq Record with request id and user included
|
|
41
|
+
*
|
|
42
|
+
* @protected
|
|
43
|
+
* @param command
|
|
44
|
+
* @param priority
|
|
45
|
+
* @param customHeaders
|
|
46
|
+
*/
|
|
47
|
+
protected toRmqRecord<T, R = Record<string, unknown>>(command: RmqCommand<T, R> | RmqEvent<T>, priority?: number, customHeaders?: Record<string, string>): RmqRecord<T>;
|
|
48
|
+
/**
|
|
49
|
+
* Merge default options with provided options
|
|
50
|
+
*
|
|
51
|
+
* @param options
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
private mergeWithDefaultOptions;
|
|
55
|
+
/**
|
|
56
|
+
* Get command/event name from class
|
|
57
|
+
*
|
|
58
|
+
* @param command
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
private getPattern;
|
|
62
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MicroClient = void 0;
|
|
4
|
+
const dto_1 = require("@zorionapp/gg-toolkit/dto");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
7
|
+
const class_transformer_1 = require("class-transformer");
|
|
8
|
+
const lodash_1 = require("lodash");
|
|
9
|
+
const luxon_1 = require("luxon");
|
|
10
|
+
const rxjs_1 = require("rxjs");
|
|
11
|
+
class MicroClient {
|
|
12
|
+
constructor(clientProxy, name, clsService, user) {
|
|
13
|
+
this.clientProxy = clientProxy;
|
|
14
|
+
this.name = name;
|
|
15
|
+
this.clsService = clsService;
|
|
16
|
+
this.user = user;
|
|
17
|
+
this.logger = new common_1.Logger(MicroClient.name);
|
|
18
|
+
this.defaultOptions = { priority: 3, timeout: luxon_1.Duration.fromObject({ seconds: 30 }) };
|
|
19
|
+
this.logger = new common_1.Logger(`${MicroClient.name}:${this.name}`);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Send command to RMQ
|
|
23
|
+
*
|
|
24
|
+
* @param command
|
|
25
|
+
* @param options
|
|
26
|
+
*/
|
|
27
|
+
send(command, options) {
|
|
28
|
+
options = this.mergeWithDefaultOptions(options);
|
|
29
|
+
const pattern = this.getPattern(command);
|
|
30
|
+
const $ = this.clientProxy
|
|
31
|
+
.send(pattern, this.toRmqRecord(command, options.priority, options.customHeaders))
|
|
32
|
+
.pipe((0, rxjs_1.tap)((data) => this.logger.log({ msg: 'RMQ command sent', pattern, command, data })), (0, rxjs_1.timeout)(options.timeout.as('milliseconds')), (0, rxjs_1.catchError)((e) => {
|
|
33
|
+
this.logger.error({ msg: 'RMQ command error', pattern, payload: command, error: e });
|
|
34
|
+
return (0, rxjs_1.throwError)(() => e);
|
|
35
|
+
}));
|
|
36
|
+
return command.mapClass
|
|
37
|
+
? $.pipe((0, rxjs_1.map)((value) => {
|
|
38
|
+
/** extract data and meta from response for pagination responses */
|
|
39
|
+
const data = (0, lodash_1.get)(value, 'data', {});
|
|
40
|
+
const meta = (0, lodash_1.get)(value, 'meta', null);
|
|
41
|
+
/** if data or meta is not present, return plain value (for backward compatibility) */
|
|
42
|
+
if (!data)
|
|
43
|
+
return (0, class_transformer_1.plainToInstance)(command.mapClass, value);
|
|
44
|
+
return {
|
|
45
|
+
data: (0, class_transformer_1.plainToInstance)(command.mapClass, data),
|
|
46
|
+
meta: meta ? (0, class_transformer_1.plainToInstance)(dto_1.MetaDto, meta) : null,
|
|
47
|
+
};
|
|
48
|
+
}))
|
|
49
|
+
: $;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Emit RMQ event
|
|
53
|
+
*
|
|
54
|
+
* @param event
|
|
55
|
+
* @param options
|
|
56
|
+
*/
|
|
57
|
+
emit(event, options) {
|
|
58
|
+
options = this.mergeWithDefaultOptions(options);
|
|
59
|
+
const pattern = event.constructor.pattern;
|
|
60
|
+
return this.clientProxy.emit(pattern, event.data).pipe((0, rxjs_1.tap)((data) => this.logger.log({ msg: 'RMQ event sent', pattern, event, data })), (0, rxjs_1.timeout)(options.timeout.as('milliseconds')), (0, rxjs_1.catchError)((e) => {
|
|
61
|
+
this.logger.error({ msg: 'RMQ event error', pattern, payload: event, error: e });
|
|
62
|
+
return (0, rxjs_1.throwError)(() => e);
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Wrap plain data to Rmq Record with request id and user included
|
|
67
|
+
*
|
|
68
|
+
* @protected
|
|
69
|
+
* @param command
|
|
70
|
+
* @param priority
|
|
71
|
+
* @param customHeaders
|
|
72
|
+
*/
|
|
73
|
+
toRmqRecord(command, priority = 3, customHeaders = {}) {
|
|
74
|
+
return new microservices_1.RmqRecordBuilder(command.data)
|
|
75
|
+
.setOptions({
|
|
76
|
+
headers: { 'request-id': this.clsService.getId(), user: JSON.stringify(this.user?.dto), ...customHeaders },
|
|
77
|
+
priority,
|
|
78
|
+
})
|
|
79
|
+
.build();
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Merge default options with provided options
|
|
83
|
+
*
|
|
84
|
+
* @param options
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
mergeWithDefaultOptions(options) {
|
|
88
|
+
return { ...this.defaultOptions, ...options };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get command/event name from class
|
|
92
|
+
*
|
|
93
|
+
* @param command
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
96
|
+
getPattern(command) {
|
|
97
|
+
return command.constructor.pattern;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.MicroClient = MicroClient;
|
|
101
|
+
//# sourceMappingURL=micro.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"micro.client.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-micro/micro.client.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare class RmqConfig {
|
|
2
|
+
readonly host: string;
|
|
3
|
+
readonly port: number;
|
|
4
|
+
readonly username: string;
|
|
5
|
+
readonly password: string;
|
|
6
|
+
readonly vHost: string;
|
|
7
|
+
get urlWithAuth(): string;
|
|
8
|
+
}
|
|
9
|
+
export declare const rmqConfig: (() => Promise<RmqConfig>) & import("@nestjs/config").ConfigFactoryKeyHost<Promise<RmqConfig>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rmqConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const class_validator_1 = require("class-validator");
|
|
6
|
+
const gg_config_1 = require("../gg-config");
|
|
7
|
+
class RmqConfig {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.host = process.env['RMQ_HOST'];
|
|
10
|
+
this.port = Number(process.env['RMQ_PORT']);
|
|
11
|
+
this.username = process.env['RMQ_USERNAME'];
|
|
12
|
+
this.password = process.env['RMQ_PASSWORD'];
|
|
13
|
+
this.vHost = process.env['RMQ_EVENTS_VHOST'];
|
|
14
|
+
}
|
|
15
|
+
get urlWithAuth() {
|
|
16
|
+
return `amqp://${this.username}:${this.password}@${this.host}:${this.port}/${this.vHost}`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
tslib_1.__decorate([
|
|
20
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
tslib_1.__metadata("design:type", Object)
|
|
23
|
+
], RmqConfig.prototype, "host", void 0);
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
26
|
+
(0, class_validator_1.IsNumber)(),
|
|
27
|
+
tslib_1.__metadata("design:type", Object)
|
|
28
|
+
], RmqConfig.prototype, "port", void 0);
|
|
29
|
+
tslib_1.__decorate([
|
|
30
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
31
|
+
(0, class_validator_1.IsString)(),
|
|
32
|
+
tslib_1.__metadata("design:type", Object)
|
|
33
|
+
], RmqConfig.prototype, "username", void 0);
|
|
34
|
+
tslib_1.__decorate([
|
|
35
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
36
|
+
(0, class_validator_1.IsString)(),
|
|
37
|
+
tslib_1.__metadata("design:type", Object)
|
|
38
|
+
], RmqConfig.prototype, "password", void 0);
|
|
39
|
+
tslib_1.__decorate([
|
|
40
|
+
(0, class_validator_1.IsOptional)(),
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
tslib_1.__metadata("design:type", Object)
|
|
43
|
+
], RmqConfig.prototype, "vHost", void 0);
|
|
44
|
+
tslib_1.__decorate([
|
|
45
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
46
|
+
tslib_1.__metadata("design:type", Object),
|
|
47
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
48
|
+
], RmqConfig.prototype, "urlWithAuth", null);
|
|
49
|
+
exports.rmqConfig = (0, gg_config_1.registerConfig)(RmqConfig);
|
|
50
|
+
//# sourceMappingURL=rmq.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rmq.config.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-micro/rmq.config.ts"],"names":[],"mappings":";;;;AAAA,qDAA6E;AAE7E,4CAA8C;AAE9C,MAAM,SAAS;IAAf;QAGkB,SAAI,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAI/B,SAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;QAIvC,aAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAIvC,aAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAIvC,UAAK,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAM1D,CAAC;IAJC,IACW,WAAW;QACpB,OAAO,UAAU,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;IAC5F,CAAC;CACF;AAtBiB;IAFf,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;uCACoC;AAI/B;IAFf,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;uCAC4C;AAIvC;IAFf,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;2CAC4C;AAIvC;IAFf,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;2CAC4C;AAIvC;IAFf,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;wCAC6C;AAExD;IAAC,IAAA,4BAAU,GAAE;;;4CAGZ;AAGU,QAAA,SAAS,GAAG,IAAA,0BAAc,EAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OnApplicationBootstrap, OnApplicationShutdown } from '@nestjs/common';
|
|
2
|
+
import { ClientProxy } from '@nestjs/microservices';
|
|
3
|
+
import { GgMicroService } from './gg-rmq-service.injector';
|
|
4
|
+
export declare class RmqConnector implements OnApplicationBootstrap, OnApplicationShutdown {
|
|
5
|
+
private readonly proxy;
|
|
6
|
+
private readonly name;
|
|
7
|
+
private logger;
|
|
8
|
+
constructor(proxy: ClientProxy, name: GgMicroService);
|
|
9
|
+
onApplicationBootstrap(): Promise<void>;
|
|
10
|
+
onApplicationShutdown(): any;
|
|
11
|
+
protected connectProxy(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RmqConnector = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
class RmqConnector {
|
|
6
|
+
constructor(proxy, name) {
|
|
7
|
+
this.proxy = proxy;
|
|
8
|
+
this.name = name;
|
|
9
|
+
this.logger = new common_1.Logger(`${RmqConnector.name}:${name}`);
|
|
10
|
+
}
|
|
11
|
+
onApplicationBootstrap() {
|
|
12
|
+
return this.connectProxy();
|
|
13
|
+
}
|
|
14
|
+
onApplicationShutdown() {
|
|
15
|
+
this.logger.log({ msg: 'Closing RMQ proxy...', name: this.name });
|
|
16
|
+
return this.proxy.close();
|
|
17
|
+
}
|
|
18
|
+
async connectProxy() {
|
|
19
|
+
this.logger.log({ msg: 'PreConnecting RMQ proxy', name: this.name });
|
|
20
|
+
await this.proxy.connect();
|
|
21
|
+
this.logger.log({ msg: 'RMQ Proxy connected', name: this.name });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.RmqConnector = RmqConnector;
|
|
25
|
+
//# sourceMappingURL=rmq.connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rmq.connector.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-micro/rmq.connector.ts"],"names":[],"mappings":";;;AAAA,2CAAuF;AAKvF,MAAa,YAAY;IAGvB,YACmB,KAAkB,EAClB,IAAoB;QADpB,UAAK,GAAL,KAAK,CAAa;QAClB,SAAI,GAAJ,IAAI,CAAgB;QAErC,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,GAAG,YAAY,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAEM,sBAAsB;QAC3B,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;IAC7B,CAAC;IAEM,qBAAqB;QAC1B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,sBAAsB,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAElE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAES,KAAK,CAAC,YAAY;QAC1B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAErE,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QAE3B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,qBAAqB,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;CACF;AA3BD,oCA2BC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { GgMicroService } from './gg-rmq-service.injector';
|
|
2
|
+
export declare const rmqQueueMap: (service: GgMicroService) => "gg-events-micro" | "gg-wallets-micro" | "gg-rolling-reserve-micro" | "gg-payments-micro" | "gg-payment-providers-micro" | "gg-users-micro" | "gg-antifraud-micro" | "gg-admin-micro" | "gg-notifications-micro" | "gg-scheduler-micro" | "gg-example-micro" | "gg-transfers-micro" | "gg-loyalty-micro";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rmqQueueMap = void 0;
|
|
4
|
+
const gg_rmq_service_injector_1 = require("./gg-rmq-service.injector");
|
|
5
|
+
const rmqQueueMap = (service) => {
|
|
6
|
+
const serviceMap = {
|
|
7
|
+
[gg_rmq_service_injector_1.GgMicroService.Events]: 'gg-events-micro',
|
|
8
|
+
[gg_rmq_service_injector_1.GgMicroService.Wallets]: 'gg-wallets-micro',
|
|
9
|
+
[gg_rmq_service_injector_1.GgMicroService.RollingReserve]: 'gg-rolling-reserve-micro',
|
|
10
|
+
[gg_rmq_service_injector_1.GgMicroService.Payments]: 'gg-payments-micro',
|
|
11
|
+
[gg_rmq_service_injector_1.GgMicroService.PaymentProviders]: 'gg-payment-providers-micro',
|
|
12
|
+
[gg_rmq_service_injector_1.GgMicroService.Users]: 'gg-users-micro',
|
|
13
|
+
[gg_rmq_service_injector_1.GgMicroService.Antifraud]: 'gg-antifraud-micro',
|
|
14
|
+
[gg_rmq_service_injector_1.GgMicroService.Admin]: 'gg-admin-micro',
|
|
15
|
+
[gg_rmq_service_injector_1.GgMicroService.Notifications]: 'gg-notifications-micro',
|
|
16
|
+
[gg_rmq_service_injector_1.GgMicroService.Scheduler]: 'gg-scheduler-micro',
|
|
17
|
+
[gg_rmq_service_injector_1.GgMicroService.Example]: 'gg-example-micro',
|
|
18
|
+
[gg_rmq_service_injector_1.GgMicroService.Transfers]: 'gg-transfers-micro',
|
|
19
|
+
[gg_rmq_service_injector_1.GgMicroService.Loyalty]: 'gg-loyalty-micro',
|
|
20
|
+
};
|
|
21
|
+
return serviceMap[service];
|
|
22
|
+
};
|
|
23
|
+
exports.rmqQueueMap = rmqQueueMap;
|
|
24
|
+
//# sourceMappingURL=rmq.queue-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rmq.queue-map.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-micro/rmq.queue-map.ts"],"names":[],"mappings":";;;AAAA,uEAA2D;AAEpD,MAAM,WAAW,GAAG,CAAC,OAAuB,EAAE,EAAE;IACrD,MAAM,UAAU,GAAG;QACjB,CAAC,wCAAc,CAAC,MAAM,CAAC,EAAE,iBAAiB;QAC1C,CAAC,wCAAc,CAAC,OAAO,CAAC,EAAE,kBAAkB;QAC5C,CAAC,wCAAc,CAAC,cAAc,CAAC,EAAE,0BAA0B;QAC3D,CAAC,wCAAc,CAAC,QAAQ,CAAC,EAAE,mBAAmB;QAC9C,CAAC,wCAAc,CAAC,gBAAgB,CAAC,EAAE,4BAA4B;QAC/D,CAAC,wCAAc,CAAC,KAAK,CAAC,EAAE,gBAAgB;QACxC,CAAC,wCAAc,CAAC,SAAS,CAAC,EAAE,oBAAoB;QAChD,CAAC,wCAAc,CAAC,KAAK,CAAC,EAAE,gBAAgB;QACxC,CAAC,wCAAc,CAAC,aAAa,CAAC,EAAE,wBAAwB;QACxD,CAAC,wCAAc,CAAC,SAAS,CAAC,EAAE,oBAAoB;QAChD,CAAC,wCAAc,CAAC,OAAO,CAAC,EAAE,kBAAkB;QAC5C,CAAC,wCAAc,CAAC,SAAS,CAAC,EAAE,oBAAoB;QAChD,CAAC,wCAAc,CAAC,OAAO,CAAC,EAAE,kBAAkB;KACpC,CAAC;IAEX,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC,CAAC;AAlBW,QAAA,WAAW,eAkBtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gg-throttler.module-options.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-throttler/gg-throttler.module-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var GgThrottlerModule_1;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GgThrottlerModule = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
const core_1 = require("@nestjs/core");
|
|
8
|
+
const throttler_1 = require("@nestjs/throttler");
|
|
9
|
+
const throttler_guard_1 = require("./throttler.guard");
|
|
10
|
+
let GgThrottlerModule = GgThrottlerModule_1 = class GgThrottlerModule {
|
|
11
|
+
static forRoot(options = { ttl: 60, limit: 60 }) {
|
|
12
|
+
return {
|
|
13
|
+
global: true,
|
|
14
|
+
module: GgThrottlerModule_1,
|
|
15
|
+
imports: [throttler_1.ThrottlerModule.forRoot({ throttlers: [{ ttl: options.ttl, limit: options.limit }] })],
|
|
16
|
+
providers: [{ provide: core_1.APP_GUARD, useClass: throttler_guard_1.ThrottlerGuard }],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.GgThrottlerModule = GgThrottlerModule;
|
|
21
|
+
exports.GgThrottlerModule = GgThrottlerModule = GgThrottlerModule_1 = tslib_1.__decorate([
|
|
22
|
+
(0, common_1.Module)({})
|
|
23
|
+
], GgThrottlerModule);
|
|
24
|
+
//# sourceMappingURL=gg-throttler.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gg-throttler.module.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-throttler/gg-throttler.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,uCAAyC;AACzC,iDAAoD;AAEpD,uDAAmD;AAG5C,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IACrB,MAAM,CAAC,OAAO,CAAC,UAAoC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAC9E,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,mBAAiB;YACzB,OAAO,EAAE,CAAC,2BAAe,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;YAChG,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAS,EAAE,QAAQ,EAAE,gCAAc,EAAE,CAAC;SAC9D,CAAC;IACJ,CAAC;CACF,CAAA;AATY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,iBAAiB,CAS7B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Reflector } from '@nestjs/core';
|
|
2
|
+
import { ThrottlerGuard as BaseThrottlerGuard } from '@nestjs/throttler';
|
|
3
|
+
import { ThrottlerModuleOptions } from '@nestjs/throttler/dist/throttler-module-options.interface';
|
|
4
|
+
import { ThrottlerStorage } from '@nestjs/throttler/dist/throttler-storage.interface';
|
|
5
|
+
import { AuthorizedUser } from '../gg-auth/injectable-proxy/authorized-user';
|
|
6
|
+
export declare class ThrottlerGuard extends BaseThrottlerGuard {
|
|
7
|
+
readonly options: ThrottlerModuleOptions;
|
|
8
|
+
readonly storageService: ThrottlerStorage;
|
|
9
|
+
readonly reflector: Reflector;
|
|
10
|
+
private readonly user;
|
|
11
|
+
constructor(options: ThrottlerModuleOptions, storageService: ThrottlerStorage, reflector: Reflector, user: AuthorizedUser);
|
|
12
|
+
protected getTracker(): Promise<string>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThrottlerGuard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const core_1 = require("@nestjs/core");
|
|
7
|
+
const throttler_1 = require("@nestjs/throttler");
|
|
8
|
+
const throttler_storage_interface_1 = require("@nestjs/throttler/dist/throttler-storage.interface");
|
|
9
|
+
const authorized_user_1 = require("../gg-auth/injectable-proxy/authorized-user");
|
|
10
|
+
let ThrottlerGuard = class ThrottlerGuard extends throttler_1.ThrottlerGuard {
|
|
11
|
+
constructor(options, storageService, reflector, user) {
|
|
12
|
+
super(options, storageService, reflector);
|
|
13
|
+
this.options = options;
|
|
14
|
+
this.storageService = storageService;
|
|
15
|
+
this.reflector = reflector;
|
|
16
|
+
this.user = user;
|
|
17
|
+
}
|
|
18
|
+
async getTracker() {
|
|
19
|
+
return this.user.ip;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.ThrottlerGuard = ThrottlerGuard;
|
|
23
|
+
exports.ThrottlerGuard = ThrottlerGuard = tslib_1.__decorate([
|
|
24
|
+
(0, common_1.Injectable)(),
|
|
25
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object, core_1.Reflector,
|
|
26
|
+
authorized_user_1.AuthorizedUser])
|
|
27
|
+
], ThrottlerGuard);
|
|
28
|
+
//# sourceMappingURL=throttler.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttler.guard.js","sourceRoot":"","sources":["../../../../../libs/gg-core/src/gg-throttler/throttler.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,uCAAyC;AACzC,iDAAyE;AAEzE,oGAAsF;AACtF,iFAA6E;AAGtE,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,0BAAkB;IACpD,YACkB,OAA+B,EAC/B,cAAgC,EAChC,SAAoB,EACnB,IAAoB;QAErC,KAAK,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;QAL1B,YAAO,GAAP,OAAO,CAAwB;QAC/B,mBAAc,GAAd,cAAc,CAAkB;QAChC,cAAS,GAAT,SAAS,CAAW;QACnB,SAAI,GAAJ,IAAI,CAAgB;IAGvC,CAAC;IAES,KAAK,CAAC,UAAU;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACtB,CAAC;CACF,CAAA;AAbY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;6DAKkB,gBAAS;QACb,gCAAc;GAL5B,cAAc,CAa1B"}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './gg-auth';
|
|
2
|
+
export * from './gg-cache';
|
|
3
|
+
export * from './gg-config';
|
|
4
|
+
export * from './gg-core';
|
|
5
|
+
export * from './gg-database';
|
|
6
|
+
export * from './gg-errors';
|
|
7
|
+
export * from './gg-gcp';
|
|
8
|
+
export * from './gg-kernel';
|
|
9
|
+
export * from './gg-metrics';
|
|
10
|
+
export * from './gg-micro';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./gg-auth"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./gg-cache"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./gg-config"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./gg-core"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./gg-database"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./gg-errors"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./gg-gcp"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./gg-kernel"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./gg-metrics"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./gg-micro"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/gg-core/src/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,qDAA2B;AAC3B,sDAA4B;AAC5B,oDAA0B;AAC1B,wDAA8B;AAC9B,sDAA4B;AAC5B,mDAAyB;AACzB,sDAA4B;AAC5B,uDAA6B;AAC7B,qDAA2B"}
|