@golemio/core 1.2.25-dev.722047718 → 1.2.25-dev.724698177

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.
Files changed (179) hide show
  1. package/dist/helpers/connector/interfaces/IQueueConnector.d.ts +8 -0
  2. package/dist/helpers/connector/interfaces/IQueueConnector.js +3 -0
  3. package/dist/helpers/connector/interfaces/IQueueConnector.js.map +1 -0
  4. package/dist/helpers/ioc/Di.d.ts +2 -0
  5. package/dist/helpers/ioc/Di.js +7 -0
  6. package/dist/helpers/ioc/Di.js.map +1 -0
  7. package/dist/helpers/ioc/index.d.ts +1 -0
  8. package/dist/helpers/ioc/index.js +18 -0
  9. package/dist/helpers/ioc/index.js.map +1 -0
  10. package/dist/helpers/utils.d.ts +1 -0
  11. package/dist/helpers/utils.js +6 -0
  12. package/dist/helpers/utils.js.map +1 -0
  13. package/dist/input-gateway/config/InputGatewayConfiguration.d.ts +52 -0
  14. package/dist/input-gateway/config/InputGatewayConfiguration.js +77 -0
  15. package/dist/input-gateway/config/InputGatewayConfiguration.js.map +1 -0
  16. package/dist/input-gateway/config/abstract.d.ts +1 -2
  17. package/dist/input-gateway/config/config.d.ts +3 -0
  18. package/dist/input-gateway/config/config.js +5 -56
  19. package/dist/input-gateway/config/config.js.map +1 -1
  20. package/dist/input-gateway/connectors/AMQPConnector.d.ts +11 -24
  21. package/dist/input-gateway/connectors/AMQPConnector.js +45 -39
  22. package/dist/input-gateway/connectors/AMQPConnector.js.map +1 -1
  23. package/dist/input-gateway/connectors/index.d.ts +6 -1
  24. package/dist/input-gateway/connectors/index.js +4 -15
  25. package/dist/input-gateway/connectors/index.js.map +1 -1
  26. package/dist/input-gateway/controllers/BaseController.js +2 -2
  27. package/dist/input-gateway/controllers/BaseController.js.map +1 -1
  28. package/dist/input-gateway/helpers/Logger.d.ts +16 -20
  29. package/dist/input-gateway/helpers/Logger.js +16 -38
  30. package/dist/input-gateway/helpers/Logger.js.map +1 -1
  31. package/dist/input-gateway/helpers/LoggerEvents.d.ts +11 -0
  32. package/dist/input-gateway/helpers/LoggerEvents.js +55 -0
  33. package/dist/input-gateway/helpers/LoggerEvents.js.map +1 -0
  34. package/dist/input-gateway/helpers/index.d.ts +3 -0
  35. package/dist/input-gateway/helpers/index.js +5 -0
  36. package/dist/input-gateway/helpers/index.js.map +1 -1
  37. package/dist/input-gateway/helpers/interfaces/INumberOfRecordsEventData.d.ts +5 -0
  38. package/dist/input-gateway/helpers/interfaces/INumberOfRecordsEventData.js +3 -0
  39. package/dist/input-gateway/helpers/interfaces/INumberOfRecordsEventData.js.map +1 -0
  40. package/dist/input-gateway/helpers/interfaces/IResponseTimesEventData.d.ts +6 -0
  41. package/dist/input-gateway/helpers/interfaces/IResponseTimesEventData.js +3 -0
  42. package/dist/input-gateway/helpers/interfaces/IResponseTimesEventData.js.map +1 -0
  43. package/dist/input-gateway/ioc/ContainerToken.d.ts +8 -0
  44. package/dist/input-gateway/ioc/ContainerToken.js +12 -0
  45. package/dist/input-gateway/ioc/ContainerToken.js.map +1 -0
  46. package/dist/input-gateway/ioc/Di.d.ts +2 -0
  47. package/dist/input-gateway/ioc/Di.js +32 -0
  48. package/dist/input-gateway/ioc/Di.js.map +1 -0
  49. package/dist/input-gateway/ioc/index.d.ts +2 -0
  50. package/dist/input-gateway/ioc/index.js +19 -0
  51. package/dist/input-gateway/ioc/index.js.map +1 -0
  52. package/dist/integration-engine/config/IntegrationEngineConfiguration.d.ts +78 -0
  53. package/dist/integration-engine/config/IntegrationEngineConfiguration.js +109 -0
  54. package/dist/integration-engine/config/IntegrationEngineConfiguration.js.map +1 -0
  55. package/dist/integration-engine/config/config.d.ts +5 -1
  56. package/dist/integration-engine/config/config.js +6 -88
  57. package/dist/integration-engine/config/config.js.map +1 -1
  58. package/dist/integration-engine/connectors/AMQPConnector.d.ts +12 -5
  59. package/dist/integration-engine/connectors/AMQPConnector.js +59 -35
  60. package/dist/integration-engine/connectors/AMQPConnector.js.map +1 -1
  61. package/dist/integration-engine/connectors/MongoConnector.d.ts +9 -3
  62. package/dist/integration-engine/connectors/MongoConnector.js +36 -14
  63. package/dist/integration-engine/connectors/MongoConnector.js.map +1 -1
  64. package/dist/integration-engine/connectors/PostgresConnector.d.ts +12 -3
  65. package/dist/integration-engine/connectors/PostgresConnector.js +40 -16
  66. package/dist/integration-engine/connectors/PostgresConnector.js.map +1 -1
  67. package/dist/integration-engine/connectors/RedisConnector.d.ts +9 -3
  68. package/dist/integration-engine/connectors/RedisConnector.js +32 -10
  69. package/dist/integration-engine/connectors/RedisConnector.js.map +1 -1
  70. package/dist/integration-engine/connectors/index.d.ts +24 -4
  71. package/dist/integration-engine/connectors/index.js +22 -19
  72. package/dist/integration-engine/connectors/index.js.map +1 -1
  73. package/dist/integration-engine/connectors/interfaces/IMongoConnector.d.ts +7 -0
  74. package/dist/integration-engine/connectors/interfaces/IMongoConnector.js +3 -0
  75. package/dist/integration-engine/connectors/interfaces/IMongoConnector.js.map +1 -0
  76. package/dist/integration-engine/connectors/interfaces/IPostgresConnector.d.ts +7 -0
  77. package/dist/integration-engine/connectors/interfaces/IPostgresConnector.js +3 -0
  78. package/dist/integration-engine/connectors/interfaces/IPostgresConnector.js.map +1 -0
  79. package/dist/integration-engine/connectors/interfaces/IRedisConnector.d.ts +7 -0
  80. package/dist/integration-engine/connectors/interfaces/IRedisConnector.js +3 -0
  81. package/dist/integration-engine/connectors/interfaces/IRedisConnector.js.map +1 -0
  82. package/dist/integration-engine/data-access/RawDataStorage.d.ts +11 -0
  83. package/dist/integration-engine/data-access/RawDataStorage.js +81 -0
  84. package/dist/integration-engine/data-access/RawDataStorage.js.map +1 -0
  85. package/dist/integration-engine/data-access/StorageService.d.ts +10 -4
  86. package/dist/integration-engine/data-access/StorageService.js +40 -18
  87. package/dist/integration-engine/data-access/StorageService.js.map +1 -1
  88. package/dist/integration-engine/data-access/index.d.ts +6 -1
  89. package/dist/integration-engine/data-access/index.js +7 -15
  90. package/dist/integration-engine/data-access/index.js.map +1 -1
  91. package/dist/integration-engine/data-access/interfaces/IStorageService.d.ts +3 -0
  92. package/dist/integration-engine/data-access/interfaces/IStorageService.js +3 -0
  93. package/dist/integration-engine/data-access/interfaces/IStorageService.js.map +1 -0
  94. package/dist/integration-engine/data-access/pubsub/RedisPubSubChannel.js +2 -2
  95. package/dist/integration-engine/data-access/pubsub/RedisPubSubChannel.js.map +1 -1
  96. package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategy.js +6 -4
  97. package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategy.js.map +1 -1
  98. package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategyStreamed.d.ts +1 -1
  99. package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategyStreamed.js +4 -3
  100. package/dist/integration-engine/datasources/protocol-strategy/PostgresProtocolStrategyStreamed.js.map +1 -1
  101. package/dist/integration-engine/helpers/GeocodeApi.d.ts +8 -3
  102. package/dist/integration-engine/helpers/GeocodeApi.js +32 -11
  103. package/dist/integration-engine/helpers/GeocodeApi.js.map +1 -1
  104. package/dist/integration-engine/helpers/Logger.d.ts +16 -10
  105. package/dist/integration-engine/helpers/Logger.js +13 -71
  106. package/dist/integration-engine/helpers/Logger.js.map +1 -1
  107. package/dist/integration-engine/helpers/LoggerEvents.d.ts +11 -0
  108. package/dist/integration-engine/helpers/LoggerEvents.js +91 -0
  109. package/dist/integration-engine/helpers/LoggerEvents.js.map +1 -0
  110. package/dist/integration-engine/helpers/RawDataStore.d.ts +3 -0
  111. package/dist/integration-engine/helpers/RawDataStore.js +5 -39
  112. package/dist/integration-engine/helpers/RawDataStore.js.map +1 -1
  113. package/dist/integration-engine/helpers/index.d.ts +8 -2
  114. package/dist/integration-engine/helpers/index.js +10 -2
  115. package/dist/integration-engine/helpers/index.js.map +1 -1
  116. package/dist/integration-engine/ioc/ContainerToken.d.ts +14 -0
  117. package/dist/integration-engine/ioc/ContainerToken.js +18 -0
  118. package/dist/integration-engine/ioc/ContainerToken.js.map +1 -0
  119. package/dist/integration-engine/ioc/Di.d.ts +2 -0
  120. package/dist/integration-engine/ioc/Di.js +46 -0
  121. package/dist/integration-engine/ioc/Di.js.map +1 -0
  122. package/dist/integration-engine/ioc/index.d.ts +2 -0
  123. package/dist/integration-engine/ioc/index.js +19 -0
  124. package/dist/integration-engine/ioc/index.js.map +1 -0
  125. package/dist/integration-engine/models/MongoModel.js +6 -6
  126. package/dist/integration-engine/models/MongoModel.js.map +1 -1
  127. package/dist/integration-engine/models/PostgresModel.d.ts +3 -1
  128. package/dist/integration-engine/models/PostgresModel.js +19 -14
  129. package/dist/integration-engine/models/PostgresModel.js.map +1 -1
  130. package/dist/integration-engine/models/RedisModel.js +2 -2
  131. package/dist/integration-engine/models/RedisModel.js.map +1 -1
  132. package/dist/output-gateway/Logger.d.ts +10 -2
  133. package/dist/output-gateway/Logger.js +9 -8
  134. package/dist/output-gateway/Logger.js.map +1 -1
  135. package/dist/output-gateway/config/OutputGatewayConfiguration.d.ts +51 -0
  136. package/dist/output-gateway/config/OutputGatewayConfiguration.js +90 -0
  137. package/dist/output-gateway/config/OutputGatewayConfiguration.js.map +1 -0
  138. package/dist/output-gateway/config/config.d.ts +5 -48
  139. package/dist/output-gateway/config/config.js +5 -69
  140. package/dist/output-gateway/config/config.js.map +1 -1
  141. package/dist/output-gateway/database/MongoDatabase.d.ts +7 -4
  142. package/dist/output-gateway/database/MongoDatabase.js +37 -16
  143. package/dist/output-gateway/database/MongoDatabase.js.map +1 -1
  144. package/dist/output-gateway/database/PostgreDatabase.d.ts +20 -3
  145. package/dist/output-gateway/database/PostgreDatabase.js +40 -17
  146. package/dist/output-gateway/database/PostgreDatabase.js.map +1 -1
  147. package/dist/output-gateway/database/index.d.ts +64 -1
  148. package/dist/output-gateway/database/index.js +17 -1
  149. package/dist/output-gateway/database/index.js.map +1 -1
  150. package/dist/output-gateway/ioc/ContainerToken.d.ts +13 -0
  151. package/dist/output-gateway/ioc/ContainerToken.js +17 -0
  152. package/dist/output-gateway/ioc/ContainerToken.js.map +1 -0
  153. package/dist/output-gateway/ioc/Di.d.ts +2 -0
  154. package/dist/output-gateway/ioc/Di.js +40 -0
  155. package/dist/output-gateway/ioc/Di.js.map +1 -0
  156. package/dist/output-gateway/ioc/index.d.ts +2 -0
  157. package/dist/output-gateway/ioc/index.js +19 -0
  158. package/dist/output-gateway/ioc/index.js.map +1 -0
  159. package/dist/output-gateway/models/GeoJsonModel.d.ts +1 -0
  160. package/dist/output-gateway/models/GeoJsonModel.js +7 -6
  161. package/dist/output-gateway/models/GeoJsonModel.js.map +1 -1
  162. package/dist/output-gateway/models/SequelizeModel.js +2 -2
  163. package/dist/output-gateway/models/SequelizeModel.js.map +1 -1
  164. package/dist/output-gateway/redis/CacheMiddleware.d.ts +9 -5
  165. package/dist/output-gateway/redis/CacheMiddleware.js +36 -17
  166. package/dist/output-gateway/redis/CacheMiddleware.js.map +1 -1
  167. package/dist/output-gateway/redis/RedisConnector.d.ts +6 -3
  168. package/dist/output-gateway/redis/RedisConnector.js +33 -13
  169. package/dist/output-gateway/redis/RedisConnector.js.map +1 -1
  170. package/dist/output-gateway/redis/index.d.ts +15 -1
  171. package/dist/output-gateway/redis/index.js +16 -1
  172. package/dist/output-gateway/redis/index.js.map +1 -1
  173. package/dist/shared/pino.d.ts +2 -0
  174. package/dist/shared/pino.js +29 -0
  175. package/dist/shared/pino.js.map +1 -0
  176. package/dist/shared/tsyringe.d.ts +1 -0
  177. package/dist/shared/tsyringe.js +18 -0
  178. package/dist/shared/tsyringe.js.map +1 -0
  179. package/package.json +4 -3
