@golemio/core 1.2.25-dev.723880707 → 1.2.25-dev.726368711
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/dist/helpers/connector/interfaces/IQueueConnector.d.ts +8 -0
- package/dist/helpers/connector/interfaces/IQueueConnector.js +3 -0
- package/dist/helpers/connector/interfaces/IQueueConnector.js.map +1 -0
- package/dist/helpers/ioc/Di.d.ts +2 -0
- package/dist/helpers/ioc/Di.js +7 -0
- package/dist/helpers/ioc/Di.js.map +1 -0
- package/dist/helpers/ioc/index.d.ts +1 -0
- package/dist/helpers/ioc/index.js +18 -0
- package/dist/helpers/ioc/index.js.map +1 -0
- package/dist/helpers/utils.d.ts +1 -0
- package/dist/helpers/utils.js +6 -0
- package/dist/helpers/utils.js.map +1 -0
- package/dist/input-gateway/config/InputGatewayConfiguration.d.ts +52 -0
- package/dist/input-gateway/config/InputGatewayConfiguration.js +77 -0
- package/dist/input-gateway/config/InputGatewayConfiguration.js.map +1 -0
- package/dist/input-gateway/config/abstract.d.ts +1 -2
- package/dist/input-gateway/config/config.d.ts +3 -0
- package/dist/input-gateway/config/config.js +5 -56
- package/dist/input-gateway/config/config.js.map +1 -1
- package/dist/input-gateway/connectors/AMQPConnector.d.ts +11 -24
- package/dist/input-gateway/connectors/AMQPConnector.js +45 -39
- package/dist/input-gateway/connectors/AMQPConnector.js.map +1 -1
- package/dist/input-gateway/connectors/index.d.ts +6 -1
- package/dist/input-gateway/connectors/index.js +4 -15
- package/dist/input-gateway/connectors/index.js.map +1 -1
- package/dist/input-gateway/controllers/BaseController.js +2 -2
- package/dist/input-gateway/controllers/BaseController.js.map +1 -1
- package/dist/input-gateway/helpers/Logger.d.ts +16 -20
- package/dist/input-gateway/helpers/Logger.js +16 -38
- package/dist/input-gateway/helpers/Logger.js.map +1 -1
- package/dist/input-gateway/helpers/LoggerEvents.d.ts +11 -0
- package/dist/input-gateway/helpers/LoggerEvents.js +55 -0
- package/dist/input-gateway/helpers/LoggerEvents.js.map +1 -0
- package/dist/input-gateway/helpers/index.d.ts +3 -0
- package/dist/input-gateway/helpers/index.js +5 -0
- package/dist/input-gateway/helpers/index.js.map +1 -1
- package/dist/input-gateway/helpers/interfaces/INumberOfRecordsEventData.d.ts +5 -0
- package/dist/input-gateway/helpers/interfaces/INumberOfRecordsEventData.js +3 -0
- package/dist/input-gateway/helpers/interfaces/INumberOfRecordsEventData.js.map +1 -0
- package/dist/input-gateway/helpers/interfaces/IResponseTimesEventData.d.ts +6 -0
- package/dist/input-gateway/helpers/interfaces/IResponseTimesEventData.js +3 -0
- package/dist/input-gateway/helpers/interfaces/IResponseTimesEventData.js.map +1 -0
- package/dist/input-gateway/ioc/ContainerToken.d.ts +8 -0
- package/dist/input-gateway/ioc/ContainerToken.js +12 -0
- package/dist/input-gateway/ioc/ContainerToken.js.map +1 -0
- package/dist/input-gateway/ioc/Di.d.ts +2 -0
- package/dist/input-gateway/ioc/Di.js +32 -0
- package/dist/input-gateway/ioc/Di.js.map +1 -0
- package/dist/input-gateway/ioc/index.d.ts +2 -0
- package/dist/input-gateway/ioc/index.js +19 -0
- package/dist/input-gateway/ioc/index.js.map +1 -0
- package/dist/integration-engine/config/IntegrationEngineConfiguration.d.ts +78 -0
- package/dist/integration-engine/config/IntegrationEngineConfiguration.js +109 -0
- package/dist/integration-engine/config/IntegrationEngineConfiguration.js.map +1 -0
- package/dist/integration-engine/config/config.d.ts +5 -1
- package/dist/integration-engine/config/config.js +6 -88
- package/dist/integration-engine/config/config.js.map +1 -1
- package/dist/integration-engine/connectors/AMQPConnector.d.ts +12 -5
- package/dist/integration-engine/connectors/AMQPConnector.js +59 -35
- package/dist/integration-engine/connectors/AMQPConnector.js.map +1 -1
- package/dist/integration-engine/connectors/MongoConnector.d.ts +9 -3
- package/dist/integration-engine/connectors/MongoConnector.js +36 -14
- package/dist/integration-engine/connectors/MongoConnector.js.map +1 -1
- package/dist/integration-engine/connectors/PostgresConnector.d.ts +12 -3
- package/dist/integration-engine/connectors/PostgresConnector.js +40 -16
- package/dist/integration-engine/connectors/PostgresConnector.js.map +1 -1
- package/dist/integration-engine/connectors/RedisConnector.d.ts +9 -3
- package/dist/integration-engine/connectors/RedisConnector.js +32 -10
- package/dist/integration-engine/connectors/RedisConnector.js.map +1 -1
- package/dist/integration-engine/connectors/index.d.ts +24 -4
- package/dist/integration-engine/connectors/index.js +22 -19
- package/dist/integration-engine/connectors/index.js.map +1 -1
- package/dist/integration-engine/connectors/interfaces/IMongoConnector.d.ts +7 -0
- package/dist/integration-engine/connectors/interfaces/IMongoConnector.js +3 -0
- package/dist/integration-engine/connectors/interfaces/IMongoConnector.js.map +1 -0
- package/dist/integration-engine/connectors/interfaces/IPostgresConnector.d.ts +7 -0
- package/dist/integration-engine/connectors/interfaces/IPostgresConnector.js +3 -0
- package/dist/integration-engine/connectors/interfaces/IPostgresConnector.js.map +1 -0
- package/dist/integration-engine/connectors/interfaces/IRedisConnector.d.ts +7 -0
- package/dist/integration-engine/connectors/interfaces/IRedisConnector.js +3 -0
- package/dist/integration-engine/connectors/interfaces/IRedisConnector.js.map +1 -0
- package/dist/integration-engine/data-access/RawDataStorage.d.ts +11 -0
- package/dist/integration-engine/data-access/RawDataStorage.js +81 -0
- package/dist/integration-engine/data-access/RawDataStorage.js.map +1 -0
- package/dist/integration-engine/data-access/StorageService.d.ts +10 -4
- package/dist/integration-engine/data-access/StorageService.js +40 -18
- package/dist/integration-engine/data-access/StorageService.js.map +1 -1
- package/dist/integration-engine/data-access/index.d.ts +6 -1
- package/dist/integration-engine/data-access/index.js +7 -15
- package/dist/integration-engine/data-access/index.js.map +1 -1
- package/dist/integration-engine/data-access/interfaces/IStorageService.d.ts +3 -0
- package/dist/integration-engine/data-access/interfaces/IStorageService.js +3 -0
- package/dist/integration-engine/data-access/interfaces/IStorageService.js.map +1 -0
- package/dist/integration-engine/data-access/pubsub/RedisPubSubChannel.d.ts +3 -3
- package/dist/integration-engine/data-access/pubsub/RedisPubSubChannel.js +7 -4
- package/dist/integration-engine/data-access/pubsub/RedisPubSubChannel.js.map +1 -1
- package/dist/integration-engine/data-access/pubsub/subscribers/AbstractSubscriber.d.ts +6 -2
- package/dist/integration-engine/data-access/pubsub/subscribers/AbstractSubscriber.js.map +1 -1
- package/dist/integration-engine/data-access/pubsub/subscribers/RedisSubscriber.d.ts +10 -12
- package/dist/integration-engine/data-access/pubsub/subscribers/RedisSubscriber.js +33 -45
- package/dist/integration-engine/data-access/pubsub/subscribers/RedisSubscriber.js.map +1 -1
- package/dist/integration-engine/data-access/pubsub/subscribers/interfaces/ISubscribeMessage.d.ts +1 -0
- package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategy.js +6 -4
- package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategy.js.map +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategyStreamed.d.ts +1 -1
- package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategyStreamed.js +4 -3
- package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategyStreamed.js.map +1 -1
- package/dist/integration-engine/helpers/FileCompressor.js +4 -6
- package/dist/integration-engine/helpers/FileCompressor.js.map +1 -1
- package/dist/integration-engine/helpers/GeocodeApi.d.ts +8 -3
- package/dist/integration-engine/helpers/GeocodeApi.js +32 -11
- package/dist/integration-engine/helpers/GeocodeApi.js.map +1 -1
- package/dist/integration-engine/helpers/Logger.d.ts +16 -10
- package/dist/integration-engine/helpers/Logger.js +13 -71
- package/dist/integration-engine/helpers/Logger.js.map +1 -1
- package/dist/integration-engine/helpers/LoggerEvents.d.ts +11 -0
- package/dist/integration-engine/helpers/LoggerEvents.js +91 -0
- package/dist/integration-engine/helpers/LoggerEvents.js.map +1 -0
- package/dist/integration-engine/helpers/RawDataStore.d.ts +3 -0
- package/dist/integration-engine/helpers/RawDataStore.js +5 -39
- package/dist/integration-engine/helpers/RawDataStore.js.map +1 -1
- package/dist/integration-engine/helpers/index.d.ts +8 -2
- package/dist/integration-engine/helpers/index.js +10 -2
- package/dist/integration-engine/helpers/index.js.map +1 -1
- package/dist/integration-engine/ioc/ContainerToken.d.ts +14 -0
- package/dist/integration-engine/ioc/ContainerToken.js +18 -0
- package/dist/integration-engine/ioc/ContainerToken.js.map +1 -0
- package/dist/integration-engine/ioc/Di.d.ts +2 -0
- package/dist/integration-engine/ioc/Di.js +46 -0
- package/dist/integration-engine/ioc/Di.js.map +1 -0
- package/dist/integration-engine/ioc/index.d.ts +2 -0
- package/dist/integration-engine/ioc/index.js +19 -0
- package/dist/integration-engine/ioc/index.js.map +1 -0
- package/dist/integration-engine/models/MongoModel.js +6 -6
- package/dist/integration-engine/models/MongoModel.js.map +1 -1
- package/dist/integration-engine/models/PostgresModel.d.ts +3 -1
- package/dist/integration-engine/models/PostgresModel.js +19 -14
- package/dist/integration-engine/models/PostgresModel.js.map +1 -1
- package/dist/integration-engine/models/RedisModel.js +2 -2
- package/dist/integration-engine/models/RedisModel.js.map +1 -1
- package/dist/output-gateway/Logger.d.ts +10 -2
- package/dist/output-gateway/Logger.js +9 -8
- package/dist/output-gateway/Logger.js.map +1 -1
- package/dist/output-gateway/config/OutputGatewayConfiguration.d.ts +51 -0
- package/dist/output-gateway/config/OutputGatewayConfiguration.js +90 -0
- package/dist/output-gateway/config/OutputGatewayConfiguration.js.map +1 -0
- package/dist/output-gateway/config/config.d.ts +5 -48
- package/dist/output-gateway/config/config.js +5 -69
- package/dist/output-gateway/config/config.js.map +1 -1
- package/dist/output-gateway/database/MongoDatabase.d.ts +7 -4
- package/dist/output-gateway/database/MongoDatabase.js +37 -16
- package/dist/output-gateway/database/MongoDatabase.js.map +1 -1
- package/dist/output-gateway/database/PostgreDatabase.d.ts +20 -3
- package/dist/output-gateway/database/PostgreDatabase.js +40 -17
- package/dist/output-gateway/database/PostgreDatabase.js.map +1 -1
- package/dist/output-gateway/database/index.d.ts +64 -1
- package/dist/output-gateway/database/index.js +17 -1
- package/dist/output-gateway/database/index.js.map +1 -1
- package/dist/output-gateway/ioc/ContainerToken.d.ts +13 -0
- package/dist/output-gateway/ioc/ContainerToken.js +17 -0
- package/dist/output-gateway/ioc/ContainerToken.js.map +1 -0
- package/dist/output-gateway/ioc/Di.d.ts +2 -0
- package/dist/output-gateway/ioc/Di.js +40 -0
- package/dist/output-gateway/ioc/Di.js.map +1 -0
- package/dist/output-gateway/ioc/index.d.ts +2 -0
- package/dist/output-gateway/ioc/index.js +19 -0
- package/dist/output-gateway/ioc/index.js.map +1 -0
- package/dist/output-gateway/models/GeoJsonModel.d.ts +1 -0
- package/dist/output-gateway/models/GeoJsonModel.js +7 -6
- package/dist/output-gateway/models/GeoJsonModel.js.map +1 -1
- package/dist/output-gateway/models/SequelizeModel.js +2 -2
- package/dist/output-gateway/models/SequelizeModel.js.map +1 -1
- package/dist/output-gateway/redis/CacheMiddleware.d.ts +9 -5
- package/dist/output-gateway/redis/CacheMiddleware.js +36 -17
- package/dist/output-gateway/redis/CacheMiddleware.js.map +1 -1
- package/dist/output-gateway/redis/RedisConnector.d.ts +6 -3
- package/dist/output-gateway/redis/RedisConnector.js +33 -13
- package/dist/output-gateway/redis/RedisConnector.js.map +1 -1
- package/dist/output-gateway/redis/index.d.ts +15 -1
- package/dist/output-gateway/redis/index.js +16 -1
- package/dist/output-gateway/redis/index.js.map +1 -1
- package/dist/shared/pino.d.ts +2 -0
- package/dist/shared/pino.js +29 -0
- package/dist/shared/pino.js.map +1 -0
- package/dist/shared/tsyringe.d.ts +1 -0
- package/dist/shared/tsyringe.js +18 -0
- package/dist/shared/tsyringe.js.map +1 -0
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedisModel.js","sourceRoot":"","sources":["../../../src/integration-engine/models/RedisModel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"RedisModel.js","sourceRoot":"","sources":["../../../src/integration-engine/models/RedisModel.ts"],"names":[],"mappings":";;;;;;;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
@@ -1,3 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ILogger } from "../helpers/logger";
|
|
2
|
+
import { HttpLogger } from "pino-http";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated For backwards compatibility. Use ioc container instead.
|
|
5
|
+
*/
|
|
6
|
+
declare const logger: ILogger;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated For backwards compatibility. Use ioc container instead.
|
|
9
|
+
*/
|
|
10
|
+
declare const requestLogger: HttpLogger;
|
|
3
11
|
export { logger as log, requestLogger };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.requestLogger = exports.log = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
logLevel: config_1.config.log_level,
|
|
10
|
-
});
|
|
4
|
+
const ioc_1 = require("./ioc");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated For backwards compatibility. Use ioc container instead.
|
|
7
|
+
*/
|
|
8
|
+
const logger = ioc_1.OutputGatewayContainer.resolve(ioc_1.ContainerToken.Logger);
|
|
11
9
|
exports.log = logger;
|
|
12
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated For backwards compatibility. Use ioc container instead.
|
|
12
|
+
*/
|
|
13
|
+
const requestLogger = ioc_1.OutputGatewayContainer.resolve(ioc_1.ContainerToken.RequestLogger);
|
|
13
14
|
exports.requestLogger = requestLogger;
|
|
14
15
|
//# sourceMappingURL=Logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../src/output-gateway/Logger.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../src/output-gateway/Logger.ts"],"names":[],"mappings":";;;AACA,+BAAiE;AAGjE;;GAEG;AACH,MAAM,MAAM,GAAG,4BAAsB,CAAC,OAAO,CAAU,oBAAc,CAAC,MAAM,CAAC,CAAC;AAM3D,qBAAG;AALtB;;GAEG;AACH,MAAM,aAAa,GAAG,4BAAsB,CAAC,OAAO,CAAa,oBAAc,CAAC,aAAa,CAAC,CAAC;AAEvE,sCAAa"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { JaegerProcessorType } from "../../monitoring";
|
|
2
|
+
export declare class OutputGatewayConfiguration {
|
|
3
|
+
app_version: string | undefined;
|
|
4
|
+
app_name: string;
|
|
5
|
+
log_level: string | undefined;
|
|
6
|
+
mongo_connection: string | undefined;
|
|
7
|
+
mongo_timeout: number;
|
|
8
|
+
node_env: string;
|
|
9
|
+
pagination_max_limit: number;
|
|
10
|
+
port: string | undefined;
|
|
11
|
+
postgres_connection: string | undefined;
|
|
12
|
+
postgres_read_only_connection: string | undefined;
|
|
13
|
+
postgres_pool_min_connections: string | undefined;
|
|
14
|
+
postgres_pool_max_connections: string | undefined;
|
|
15
|
+
postgres_pool_idle_timeout: string | undefined;
|
|
16
|
+
redis_connection: string | undefined;
|
|
17
|
+
redis_enable: boolean;
|
|
18
|
+
redis_ttl: string | undefined;
|
|
19
|
+
sentry: {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
dsn: string | undefined;
|
|
22
|
+
release: string;
|
|
23
|
+
environment: string | undefined;
|
|
24
|
+
debug: boolean;
|
|
25
|
+
tracesSampleRate: number;
|
|
26
|
+
};
|
|
27
|
+
metrics: {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
port: number;
|
|
30
|
+
prefix: string;
|
|
31
|
+
};
|
|
32
|
+
telemetry: {
|
|
33
|
+
jaegerEnabled: boolean;
|
|
34
|
+
jaegerEndpoint: string | undefined;
|
|
35
|
+
jaegerHost: string | undefined;
|
|
36
|
+
jaegerPort: number | undefined;
|
|
37
|
+
jaegerProcessor: JaegerProcessorType;
|
|
38
|
+
diagLogLevel: number;
|
|
39
|
+
};
|
|
40
|
+
lightship: {
|
|
41
|
+
shutdownDelay: number | undefined;
|
|
42
|
+
shutdownTimeout: number;
|
|
43
|
+
handlerTimeout: number;
|
|
44
|
+
};
|
|
45
|
+
vehiclePositions: {
|
|
46
|
+
defaultTimezone: string;
|
|
47
|
+
};
|
|
48
|
+
constructor();
|
|
49
|
+
private getPaginationMaxLimit;
|
|
50
|
+
private getMongoTimeout;
|
|
51
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OutputGatewayConfiguration = void 0;
|
|
13
|
+
const _monitoring_1 = require("../../monitoring");
|
|
14
|
+
const tsyringe_1 = require("tsyringe");
|
|
15
|
+
let OutputGatewayConfiguration = class OutputGatewayConfiguration {
|
|
16
|
+
constructor() {
|
|
17
|
+
var _a;
|
|
18
|
+
this.app_version = process.env.npm_package_version;
|
|
19
|
+
this.app_name = process.env.APP_NAME || "output-gateway";
|
|
20
|
+
this.log_level = process.env.LOG_LEVEL;
|
|
21
|
+
this.mongo_connection = process.env.MONGO_CONN;
|
|
22
|
+
this.node_env = process.env.NODE_ENV || "development";
|
|
23
|
+
this.port = process.env.PORT;
|
|
24
|
+
this.postgres_connection = process.env.POSTGRES_CONN;
|
|
25
|
+
this.postgres_read_only_connection = process.env.POSTGRES_RO_CONN || process.env.POSTGRES_CONN; // to discuss
|
|
26
|
+
this.postgres_pool_min_connections = process.env.POSTGRES_POOL_MIN_CONNECTIONS;
|
|
27
|
+
this.postgres_pool_max_connections = process.env.POSTGRES_POOL_MAX_CONNECTIONS;
|
|
28
|
+
this.postgres_pool_idle_timeout = process.env.POSTGRES_POOL_IDLE_TIMEOUT;
|
|
29
|
+
this.redis_connection = process.env.REDIS_CONN;
|
|
30
|
+
this.redis_enable = process.env.REDIS_ENABLE === "true";
|
|
31
|
+
this.redis_ttl = process.env.REDIS_DEFAULT_TTL;
|
|
32
|
+
this.sentry = {
|
|
33
|
+
enabled: process.env.SENTRY_ENABLED === "true",
|
|
34
|
+
dsn: process.env.SENTRY_DSN,
|
|
35
|
+
release: `${process.env.APP_NAME}@${process.env.npm_package_version}`,
|
|
36
|
+
environment: process.env.SENTRY_ENVIRONMENT,
|
|
37
|
+
debug: process.env.SENTRY_DEBUG === "true",
|
|
38
|
+
tracesSampleRate: process.env.SENTRY_TRACE_RATE ? parseFloat(process.env.SENTRY_TRACE_RATE) : 0,
|
|
39
|
+
};
|
|
40
|
+
this.metrics = {
|
|
41
|
+
enabled: process.env.METRICS_ENABLED === "true",
|
|
42
|
+
port: process.env.METRICS_PORT ? parseInt(process.env.METRICS_PORT, 10) : 9001,
|
|
43
|
+
prefix: process.env.METRICS_PREFIX || "",
|
|
44
|
+
};
|
|
45
|
+
this.telemetry = {
|
|
46
|
+
jaegerEnabled: process.env.JAEGER_ENABLED === "true",
|
|
47
|
+
jaegerEndpoint: process.env.JAEGER_ENDPOINT,
|
|
48
|
+
jaegerHost: process.env.JAEGER_AGENT_HOST,
|
|
49
|
+
jaegerPort: process.env.JAEGER_AGENT_PORT ? parseInt(process.env.JAEGER_AGENT_PORT, 10) : undefined,
|
|
50
|
+
jaegerProcessor: process.env.JAEGER_PROCESSOR && process.env.JAEGER_PROCESSOR in _monitoring_1.JaegerProcessorType
|
|
51
|
+
? process.env.JAEGER_PROCESSOR
|
|
52
|
+
: _monitoring_1.JaegerProcessorType.CONSOLE,
|
|
53
|
+
diagLogLevel: process.env.TELEMETRY_LOG_LEVEL ? parseInt(process.env.TELEMETRY_LOG_LEVEL, 10) : 9999,
|
|
54
|
+
};
|
|
55
|
+
this.lightship = {
|
|
56
|
+
shutdownDelay: process.env.LIGHTSHIP_SHUTDOWN_DELAY ? parseInt(process.env.LIGHTSHIP_SHUTDOWN_DELAY, 10) : undefined,
|
|
57
|
+
shutdownTimeout: process.env.LIGHTSHIP_SHUTDOWN_TIMEOUT ? parseInt(process.env.LIGHTSHIP_SHUTDOWN_TIMEOUT, 10) : 60000,
|
|
58
|
+
handlerTimeout: process.env.LIGHTSHIP_HANDLER_TIMEOUT ? parseInt(process.env.LIGHTSHIP_HANDLER_TIMEOUT, 10) : 5000,
|
|
59
|
+
};
|
|
60
|
+
this.vehiclePositions = {
|
|
61
|
+
defaultTimezone: (_a = process.env.VEHICLE_POSITIONS_DEFAULT_TIMEZONE) !== null && _a !== void 0 ? _a : "Europe/Prague",
|
|
62
|
+
};
|
|
63
|
+
this.getPaginationMaxLimit = () => {
|
|
64
|
+
if (process.env.PAGINATION_MAX_LIMIT) {
|
|
65
|
+
const parsed = parseInt(process.env.PAGINATION_MAX_LIMIT, 10);
|
|
66
|
+
if (!isNaN(parsed)) {
|
|
67
|
+
return parsed;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return 10000;
|
|
71
|
+
};
|
|
72
|
+
this.getMongoTimeout = () => {
|
|
73
|
+
if (process.env.MONGO_TIMEOUT) {
|
|
74
|
+
const parsed = parseInt(process.env.MONGO_TIMEOUT, 10);
|
|
75
|
+
if (!isNaN(parsed)) {
|
|
76
|
+
return parsed;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return 30000;
|
|
80
|
+
};
|
|
81
|
+
this.mongo_timeout = this.getMongoTimeout();
|
|
82
|
+
this.pagination_max_limit = this.getPaginationMaxLimit();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
OutputGatewayConfiguration = __decorate([
|
|
86
|
+
(0, tsyringe_1.injectable)(),
|
|
87
|
+
__metadata("design:paramtypes", [])
|
|
88
|
+
], OutputGatewayConfiguration);
|
|
89
|
+
exports.OutputGatewayConfiguration = OutputGatewayConfiguration;
|
|
90
|
+
//# sourceMappingURL=OutputGatewayConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutputGatewayConfiguration.js","sourceRoot":"","sources":["../../../src/output-gateway/config/OutputGatewayConfiguration.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAkD;AAClD,uCAAsC;AAGtC,IAAa,0BAA0B,GAAvC,MAAa,0BAA0B;IAkDnC;;QAjDO,gBAAW,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;QAC9C,aAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,gBAAgB,CAAC;QACpD,cAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;QAClC,qBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;QAE1C,aAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;QAEjD,SAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACxB,wBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QAChD,kCAA6B,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,aAAa;QACxG,kCAA6B,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;QAC1E,kCAA6B,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;QAC1E,+BAA0B,GAAG,OAAO,CAAC,GAAG,CAA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AC,CAAC;gBAC9D,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;oBAChB,OAAO,MAAM,CAAC;iBACjB;aACJ;YAED,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC;QAEM,oBAAe,GAAG,GAAW,EAAE;YACnC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE;gBAC3B,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;gBACvD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;oBAChB,OAAO,MAAM,CAAC;iBACjB;aACJ;YAED,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC;QAxBE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC5C,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC7D,CAAC;CAuBJ,CAAA;AA5EY,0BAA0B;IADtC,IAAA,qBAAU,GAAE;;GACA,0BAA0B,CA4EtC;AA5EY,gEAA0B"}
|
|
@@ -1,48 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
mongo_connection: string | undefined;
|
|
7
|
-
mongo_timeout: number;
|
|
8
|
-
node_env: string;
|
|
9
|
-
pagination_max_limit: number;
|
|
10
|
-
port: string | undefined;
|
|
11
|
-
postgres_connection: string | undefined;
|
|
12
|
-
postgres_read_only_connection: string | undefined;
|
|
13
|
-
postgres_pool_min_connections: string | undefined;
|
|
14
|
-
postgres_pool_max_connections: string | undefined;
|
|
15
|
-
postgres_pool_idle_timeout: string | undefined;
|
|
16
|
-
redis_connection: string | undefined;
|
|
17
|
-
redis_enable: boolean;
|
|
18
|
-
redis_ttl: string | undefined;
|
|
19
|
-
sentry: {
|
|
20
|
-
enabled: boolean;
|
|
21
|
-
dsn: string | undefined;
|
|
22
|
-
release: string;
|
|
23
|
-
environment: string | undefined;
|
|
24
|
-
debug: boolean;
|
|
25
|
-
tracesSampleRate: number;
|
|
26
|
-
};
|
|
27
|
-
metrics: {
|
|
28
|
-
enabled: boolean;
|
|
29
|
-
port: number;
|
|
30
|
-
prefix: string;
|
|
31
|
-
};
|
|
32
|
-
telemetry: {
|
|
33
|
-
jaegerEnabled: boolean;
|
|
34
|
-
jaegerEndpoint: string | undefined;
|
|
35
|
-
jaegerHost: string | undefined;
|
|
36
|
-
jaegerPort: number | undefined;
|
|
37
|
-
jaegerProcessor: JaegerProcessorType;
|
|
38
|
-
diagLogLevel: number;
|
|
39
|
-
};
|
|
40
|
-
lightship: {
|
|
41
|
-
shutdownDelay: number | undefined;
|
|
42
|
-
shutdownTimeout: number;
|
|
43
|
-
handlerTimeout: number;
|
|
44
|
-
};
|
|
45
|
-
vehiclePositions: {
|
|
46
|
-
defaultTimezone: string;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
1
|
+
import { OutputGatewayConfiguration } from "./OutputGatewayConfiguration";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated For backwards compatibility. Use ioc container instead.
|
|
4
|
+
*/
|
|
5
|
+
export declare const config: OutputGatewayConfiguration;
|
|
@@ -1,73 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.config = void 0;
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return parsed;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return 10000;
|
|
14
|
-
};
|
|
15
|
-
const getMongoTimeout = () => {
|
|
16
|
-
if (process.env.MONGO_TIMEOUT) {
|
|
17
|
-
const parsed = parseInt(process.env.MONGO_TIMEOUT, 10);
|
|
18
|
-
if (!isNaN(parsed)) {
|
|
19
|
-
return parsed;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return 30000;
|
|
23
|
-
};
|
|
24
|
-
exports.config = {
|
|
25
|
-
app_version: process.env.npm_package_version,
|
|
26
|
-
app_name: process.env.APP_NAME || "output-gateway",
|
|
27
|
-
log_level: process.env.LOG_LEVEL,
|
|
28
|
-
mongo_connection: process.env.MONGO_CONN,
|
|
29
|
-
mongo_timeout: getMongoTimeout(),
|
|
30
|
-
node_env: process.env.NODE_ENV || "development",
|
|
31
|
-
pagination_max_limit: getPaginationMaxLimit(),
|
|
32
|
-
port: process.env.PORT,
|
|
33
|
-
postgres_connection: process.env.POSTGRES_CONN,
|
|
34
|
-
postgres_read_only_connection: process.env.POSTGRES_RO_CONN || process.env.POSTGRES_CONN,
|
|
35
|
-
postgres_pool_min_connections: process.env.POSTGRES_POOL_MIN_CONNECTIONS,
|
|
36
|
-
postgres_pool_max_connections: process.env.POSTGRES_POOL_MAX_CONNECTIONS,
|
|
37
|
-
postgres_pool_idle_timeout: process.env.POSTGRES_POOL_IDLE_TIMEOUT,
|
|
38
|
-
redis_connection: process.env.REDIS_CONN,
|
|
39
|
-
redis_enable: process.env.REDIS_ENABLE === "true",
|
|
40
|
-
redis_ttl: process.env.REDIS_DEFAULT_TTL,
|
|
41
|
-
sentry: {
|
|
42
|
-
enabled: process.env.SENTRY_ENABLED === "true",
|
|
43
|
-
dsn: process.env.SENTRY_DSN,
|
|
44
|
-
release: `${process.env.APP_NAME}@${process.env.npm_package_version}`,
|
|
45
|
-
environment: process.env.SENTRY_ENVIRONMENT,
|
|
46
|
-
debug: process.env.SENTRY_DEBUG === "true",
|
|
47
|
-
tracesSampleRate: process.env.SENTRY_TRACE_RATE ? parseFloat(process.env.SENTRY_TRACE_RATE) : 0,
|
|
48
|
-
},
|
|
49
|
-
metrics: {
|
|
50
|
-
enabled: process.env.METRICS_ENABLED === "true",
|
|
51
|
-
port: process.env.METRICS_PORT ? parseInt(process.env.METRICS_PORT, 10) : 9001,
|
|
52
|
-
prefix: process.env.METRICS_PREFIX || "",
|
|
53
|
-
},
|
|
54
|
-
telemetry: {
|
|
55
|
-
jaegerEnabled: process.env.JAEGER_ENABLED === "true",
|
|
56
|
-
jaegerEndpoint: process.env.JAEGER_ENDPOINT,
|
|
57
|
-
jaegerHost: process.env.JAEGER_AGENT_HOST,
|
|
58
|
-
jaegerPort: process.env.JAEGER_AGENT_PORT ? parseInt(process.env.JAEGER_AGENT_PORT, 10) : undefined,
|
|
59
|
-
jaegerProcessor: process.env.JAEGER_PROCESSOR && process.env.JAEGER_PROCESSOR in _monitoring_1.JaegerProcessorType
|
|
60
|
-
? process.env.JAEGER_PROCESSOR
|
|
61
|
-
: _monitoring_1.JaegerProcessorType.CONSOLE,
|
|
62
|
-
diagLogLevel: process.env.TELEMETRY_LOG_LEVEL ? parseInt(process.env.TELEMETRY_LOG_LEVEL, 10) : 9999,
|
|
63
|
-
},
|
|
64
|
-
lightship: {
|
|
65
|
-
shutdownDelay: process.env.LIGHTSHIP_SHUTDOWN_DELAY ? parseInt(process.env.LIGHTSHIP_SHUTDOWN_DELAY, 10) : undefined,
|
|
66
|
-
shutdownTimeout: process.env.LIGHTSHIP_SHUTDOWN_TIMEOUT ? parseInt(process.env.LIGHTSHIP_SHUTDOWN_TIMEOUT, 10) : 60000,
|
|
67
|
-
handlerTimeout: process.env.LIGHTSHIP_HANDLER_TIMEOUT ? parseInt(process.env.LIGHTSHIP_HANDLER_TIMEOUT, 10) : 5000,
|
|
68
|
-
},
|
|
69
|
-
vehiclePositions: {
|
|
70
|
-
defaultTimezone: (_a = process.env.VEHICLE_POSITIONS_DEFAULT_TIMEZONE) !== null && _a !== void 0 ? _a : "Europe/Prague",
|
|
71
|
-
},
|
|
72
|
-
};
|
|
4
|
+
const ioc_1 = require("../ioc");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated For backwards compatibility. Use ioc container instead.
|
|
7
|
+
*/
|
|
8
|
+
exports.config = ioc_1.OutputGatewayContainer.resolve(ioc_1.ContainerToken.Config);
|
|
73
9
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/output-gateway/config/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/output-gateway/config/config.ts"],"names":[],"mappings":";;;AAAA,gCAAiE;AAGjE;;GAEG;AACU,QAAA,MAAM,GAAG,4BAAsB,CAAC,OAAO,CAA6B,oBAAc,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { ILogger } from "../../helpers";
|
|
2
|
+
import { OutputGatewayConfiguration } from "../config/OutputGatewayConfiguration";
|
|
1
3
|
import mongoose from "mongoose";
|
|
4
|
+
import { Disposable } from "tsyringe";
|
|
2
5
|
/**
|
|
3
6
|
* Class for connection to MongoDB database. Using mongoose https://www.npmjs.com/package/mongoose
|
|
4
7
|
*/
|
|
5
|
-
export declare class MongoDatabase {
|
|
8
|
+
export declare class MongoDatabase implements Disposable {
|
|
9
|
+
private readonly log;
|
|
6
10
|
private readonly connectionString;
|
|
7
11
|
private readonly connectTimeoutMS;
|
|
8
12
|
/** Set up connection string */
|
|
9
|
-
constructor();
|
|
13
|
+
constructor(config: OutputGatewayConfiguration, log: ILogger);
|
|
10
14
|
/** Connects to db */
|
|
11
15
|
connect: () => Promise<mongoose.Connection>;
|
|
12
16
|
isConnected: () => Promise<boolean>;
|
|
13
17
|
disconnect: () => Promise<void>;
|
|
18
|
+
dispose: () => Promise<void>;
|
|
14
19
|
}
|
|
15
|
-
declare const mongooseConnection: Promise<mongoose.Connection>;
|
|
16
|
-
export { mongooseConnection };
|
|
@@ -1,4 +1,16 @@
|
|
|
1
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
|
+
};
|
|
2
14
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
15
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
16
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -12,17 +24,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
24
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
25
|
};
|
|
14
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
27
|
+
exports.MongoDatabase = void 0;
|
|
28
|
+
const ioc_1 = require("../ioc");
|
|
29
|
+
const OutputGatewayConfiguration_1 = require("../config/OutputGatewayConfiguration");
|
|
16
30
|
const errors_1 = require("@golemio/errors");
|
|
17
31
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
18
|
-
const
|
|
19
|
-
const Logger_1 = require("../Logger");
|
|
32
|
+
const tsyringe_1 = require("tsyringe");
|
|
20
33
|
/**
|
|
21
34
|
* Class for connection to MongoDB database. Using mongoose https://www.npmjs.com/package/mongoose
|
|
22
35
|
*/
|
|
23
|
-
class MongoDatabase {
|
|
36
|
+
let MongoDatabase = class MongoDatabase {
|
|
24
37
|
/** Set up connection string */
|
|
25
|
-
constructor() {
|
|
38
|
+
constructor(config, log) {
|
|
39
|
+
this.log = log;
|
|
26
40
|
/** Connects to db */
|
|
27
41
|
this.connect = () => __awaiter(this, void 0, void 0, function* () {
|
|
28
42
|
try {
|
|
@@ -35,19 +49,19 @@ class MongoDatabase {
|
|
|
35
49
|
};
|
|
36
50
|
yield mongoose_1.default.connect(this.connectionString, connectOptions);
|
|
37
51
|
mongoose_1.default.connection.on("disconnected", () => {
|
|
38
|
-
|
|
52
|
+
this.log.error("Mongo DB disconnected!");
|
|
39
53
|
});
|
|
40
54
|
mongoose_1.default.connection.on("reconnected", () => {
|
|
41
|
-
|
|
55
|
+
this.log.warn("Mongo DB reconnected after connection lost.");
|
|
42
56
|
});
|
|
43
57
|
mongoose_1.default.connection.on("error", (err) => {
|
|
44
|
-
|
|
58
|
+
this.log.error(err);
|
|
45
59
|
});
|
|
46
|
-
|
|
60
|
+
this.log.info("Connected to Mongo DB!");
|
|
47
61
|
return mongoose_1.default.connection;
|
|
48
62
|
}
|
|
49
63
|
catch (err) {
|
|
50
|
-
|
|
64
|
+
this.log.error("Could not connect to " + this.connectionString);
|
|
51
65
|
throw new errors_1.CustomError("Error while connecting to Mongo DB", false, "MongoDatabase", 5001, err);
|
|
52
66
|
}
|
|
53
67
|
});
|
|
@@ -55,14 +69,21 @@ class MongoDatabase {
|
|
|
55
69
|
return mongoose_1.default.connection.readyState === 1;
|
|
56
70
|
});
|
|
57
71
|
this.disconnect = () => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
|
|
72
|
+
this.log.info("MongoDB disconnect called");
|
|
59
73
|
return mongoose_1.default.connection.close();
|
|
60
74
|
});
|
|
61
|
-
this.
|
|
62
|
-
|
|
75
|
+
this.dispose = () => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
yield this.disconnect();
|
|
77
|
+
});
|
|
78
|
+
this.connectionString = config.mongo_connection;
|
|
79
|
+
this.connectTimeoutMS = config.mongo_timeout;
|
|
63
80
|
}
|
|
64
|
-
}
|
|
81
|
+
};
|
|
82
|
+
MongoDatabase = __decorate([
|
|
83
|
+
(0, tsyringe_1.injectable)(),
|
|
84
|
+
__param(0, (0, tsyringe_1.inject)(ioc_1.ContainerToken.Config)),
|
|
85
|
+
__param(1, (0, tsyringe_1.inject)(ioc_1.ContainerToken.Logger)),
|
|
86
|
+
__metadata("design:paramtypes", [OutputGatewayConfiguration_1.OutputGatewayConfiguration, Object])
|
|
87
|
+
], MongoDatabase);
|
|
65
88
|
exports.MongoDatabase = MongoDatabase;
|
|
66
|
-
const mongooseConnection = new MongoDatabase().connect();
|
|
67
|
-
exports.mongooseConnection = mongooseConnection;
|
|
68
89
|
//# sourceMappingURL=MongoDatabase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MongoDatabase.js","sourceRoot":"","sources":["../../../src/output-gateway/database/MongoDatabase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MongoDatabase.js","sourceRoot":"","sources":["../../../src/output-gateway/database/MongoDatabase.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gCAAyC;AACzC,qFAAmF;AACnF,4CAA8C;AAC9C,wDAAoD;AACpD,uCAA0D;AAE1D;;GAEG;AAEH,IAAa,aAAa,GAA1B,MAAa,aAAa;IAItB,+BAA+B;IAC/B,YACmC,MAAkC,EACjB,GAAY;QAAZ,QAAG,GAAH,GAAG,CAAS;QAMhE,qBAAqB;QACd,YAAO,GAAG,GAAuC,EAAE;YACtD,IAAI;gBACA,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,KAAK,kCAAkC,EAAE;oBACxF,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;iBACnD;gBACD,MAAM,cAAc,GAAmB;oBACnC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;oBACvC,wBAAwB,EAAE,IAAI,CAAC,gBAAgB;iBAClD,CAAC;gBAEF,MAAM,kBAAQ,CAAC,OAAO,CAAC,IAAI,CAA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AU,EAAE,CAAC;QAC5B,CAAC,CAAA,CAAC;QAhDE,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAChD,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC;IACjD,CAAC;CA+CJ,CAAA;AA1DY,aAAa;IADzB,IAAA,qBAAU,GAAE;IAOJ,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,MAAM,CAAC,CAAA;IAC7B,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,MAAM,CAAC,CAAA;qCADS,uDAA0B;GAN5D,aAAa,CA0DzB;AA1DY,sCAAa"}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
+
import { ILogger } from "../../helpers";
|
|
2
|
+
import { OutputGatewayConfiguration } from "../config/OutputGatewayConfiguration";
|
|
1
3
|
import { Sequelize } from "sequelize";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
import { Disposable } from "tsyringe";
|
|
5
|
+
/**
|
|
6
|
+
* Class for connection to PostgreSQL database. Using sequelize https://www.npmjs.com/package/sequelize
|
|
7
|
+
*/
|
|
8
|
+
export declare class PostgresDatabase implements Disposable {
|
|
9
|
+
private readonly log;
|
|
10
|
+
private readonly connectionString;
|
|
11
|
+
private poolIdleTimeout;
|
|
12
|
+
private poolMinConnections;
|
|
13
|
+
private poolMaxConnections;
|
|
14
|
+
private sequelize?;
|
|
15
|
+
constructor(config: OutputGatewayConfiguration, log: ILogger);
|
|
16
|
+
/** Connects to db */
|
|
17
|
+
connect: (connectionString?: string) => Sequelize | undefined;
|
|
18
|
+
isConnected: () => Promise<boolean>;
|
|
19
|
+
disconnect: () => Promise<void>;
|
|
20
|
+
dispose: () => Promise<void>;
|
|
21
|
+
}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
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
|
+
};
|
|
2
14
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
15
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
16
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -12,16 +24,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
24
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
25
|
};
|
|
14
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
27
|
+
exports.PostgresDatabase = void 0;
|
|
28
|
+
const OutputGatewayConfiguration_1 = require("../config/OutputGatewayConfiguration");
|
|
29
|
+
const ioc_1 = require("../ioc");
|
|
16
30
|
const os_1 = __importDefault(require("os"));
|
|
17
31
|
const sequelize_1 = require("sequelize");
|
|
18
|
-
const
|
|
19
|
-
const Logger_1 = require("../Logger");
|
|
32
|
+
const tsyringe_1 = require("tsyringe");
|
|
20
33
|
/**
|
|
21
34
|
* Class for connection to PostgreSQL database. Using sequelize https://www.npmjs.com/package/sequelize
|
|
22
35
|
*/
|
|
23
|
-
class PostgresDatabase {
|
|
24
|
-
constructor() {
|
|
36
|
+
let PostgresDatabase = class PostgresDatabase {
|
|
37
|
+
constructor(config, log) {
|
|
38
|
+
this.log = log;
|
|
25
39
|
/** Connects to db */
|
|
26
40
|
this.connect = (connectionString) => {
|
|
27
41
|
try {
|
|
@@ -36,15 +50,15 @@ class PostgresDatabase {
|
|
|
36
50
|
freezeTableName: true,
|
|
37
51
|
timestamps: false,
|
|
38
52
|
},
|
|
39
|
-
logging:
|
|
53
|
+
logging: this.log.silly,
|
|
40
54
|
pool: {
|
|
41
55
|
acquire: 60000,
|
|
42
|
-
idle: Number(
|
|
43
|
-
min: Number(
|
|
44
|
-
max: Number(
|
|
56
|
+
idle: Number(this.poolIdleTimeout) || 10000,
|
|
57
|
+
min: Number(this.poolMinConnections) || 0,
|
|
58
|
+
max: Number(this.poolMaxConnections) || 5,
|
|
45
59
|
},
|
|
46
60
|
});
|
|
47
|
-
|
|
61
|
+
this.log.info("Connected to PostgresSQL DB!");
|
|
48
62
|
return this.sequelize;
|
|
49
63
|
}
|
|
50
64
|
catch (err) {
|
|
@@ -61,16 +75,25 @@ class PostgresDatabase {
|
|
|
61
75
|
}
|
|
62
76
|
});
|
|
63
77
|
this.disconnect = () => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
|
|
78
|
+
this.log.info("PostgreSQL disconnect called");
|
|
65
79
|
if (this.sequelize) {
|
|
66
80
|
yield this.sequelize.close();
|
|
67
81
|
}
|
|
68
82
|
});
|
|
69
|
-
this.
|
|
83
|
+
this.dispose = () => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
yield this.disconnect();
|
|
85
|
+
});
|
|
86
|
+
this.connectionString = config.postgres_connection || "";
|
|
87
|
+
this.poolIdleTimeout = config.postgres_pool_idle_timeout;
|
|
88
|
+
this.poolMinConnections = config.postgres_pool_min_connections;
|
|
89
|
+
this.poolMaxConnections = config.postgres_pool_max_connections;
|
|
70
90
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
91
|
+
};
|
|
92
|
+
PostgresDatabase = __decorate([
|
|
93
|
+
(0, tsyringe_1.injectable)(),
|
|
94
|
+
__param(0, (0, tsyringe_1.inject)(ioc_1.ContainerToken.Config)),
|
|
95
|
+
__param(1, (0, tsyringe_1.inject)(ioc_1.ContainerToken.Logger)),
|
|
96
|
+
__metadata("design:paramtypes", [OutputGatewayConfiguration_1.OutputGatewayConfiguration, Object])
|
|
97
|
+
], PostgresDatabase);
|
|
98
|
+
exports.PostgresDatabase = PostgresDatabase;
|
|
76
99
|
//# sourceMappingURL=PostgreDatabase.js.map
|