@uniorganization/uni-lib 1.0.20 → 1.0.24

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.
@@ -10,29 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.versionChecker = void 0;
13
- const config_entity_1 = require("../entities/config.entity");
14
- const typeorm_1 = require("typeorm");
13
+ const fs = require("fs/promises");
14
+ const path = require("path");
15
15
  function versionChecker(req, res, next) {
16
16
  return __awaiter(this, void 0, void 0, function* () {
17
- const connection = yield (0, typeorm_1.createConnection)({
18
- type: 'postgres',
19
- host: '127.0.0.1',
20
- port: 5432,
21
- username: 'postgres',
22
- password: 'postgres',
23
- database: 'uni',
24
- ssl: false,
25
- schema: 'stm',
26
- entities: [config_entity_1.Config],
27
- synchronize: false,
28
- });
29
- const { value: version } = yield connection
30
- .getRepository(config_entity_1.Config)
31
- .createQueryBuilder('config')
32
- .where('config.key = :configKey', { configKey: 'app.version' })
33
- .getOne();
34
- yield connection.close();
35
- if (req.headers['App-Version'] !== version)
17
+ const version = (yield fs.readFile(path.join(__dirname, '..', '..', 'app-version.txt'))).toString();
18
+ if (req.headers['app-version'] !== version)
36
19
  return res.status(409).json({
37
20
  message: `You need to update the application version to ${version}`,
38
21
  status: 409,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniorganization/uni-lib",
3
- "version": "1.0.20",
3
+ "version": "1.0.24",
4
4
  "description": "UNI Library",
5
5
  "author": "Jhomiguel",
6
6
  "main": "dist/index.js",