@@ -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 _monitoring_1 = require("../../monitoring");
6
- const getPaginationMaxLimit = () => {
7
- if (process.env.PAGINATION_MAX_LIMIT) {
8
- const parsed = parseInt(process.env.PAGINATION_MAX_LIMIT, 10);
9
- if (!isNaN(parsed)) {
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":";;;;AAAA,kDAAkD;AAElD,MAAM,qBAAqB,GAAG,GAAW,EAAE;IACvC,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE;QAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAA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X,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,iCAAmB;YAC/E,CAAC,CAAE,OAAO,CAAC,GAAG,CAAC,gBAAwC;YACvD,CAAC,CAAC,iCAAmB,CAAC,OAAO;QACrC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;KACvG;IACD,SAAS,EAAE;QACP,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;QACpH,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK;QACtH,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI;KACrH;IACD,gBAAgB,EAAE;QACd,eAAe,EAAE,MAAA,OAAO,CAAC,GAAG,CAAC,kCAAkC,mCAAI,eAAe;KACrF;CACJ,CAAC"}
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.mongooseConnection = exports.MongoDatabase = void 0;
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 config_1 = require("../config");
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
- Logger_1.log.error("Mongo DB disconnected!");
52
+ this.log.error("Mongo DB disconnected!");
39
53
  });
40
54
  mongoose_1.default.connection.on("reconnected", () => {
41
- Logger_1.log.warn("Mongo DB reconnected after connection lost.");
55
+ this.log.warn("Mongo DB reconnected after connection lost.");
42
56
  });
43
57
  mongoose_1.default.connection.on("error", (err) => {
44
- Logger_1.log.error(err);
58
+ this.log.error(err);
45
59
  });
46
- Logger_1.log.info("Connected to Mongo DB!");
60
+ this.log.info("Connected to Mongo DB!");
47
61
  return mongoose_1.default.connection;
48
62
  }
49
63
  catch (err) {
50
- Logger_1.log.error("Could not connect to " + this.connectionString);
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
- Logger_1.log.info("MongoDB disconnect called");
72
+ this.log.info("MongoDB disconnect called");
59
73
  return mongoose_1.default.connection.close();
60
74
  });
61
- this.connectionString = config_1.config.mongo_connection;
62
- this.connectTimeoutMS = config_1.config.mongo_timeout;
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":";;;;;;;;;;;;;;;AAAA,4CAA8C;AAC9C,wDAAoD;AACpD,sCAAoC;AACpC,sCAAiC;AAEjC;;GAEG;AACH,MAAa,aAAa;IAItB,+BAA+B;IAC/B;QAKA,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;gBAE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B;AA1DY,sCAAa"}
@@ -1,4 +1,21 @@
1
+ import { ILogger } from "../../helpers";
2
+ import { OutputGatewayConfiguration } from "../config/OutputGatewayConfiguration";
1
3
  import { Sequelize } from "sequelize";
2
- declare const sequelizeConnection: Sequelize;
3
- declare const sequelizeReadOnlyConnection: Sequelize;
4
- export { sequelizeConnection, sequelizeReadOnlyConnection };
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.sequelizeReadOnlyConnection = exports.sequelizeConnection = void 0;
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 config_1 = require("../config");
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: Logger_1.log.silly,
53
+ logging: this.log.silly,
40
54
  pool: {
41
55
  acquire: 60000,
42
- idle: Number(config_1.config.postgres_pool_idle_timeout) || 10000,
43
- min: Number(config_1.config.postgres_pool_min_connections) || 0,
44
- max: Number(config_1.config.postgres_pool_max_connections) || 5,
56
+ idle: Number(this.poolIdleTimeout) || 10000,
57
+ min: Number(this.poolMinConnections) || 0,
58
+ max: Number(this.poolMaxConnections) || 5,
45
59
  },
46
60
  });
47
- Logger_1.log.info("Connected to PostgresSQL DB!");
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
- Logger_1.log.info("PostgreSQL disconnect called");
78
+ this.log.info("PostgreSQL disconnect called");
65
79
  if (this.sequelize) {
66
80
  yield this.sequelize.close();
67
81
  }
68
82
  });
69
- this.connectionString = config_1.config.postgres_connection || "";
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
- const sequelizeConnection = new PostgresDatabase().connect(config_1.config.postgres_connection || "");
73
- exports.sequelizeConnection = sequelizeConnection;
74
- const sequelizeReadOnlyConnection = new PostgresDatabase().connect(config_1.config.postgres_read_only_connection || "");
75
- exports.sequelizeReadOnlyConnection = sequelizeReadOnlyConnection;
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
@@ -1 +1 @@
1
- {"version":3,"file":"PostgreDatabase.js","sourceRoot":"","sources":["../../../src/output-gateway/database/PostgreDatabase.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,yCAAsC;AACtC,sCAAoC;AACpC,sCAAiC;AAEjC;;GAEG;AACH,MAAM,gBAAgB;IAIlB;QAIA,qBAAqB;QACd,YAAO,GAAG,CAAC,gBAAyB,EAAE,EAAE;YAC3C,IAAI;gBACA,IAAI,IAAI,CAAC,SAAS,EAAE;oBAChB,OAAO,IAAI,CAAC,SAAS,CAAC;iBACzB;gBACD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qCADS,uDAA0B;GAR5D,gBAAgB,CAiE5B;AAjEY,4CAAgB"}
@@ -1,2 +1,65 @@
1
- export * from "./MongoDatabase";
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/aggregate" />
26
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/callback" />
27
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/collection" />
28
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/connection" />
29
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/cursor" />
30
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/document" />
31
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/error" />
32
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/expressions" />
33
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/helpers" />
34
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/middlewares" />
35
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/indexes" />
36
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/models" />
37
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/mongooseoptions" />
38
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/pipelinestage" />
39
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/populate" />
40
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/query" />
41
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/schemaoptions" />
42
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/schematypes" />
43
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/session" />
44
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/types" />
45
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/utility" />
46
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/validation" />
47
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/virtuals" />
48
+ /// <reference types="@golemio/validator/node_modules/mongoose" />
49
+ /// <reference types="mongoose/types/inferschematype" />
50
+ /// <reference types="@golemio/validator/node_modules/mongoose/types/inferschematype" />
51
+ import { Sequelize } from "sequelize";
52
+ /**
53
+ * @deprecated For backwards compatibility. Use ioc container instead.
54
+ */
55
+ declare const mongooseConnection: Promise<import("mongoose").Connection>;
56
+ /**
57
+ * @deprecated For backwards compatibility. Use ioc container instead.
58
+ */
59
+ declare const sequelizeConnection: Sequelize;
60
+ /**
61
+ * @deprecated For backwards compatibility. Use ioc container instead.
62
+ */
63
+ declare const sequelizeReadOnlyConnection: Sequelize;
2
64
  export * from "./PostgreDatabase";
65
+ export { mongooseConnection, sequelizeConnection, sequelizeReadOnlyConnection };
@@ -14,6 +14,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./MongoDatabase"), exports);
17
+ exports.sequelizeReadOnlyConnection = exports.sequelizeConnection = exports.mongooseConnection = void 0;
18
+ const ioc_1 = require("../ioc");
19
+ /**
20
+ * @deprecated For backwards compatibility. Use ioc container instead.
21
+ */
22
+ const mongooseConnection = ioc_1.OutputGatewayContainer.resolve(ioc_1.ContainerToken.MongoDatabase).connect();
23
+ exports.mongooseConnection = mongooseConnection;
24
+ /**
25
+ * @deprecated For backwards compatibility. Use ioc container instead.
26
+ */
27
+ const sequelizeConnection = ioc_1.OutputGatewayContainer.resolve(ioc_1.ContainerToken.SequelizeConnection);
28
+ exports.sequelizeConnection = sequelizeConnection;
29
+ /**
30
+ * @deprecated For backwards compatibility. Use ioc container instead.
31
+ */
32
+ const sequelizeReadOnlyConnection = ioc_1.OutputGatewayContainer.resolve(ioc_1.ContainerToken.SequelizeReadOnlyConnection);
33
+ exports.sequelizeReadOnlyConnection = sequelizeReadOnlyConnection;
18
34
  __exportStar(require("./PostgreDatabase"), exports);
19
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/database/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,oDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/database/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gCAAiE;AAIjE;;GAEG;AACH,MAAM,kBAAkB,GAAG,4BAAsB,CAAC,OAAO,CAAgB,oBAAc,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,CAAC;AAWxG,gDAAkB;AAV3B;;GAEG;AACH,MAAM,mBAAmB,GAAG,4BAAsB,CAAC,OAAO,CAAY,oBAAc,CAAC,mBAAmB,CAAC,CAAC;AAO7E,kDAAmB;AANhD;;GAEG;AACH,MAAM,2BAA2B,GAAG,4BAAsB,CAAC,OAAO,CAAY,oBAAc,CAAC,2BAA2B,CAAC,CAAC;AAGxE,kEAA2B;AAD7E,oDAAkC"}
@@ -0,0 +1,13 @@
1
+ declare const ContainerToken: {
2
+ Config: symbol;
3
+ Logger: symbol;
4
+ LoggerEvents: symbol;
5
+ RequestLogger: symbol;
6
+ PostgresDatabase: symbol;
7
+ SequelizeReadOnlyConnection: symbol;
8
+ SequelizeConnection: symbol;
9
+ RedisConnector: symbol;
10
+ CacheMiddleware: symbol;
11
+ MongoDatabase: symbol;
12
+ };
13
+ export { ContainerToken };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContainerToken = void 0;
4
+ const ContainerToken = {
5
+ Config: Symbol(),
6
+ Logger: Symbol(),
7
+ LoggerEvents: Symbol(),
8
+ RequestLogger: Symbol(),
9
+ PostgresDatabase: Symbol(),
10
+ SequelizeReadOnlyConnection: Symbol(),
11
+ SequelizeConnection: Symbol(),
12
+ RedisConnector: Symbol(),
13
+ CacheMiddleware: Symbol(),
14
+ MongoDatabase: Symbol(),
15
+ };
16
+ exports.ContainerToken = ContainerToken;
17
+ //# sourceMappingURL=ContainerToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContainerToken.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/ContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,cAAc,GAAG;IACnB,MAAM,EAAE,MAAM,EAAE;IAChB,MAAM,EAAE,MAAM,EAAE;IAChB,YAAY,EAAE,MAAM,EAAE;IACtB,aAAa,EAAE,MAAM,EAAE;IACvB,gBAAgB,EAAE,MAAM,EAAE;IAC1B,2BAA2B,EAAE,MAAM,EAAE;IACrC,mBAAmB,EAAE,MAAM,EAAE;IAC7B,cAAc,EAAE,MAAM,EAAE;IACxB,eAAe,EAAE,MAAM,EAAE;IACzB,aAAa,EAAE,MAAM,EAAE;CAC1B,CAAC;AAEO,wCAAc"}
@@ -0,0 +1,2 @@
1
+ declare const OutputGatewayContainer: import("tsyringe").DependencyContainer;
2
+ export { OutputGatewayContainer };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutputGatewayContainer = void 0;
4
+ const _helpers_1 = require("../../helpers");
5
+ const Di_1 = require("../../helpers/ioc/Di");
6
+ const OutputGatewayConfiguration_1 = require("../config/OutputGatewayConfiguration");
7
+ const MongoDatabase_1 = require("../database/MongoDatabase");
8
+ const PostgreDatabase_1 = require("../database/PostgreDatabase");
9
+ const CacheMiddleware_1 = require("../redis/CacheMiddleware");
10
+ const RedisConnector_1 = require("../redis/RedisConnector");
11
+ const tsyringe_1 = require("tsyringe");
12
+ const ContainerToken_1 = require("./ContainerToken");
13
+ //#region Initialization
14
+ const singletonOptions = { lifecycle: tsyringe_1.Lifecycle.Singleton };
15
+ const OutputGatewayContainer = Di_1.GlobalContainer.createChildContainer();
16
+ exports.OutputGatewayContainer = OutputGatewayContainer;
17
+ //#endregion
18
+ //#region General
19
+ OutputGatewayContainer.registerSingleton(ContainerToken_1.ContainerToken.Config, OutputGatewayConfiguration_1.OutputGatewayConfiguration);
20
+ const config = OutputGatewayContainer.resolve(ContainerToken_1.ContainerToken.Config);
21
+ OutputGatewayContainer.register(ContainerToken_1.ContainerToken.Logger, {
22
+ useFactory: (0, tsyringe_1.instanceCachingFactory)(() => (0, _helpers_1.createLogger)({
23
+ projectName: "output-gateway",
24
+ nodeEnv: config.node_env,
25
+ logLevel: config.log_level,
26
+ })),
27
+ }).registerInstance(ContainerToken_1.ContainerToken.RequestLogger, (0, _helpers_1.createRequestLogger)(config.node_env, OutputGatewayContainer.resolve(ContainerToken_1.ContainerToken.Logger)));
28
+ //#endregion
29
+ //#region Data Access
30
+ OutputGatewayContainer.register(ContainerToken_1.ContainerToken.PostgresDatabase, { useClass: PostgreDatabase_1.PostgresDatabase }, { lifecycle: tsyringe_1.Lifecycle.Transient })
31
+ .register(ContainerToken_1.ContainerToken.SequelizeReadOnlyConnection, {
32
+ useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(ContainerToken_1.ContainerToken.PostgresDatabase).connect(config.postgres_read_only_connection || "")),
33
+ })
34
+ .register(ContainerToken_1.ContainerToken.SequelizeConnection, {
35
+ useFactory: (0, tsyringe_1.instanceCachingFactory)((c) => c.resolve(ContainerToken_1.ContainerToken.PostgresDatabase).connect(config.postgres_connection || "")),
36
+ })
37
+ .registerSingleton(ContainerToken_1.ContainerToken.MongoDatabase, MongoDatabase_1.MongoDatabase)
38
+ .registerSingleton(ContainerToken_1.ContainerToken.RedisConnector, RedisConnector_1.RedisConnector)
39
+ .registerSingleton(ContainerToken_1.ContainerToken.CacheMiddleware, CacheMiddleware_1.CacheMiddleware);
40
+ //# sourceMappingURL=Di.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,4CAAsE;AACtE,6CAAkD;AAClD,qFAAmF;AACnF,6DAA2D;AAC3D,iEAAgE;AAChE,8DAA4D;AAC5D,4DAA0D;AAC1D,uCAA6D;AAC7D,qDAAkD;AAElD,wBAAwB;AACxB,MAAM,gBAAgB,GAAG,EAAE,SAAS,EAAE,oBAAS,CAAC,SAAS,EAAE,CAAC;AAC5D,MAAM,sBAAsB,GAAG,oBAAe,CAAC,oBAAoB,EAAE,CAAC;AA0C7D,wDAAsB;AAzC/B,YAAY;AAEZ,iBAAiB;AACjB,sBAAsB,CAAC,iBAAiB,CAAC,+BAAc,CAAC,MAAM,EAAE,uDAA0B,CAAC,CAAC;AAC5F,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAA6B,+BAAc,CAAC,MAAM,CAAC,CAAC;AAEjG,sBAAsB,CAAC,QAAQ,CAAU,+BAAc,CAAC,MAAM,EAAE;IAC5D,UAAU,EAAE,IAAA,iCAAsB,EAAC,GAAG,EAAE,CACpC,IAAA,uBAAY,EAAC;QACT,WAAW,EAAE,gBAAgB;QAC7B,OAAO,EAAE,MAAM,CAAC,QAAQ;QACxB,QAAQ,EAAE,MAAM,CAAC,SAAS;KAC7B,CAAC,CACL;CACJ,CAAC,CAAC,gBAAgB,CACf,+BAAc,CAAC,aAAa,EAC5B,IAAA,8BAAmB,EAAC,MAAM,CAAC,QAAQ,EAAE,sBAAsB,CAAC,OAAO,CAAU,+BAAc,CAAC,MAAM,CAAC,CAAC,CACvG,CAAC;AACF,YAAY;AAEZ,qBAAqB;AACrB,sBAAsB,CAAC,QAAQ,CAC3B,+BAAc,CAAC,gBAAgB,EAC/B,EAAE,QAAQ,EAAE,kCAAgB,EAAE,EAC9B,EAAE,SAAS,EAAE,oBAAS,CAAC,SAAS,EAAE,CACrC;KACI,QAAQ,CAAC,+BAAc,CAAC,2BAA2B,EAAE;IAClD,UAAU,EAAE,IAAA,iCAAsB,EAAC,CAAC,CAAC,EAAE,EAAE,CACrC,CAAC,CAAC,OAAO,CAAmB,+BAAc,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,6BAA6B,IAAI,EAAE,CAAC,CACnH;CACJ,CAAC;KACD,QAAQ,CAAC,+BAAc,CAAC,mBAAmB,EAAE;IAC1C,UAAU,EAAE,IAAA,iCAAsB,EAAC,CAAC,CAAC,EAAE,EAAE,CACrC,CAAC,CAAC,OAAO,CAAmB,+BAAc,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,IAAI,EAAE,CAAC,CACzG;CACJ,CAAC;KACD,iBAAiB,CAAC,+BAAc,CAAC,aAAa,EAAE,6BAAa,CAAC;KAC9D,iBAAiB,CAAC,+BAAc,CAAC,cAAc,EAAE,+BAAc,CAAC;KAChE,iBAAiB,CAAC,+BAAc,CAAC,eAAe,EAAE,iCAAe,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./ContainerToken";
2
+ export * from "./Di";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ContainerToken"), exports);
18
+ __exportStar(require("./Di"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/ioc/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,uCAAqB"}
@@ -19,6 +19,7 @@ import { IGeoJsonModel } from "./interfaces/IGeoJsonModel";
19
19
  * Performs database queries.
20
20
  */
21
21
  export declare class GeoJsonModel extends MongoModel implements IGeoJsonModel {
22
+ private log;
22
23
  /**
23
24
  * Creates a model with specified schema definition
24
25
  * @param inName Name of the model - corresponding with mongo collection name (eg. "parkings" for "Parking" model)
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.GeoJsonModel = void 0;
16
16
  const Geo_1 = require("../Geo");
17
- const Logger_1 = require("../Logger");
17
+ const ioc_1 = require("../ioc");
18
18
  const models_1 = require("./");
19
19
  const errors_1 = require("@golemio/errors");
20
20
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
@@ -83,11 +83,12 @@ class GeoJsonModel extends models_1.MongoModel {
83
83
  }
84
84
  return true;
85
85
  };
86
+ this.log = ioc_1.OutputGatewayContainer.resolve(ioc_1.ContainerToken.Logger);
86
87
  // create $geonear index
87
88
  this.schema.index({ geometry: "2dsphere" });
88
89
  if (!this.HasRequiredGeojsonProps(inSchema)) {
89
- Logger_1.log.warn("Creating " + inName + " GeoJSON model: imported schema not in GeoJSON format!");
90
- Logger_1.log.debug(inSchema);
90
+ this.log.warn("Creating " + inName + " GeoJSON model: imported schema not in GeoJSON format!");
91
+ this.log.debug(inSchema);
91
92
  }
92
93
  }
93
94
  /** Retrieves all the records from database
@@ -152,8 +153,8 @@ class GeoJsonModel extends models_1.MongoModel {
152
153
  q.skip(options.offset);
153
154
  }
154
155
  q.select(this.projection);
155
- Logger_1.log.silly("Executing query with selection: ");
156
- Logger_1.log.silly(this.selection);
156
+ this.log.silly("Executing query with selection: ");
157
+ this.log.silly(this.selection);
157
158
  this.selection = {};
158
159
  const data = yield q.exec();
159
160
  // Create GeoJSON FeatureCollection output
@@ -174,7 +175,7 @@ class GeoJsonModel extends models_1.MongoModel {
174
175
  return __awaiter(this, void 0, void 0, function* () {
175
176
  const found = yield this.model.findOne(this.PrimaryIdentifierSelection(inId), "-_id -__v").lean().exec();
176
177
  if (!found || (found instanceof Array && found.length === 0)) {
177
- Logger_1.log.debug("Could not find any record by specified selection.", this.PrimaryIdentifierSelection(inId));
178
+ this.log.debug("Could not find any record by specified selection.", this.PrimaryIdentifierSelection(inId));
178
179
  throw new errors_1.CustomError("Id `" + inId + "` not found", true, "GeoJsonModel", 404);
179
180
  }
180
181
  else {